|
GPIO_NXP_Arduino 1.1.2
GPIO device operation sample code for Arduino
|
#include <GPIO_NXP.h>
Public Types | |
| enum | reg_num { Input_Port , Output_Port , Polarity_Inversion , Configuration } |
| enum | board { NONE , ARDUINO_SHIELD } |
| Public Types inherited from GPIO_base | |
| enum | board { NONE , ARDUINO_SHIELD } |
Public Member Functions | |
| PCA9554 (uint8_t i2c_address=(0x40 > > 1)+0) | |
| PCA9554 (TwoWire &wire, uint8_t i2c_address=(0x40 > > 1)+0) | |
| virtual | ~PCA9554 () |
| void | begin (board env=NONE) |
| void | output (int port, uint8_t value, uint8_t mask=0) |
| void | output (const uint8_t *vp) |
| uint8_t | input (int port) |
| uint8_t * | input (uint8_t *vp) |
| void | config (int port, uint8_t config, uint8_t mask=0) |
| void | config (const uint8_t *vp) |
| void | write_port (access_word w, const uint8_t *vp) |
| void | write_port16 (access_word w, const uint16_t *vp) |
| uint8_t * | read_port (access_word w, uint8_t *vp) |
| uint16_t * | read_port16 (access_word w, uint16_t *vp) |
| void | write_port (access_word w, uint8_t value, int port_num=0) |
| void | write_port16 (access_word w, uint16_t value, int port_num=0) |
| uint8_t | read_port (access_word w, int port_num=0) |
| uint16_t | read_port16 (access_word w, int port_num=0) |
| bool | ping (void) |
| int | reg_w (uint8_t reg_adr, const uint8_t *data, uint16_t size) |
| int | reg_w (uint8_t reg_adr, uint8_t data) |
| int | reg_r (uint8_t reg_adr, uint8_t *data, uint16_t size) |
| uint8_t | reg_r (uint8_t reg_adr) |
| void | write_r8 (uint8_t reg, uint8_t val) |
| void | write_r16 (uint8_t reg, uint16_t val) |
| uint8_t | read_r8 (uint8_t reg) |
| uint16_t | read_r16 (uint8_t reg) |
| void | bit_op8 (uint8_t reg, uint8_t mask, uint8_t value) |
| void | bit_op16 (uint8_t reg, uint16_t mask, uint16_t value) |
| Public Member Functions inherited from GPIO_base | |
| 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) |
Public Attributes | |
| const int | n_bits |
| const int | n_ports |
| Public Attributes inherited from GPIO_base | |
| const int | n_bits |
| const int | n_ports |
Static Public Attributes | |
| static constexpr uint8_t | access_ref [NUM_access_word] |
Additional Inherited Members | |
| Static Public Member Functions inherited from GPIO_base | |
| static void | print_bin (uint8_t v) |
| Protected Attributes inherited from GPIO_base | |
| const uint8_t | auto_increment |
PCA9554 class
Definition at line 246 of file GPIO_NXP.h.
| enum PCA9554::board |
Constants for begin() method
Definition at line 289 of file GPIO_NXP.h.
| enum PCA9554::reg_num |
Name of the PCA9554 registers
Definition at line 250 of file GPIO_NXP.h.
| PCA9554::PCA9554 | ( | uint8_t | i2c_address = (0x40 >> 1) + 0 | ) |
| PCA9554::PCA9554 | ( | TwoWire & | wire, |
| uint8_t | i2c_address = (0x40 >> 1) + 0 ) |
Constructor
| wire | TwoWire instance |
| i2c_address | I2C target address |
Definition at line 203 of file GPIO_NXP.cpp.
|
virtual |
Destructor
Definition at line 208 of file GPIO_NXP.cpp.
| void PCA9554::begin | ( | board | env = NONE | ) |
Device/board initialization
This method is needed to initialize Arduino-shield type evaluation boards from NXP. This method takes one argument of "PCA9554::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 "PCA9554::NONE" or "PCA9554::ARDUINO_SHIELD" |
| void PCA9554::bit_op8 | ( | uint8_t | reg, |
| uint8_t | mask, | ||
| uint8_t | value ) |
Register overwriting with bit-mask
Register can be updated by bit level
| reg | register index/address/pointer |
| mask | bit-mask to protect overwriting |
| value | value to overwrite |
|
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 from GPIO_base.
|
virtual |
|
virtual |
Input, single port
Basic GPIO port access function for single port input
| port | Port number |
Reimplemented from GPIO_base.
|
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 from GPIO_base.
|
virtual |
Output, all ports
Basic GPIO port access function for all ports output
| vp | Pointer to an array of values. The array should have 'n_ports' length |
Reimplemented from GPIO_base.
|
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 from GPIO_base.
| bool PCA9554::ping | ( | void | ) |
Ping the device
|
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 from GPIO_base.
|
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 from GPIO_base.
|
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 from GPIO_base.
|
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 from GPIO_base.
| uint16_t PCA9554::read_r16 | ( | uint8_t | reg | ) |
Register read, 16 bit
This 16 bit access may not be common but it's useful for sensor devices
| reg | register index/address/pointer |
| uint8_t PCA9554::read_r8 | ( | uint8_t | reg | ) |
Register read, 8 bit
| reg | register index/address/pointer |
| uint8_t PCA9554::reg_r | ( | uint8_t | reg_adr | ) |
Single register read
| reg | register index/address/pointer |
| int PCA9554::reg_r | ( | uint8_t | reg_adr, |
| uint8_t * | data, | ||
| uint16_t | size ) |
Multiple register read
| reg | register index/address/pointer |
| data | pointer to data buffer |
| size | data size |
| int PCA9554::reg_w | ( | uint8_t | reg_adr, |
| const uint8_t * | data, | ||
| uint16_t | size ) |
Multiple register write
| reg | register index/address/pointer |
| data | pointer to data buffer |
| size | data size |
| int PCA9554::reg_w | ( | uint8_t | reg_adr, |
| uint8_t | data ) |
Single register write
| reg_adr | register index/address/pointer |
| data | data byte to write |
|
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 from GPIO_base.
|
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 from GPIO_base.
|
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 from GPIO_base.
|
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 from GPIO_base.
| void PCA9554::write_r16 | ( | uint8_t | reg, |
| uint16_t | val ) |
Register write, 16 bit
This 16 bit access may not be common but it's useful for sensor devices
| reg | register index/address/pointer |
| val | data value |
| void PCA9554::write_r8 | ( | uint8_t | reg, |
| uint8_t | val ) |
Register write, 8 bit
| reg | register index/address/pointer |
| val | data value |
|
staticconstexpr |
Definition at line 273 of file GPIO_NXP.h.
| const int PCA9554::n_bits |
Number of IO bits
Definition at line 295 of file GPIO_NXP.h.
| const int PCA9554::n_ports |
Number of IO ports
Definition at line 298 of file GPIO_NXP.h.