|
GPIO_NXP_Arduino 1.1.2
GPIO device operation sample code for Arduino
|
#include <GPIO_NXP.h>
Public Types | |
| enum | board { NONE , ARDUINO_SHIELD } |
Public Member Functions | |
| GPIO_base (uint8_t i2c_address, int nbits, const uint8_t *arp, uint8_t ai) | |
| GPIO_base (TwoWire &wire, uint8_t i2c_address, int nbits, const uint8_t *arp, uint8_t ai) | |
| virtual | ~GPIO_base () |
| virtual void | begin (board env=NONE) |
| virtual void | output (int port, uint8_t value, uint8_t mask=0) |
| virtual void | output (const uint8_t *vp) |
| virtual uint8_t | input (int port) |
| virtual uint8_t * | input (uint8_t *vp) |
| virtual void | config (int port, uint8_t config, uint8_t mask=0) |
| virtual void | config (const uint8_t *vp) |
| virtual void | write_port (access_word w, const uint8_t *vp) |
| virtual void | write_port16 (access_word w, const uint16_t *vp) |
| virtual uint8_t * | read_port (access_word w, uint8_t *vp) |
| virtual uint16_t * | read_port16 (access_word w, uint16_t *vp) |
| virtual void | write_port (access_word w, uint8_t value, int port_num=0) |
| virtual void | write_port16 (access_word w, uint16_t value, int port_num=0) |
| virtual uint8_t | read_port (access_word w, int port_num=0) |
| virtual uint16_t | read_port16 (access_word w, int port_num=0) |
Static Public Member Functions | |
| static void | print_bin (uint8_t v) |
Public Attributes | |
| const int | n_bits |
| const int | n_ports |
Protected Attributes | |
| const uint8_t | auto_increment |
GPIO_base class
This class is a base class for all GPIO devices All actual device class will be derived from this
Definition at line 44 of file GPIO_NXP.h.
| enum GPIO_base::board |
Definition at line 47 of file GPIO_NXP.h.
| GPIO_base::GPIO_base | ( | uint8_t | i2c_address, |
| int | nbits, | ||
| const uint8_t * | arp, | ||
| uint8_t | ai ) |
Constructor
| i2c_address | I2C target address |
| nbits | Number of IO bits |
| arp | Pointer to register access reference table |
| ai | Auto-increment flag |
Definition at line 5 of file GPIO_NXP.cpp.
Referenced by GPIO_SPI::GPIO_SPI(), PCA9554::PCA9554(), PCA9554::PCA9554(), PCA9555::PCA9555(), PCA9555::PCA9555(), PCAL6xxx_base::PCAL6xxx_base(), and PCAL6xxx_base::PCAL6xxx_base().
| GPIO_base::GPIO_base | ( | TwoWire & | wire, |
| uint8_t | i2c_address, | ||
| int | nbits, | ||
| const uint8_t * | arp, | ||
| uint8_t | ai ) |
Constructor
| wire | TwoWire instance |
| i2c_address | I2C target address |
| nbits | Number of IO bits |
| arp | Pointer to register access reference table |
| ai | Auto-increment flag |
Definition at line 15 of file GPIO_NXP.cpp.
|
virtual |
Destructor
Definition at line 33 of file GPIO_NXP.cpp.
|
virtual |
Device/board initialization
This method is needed to initialize Arduino-shield type evaluation boards from NXP. This method takes one argument of "GPIO_base::ARDUINO_SHIELD" to set RESET and ADDRESS pins.
If the device is used as it self, this method doesn't need to be called.
| env | This argument can be given as "GPIO_base::NONE" or "GPIO_base::ARDUINO_SHIELD" |
Definition at line 37 of file GPIO_NXP.cpp.
|
virtual |
Config, all ports
Basic GPIO port access function for all port configuration
| vp | Pointer to array of configuration values. The array should have 'n_ports' length |
Reimplemented in PCA9554, PCA9555, PCAL6408A, PCAL6416A, PCAL6524, PCAL6534, and PCAL9722.
Definition at line 88 of file GPIO_NXP.cpp.
|
virtual |
Config, single port
Basic GPIO port access function for single port configuration
| port | Port number |
| value | Value to be written into configuration register |
| mask | Bit mask. Value will not be changed in bit positions '1' in mask |
Reimplemented in PCA9554, PCA9555, PCAL6408A, PCAL6416A, PCAL6524, PCAL6534, and PCAL9722.
Definition at line 80 of file GPIO_NXP.cpp.
Referenced by config().
|
virtual |
|
virtual |
Input, all ports
Basic GPIO port access function for all ports input
| vp | Pointer to an array of values. The array should have 'n_ports' length |
Reimplemented in PCA9554, PCA9555, PCAL6408A, PCAL6416A, PCAL6524, PCAL6534, and PCAL9722.
Definition at line 73 of file GPIO_NXP.cpp.
|
virtual |
|
virtual |
Output, single port
Basic GPIO port access function for single port output
| port | Port number |
| value | Value to be output |
| mask | Bit mask. Value will not be changed in bit positions '1' in mask |
Reimplemented in PCA9554, PCA9555, PCAL6408A, PCAL6416A, PCAL6524, PCAL6534, and PCAL9722.
Definition at line 55 of file GPIO_NXP.cpp.
|
static |
Print binary representation of a byte to serial
| v | value to print |
Definition at line 188 of file GPIO_NXP.cpp.
|
virtual |
Read single port method
Single port register access function using word of 'access_word'
| w | Access word. This should be chosen from 'access_word' |
| port_num | Option, to specify port number |
Reimplemented in PCA9554, PCA9555, PCAL6408A, PCAL6416A, PCAL6524, PCAL6534, and PCAL9722.
Definition at line 178 of file GPIO_NXP.cpp.
|
virtual |
Read all port method
All port register access function using word of 'access_word'
| w | Access word. This should be chosen from 'access_word' |
| vp | Pointer to an array of values. The array should have 'n_ports' length |
Reimplemented in PCA9554, PCA9555, PCAL6408A, PCAL6416A, PCAL6524, PCAL6534, and PCAL9722.
Definition at line 130 of file GPIO_NXP.cpp.
Referenced by input().
|
virtual |
Read single port method
Single port 16 bit register access function using word of 'access_word'
| w | Access word. This should be chosen from 'access_word' |
| port_num | Option, to specify port number |
Reimplemented in PCA9554, PCA9555, PCAL6408A, PCAL6416A, PCAL6524, PCAL6534, and PCAL9722.
Definition at line 183 of file GPIO_NXP.cpp.
|
virtual |
Read all port method
All port 16 bit register access function using word of 'access_word'
| w | Access word. This should be chosen from 'access_word' |
| vp | Pointer to an array of values. The array should have 'n_ports' length |
Reimplemented in PCA9554, PCA9555, PCAL6408A, PCAL6416A, PCAL6524, PCAL6534, and PCAL9722.
Definition at line 143 of file GPIO_NXP.cpp.
|
virtual |
Write all port method
All port register access function using word of 'access_word'
| w | Access word. This should be chosen from 'access_word' |
| vp | Pointer to an array of values. The array should have 'n_ports' length |
Reimplemented in PCA9554, PCA9555, PCAL6408A, PCAL6416A, PCAL6524, PCAL6534, and PCAL9722.
Definition at line 93 of file GPIO_NXP.cpp.
|
virtual |
Write single port method
Single port register access function using word of 'access_word'
| w | Access word. This should be chosen from 'access_word' |
| value | Value to be written into a register |
| port_num | Option, to specify port number |
Reimplemented in PCA9554, PCA9555, PCAL6408A, PCAL6416A, PCAL6524, PCAL6534, and PCAL9722.
Definition at line 168 of file GPIO_NXP.cpp.
|
virtual |
Write all port method
All port 16 bit register access function using word of 'access_word'
| w | Access word. This should be chosen from 'access_word' |
| vp | Pointer to an array of values. The array should have 'n_ports' length |
Reimplemented in PCA9554, PCA9555, PCAL6408A, PCAL6416A, PCAL6524, PCAL6534, and PCAL9722.
Definition at line 104 of file GPIO_NXP.cpp.
|
virtual |
Write single port method
Single port 16 bit register access function using word of 'access_word'
| w | Access word. This should be chosen from 'access_word' |
| value | Value to be written into a register |
| port_num | Option, to specify port number |
Reimplemented in PCA9554, PCA9555, PCAL6408A, PCAL6416A, PCAL6524, PCAL6534, and PCAL9722.
Definition at line 173 of file GPIO_NXP.cpp.
|
protected |
Definition at line 230 of file GPIO_NXP.h.
| const int GPIO_base::n_bits |
Number of IO bits
Definition at line 53 of file GPIO_NXP.h.
Referenced by GPIO_base(), GPIO_base(), read_port16(), and write_port16().
| const int GPIO_base::n_ports |
Number of IO ports
Definition at line 56 of file GPIO_NXP.h.
Referenced by GPIO_base(), GPIO_base(), read_port(), read_port16(), write_port(), and write_port16().