GPIO_NXP_Arduino 0.4.2
GPIO device operation sample code for Arduino
|
#include <GPIO_NXP.h>
Public Types | |
enum | reg_num { Input_Port_0 , Input_Port_1 , Output_Port_0 , Output_Port_1 , Polarity_Inversion_Port_0 , Polarity_Inversion_Port_1 , Configuration_Port_0 , Configuration_Port_1 } |
enum | board { NONE , ARDUINO_SHIELD } |
![]() | |
enum | board { NONE , ARDUINO_SHIELD } |
Public Member Functions | |
PCA9555 (uint8_t i2c_address=(0x40 > > 1)+0) | |
PCA9555 (TwoWire &wire, uint8_t i2c_address=(0x40 > > 1)+0) | |
virtual | ~PCA9555 () |
void | begin (board env=NONE) |
void | output (int port, uint8_t value, uint8_t mask=0) |
void | output (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 (uint8_t *vp) |
void | write_port (access_word w, uint8_t *vp) |
void | write_port16 (access_word w, 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) |
![]() | |
GPIO_base (uint8_t i2c_address, const int nbits, const uint8_t *arp, uint8_t ai) | |
GPIO_base (TwoWire &wire, uint8_t i2c_address, const int nbits, const uint8_t *arp, uint8_t ai) | |
virtual | ~GPIO_base () |
void | begin (board env=NONE) |
void | output (int port, uint8_t value, uint8_t mask=0) |
void | output (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 (uint8_t *vp) |
void | write_port (access_word w, uint8_t *vp) |
void | write_port16 (access_word w, 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) |
Public Attributes | |
const int | n_bits |
const int | n_ports |
![]() | |
const int | n_bits |
const int | n_ports |
Static Public Attributes | |
static constexpr uint8_t | access_ref [NUM_access_word] |
Additional Inherited Members | |
![]() | |
static void | print_bin (uint8_t v) |
PCA9555 class
Definition at line 444 of file GPIO_NXP.h.
enum PCA9555::board |
Constants for begin() method
Definition at line 487 of file GPIO_NXP.h.
enum PCA9555::reg_num |
Name of the PCA9555 registers
Definition at line 448 of file GPIO_NXP.h.
PCA9555::PCA9555 | ( | uint8_t | i2c_address = (0x40 >> 1) + 0 | ) |
PCA9555::PCA9555 | ( | TwoWire & | wire, |
uint8_t | i2c_address = (0x40 >> 1) + 0 |
||
) |
Constractor
wire | TwoWire instance |
i2c_address | I2C target address |
Definition at line 217 of file GPIO_NXP.cpp.
|
virtual |
Destractor
Definition at line 222 of file GPIO_NXP.cpp.
void PCA9555::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 "PCA9555::ARDUINO_SHIELD" to set RESET and ADDRESS pins.
If the devoce is used as it self, this method doesn't need to be called.
env | This argument can be given as "PCA9555::NONE" ot "PCA9555::ARDUINO_SHIELD" |
void PCA9555::config | ( | int | port, |
uint8_t | config, | ||
uint8_t | mask = 0 |
||
) |
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 |
void PCA9555::config | ( | uint8_t * | vp | ) |
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 |
uint8_t PCA9555::input | ( | int | port | ) |
Input, single port
Basic GPIO port access function for single port input
port | Port number |
uint8_t * PCA9555::input | ( | uint8_t * | vp | ) |
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 |
void PCA9555::output | ( | int | port, |
uint8_t | value, | ||
uint8_t | mask = 0 |
||
) |
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 |
void PCA9555::output | ( | uint8_t * | vp | ) |
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 |
uint8_t PCA9555::read_port | ( | access_word | w, |
int | port_num = 0 |
||
) |
Read single port method
Single port register access function using word of 'access_word'
w | Accsess word. This should be choosen from access_word' |
port_num | Option, to specify port number |
uint8_t * PCA9555::read_port | ( | access_word | w, |
uint8_t * | vp | ||
) |
Read all port method
All port register access function using word of 'access_word'
w | Accsess word. This should be choosen from access_word' |
vp | Pointer to an array of values. The array should have 'n_ports' length |
uint16_t PCA9555::read_port16 | ( | access_word | w, |
int | port_num = 0 |
||
) |
Read single port method
Single port 16 bit register access function using word of 'access_word'
w | Accsess word. This should be choosen from access_word' |
port_num | Option, to specify port number |
uint16_t * PCA9555::read_port16 | ( | access_word | w, |
uint16_t * | vp | ||
) |
Read all port method
All port 16 bit register access function using word of 'access_word'
w | Accsess word. This should be choosen from access_word' |
vp | Pointer to an array of values. The array should have 'n_ports' length |
void PCA9555::write_port | ( | access_word | w, |
uint8_t * | vp | ||
) |
Write all port method
All port register access function using word of 'access_word'
w | Accsess word. This should be choosen from access_word' |
vp | Pointer to an array of values. The array should have 'n_ports' length |
void PCA9555::write_port | ( | access_word | w, |
uint8_t | value, | ||
int | port_num = 0 |
||
) |
Write single port method
Single port register access function using word of 'access_word'
w | Accsess word. This should be choosen from access_word' |
value | Value to be written into a register |
port_num | Option, to specify port number |
void PCA9555::write_port16 | ( | access_word | w, |
uint16_t * | vp | ||
) |
Write all port method
All port 16 bit register access function using word of 'access_word'
w | Accsess word. This should be choosen from access_word' |
vp | Pointer to an array of values. The array should have 'n_ports' length |
void PCA9555::write_port16 | ( | access_word | w, |
uint16_t | value, | ||
int | port_num = 0 |
||
) |
Write single port method
Single port 16 bit register access function using word of 'access_word'
w | Accsess word. This should be choosen from access_word' |
value | Value to be written into a register |
port_num | Option, to specify port number |
|
staticconstexpr |
Definition at line 471 of file GPIO_NXP.h.
const int PCA9555::n_bits |
Number of IO bits
Definition at line 493 of file GPIO_NXP.h.
const int PCA9555::n_ports |
Number of IO ports
Definition at line 496 of file GPIO_NXP.h.