GPIO_NXP_Arduino 0.4.3
GPIO device operation sample code for Arduino
|
#include <GPIO_NXP.h>
Public Types | |
enum | reg_num { Input_Port_0 , Input_Port_1 , Input_Port_2 , Input_Port_3 , Input_Port_4 , Output_Port_0 , Output_Port_1 , Output_Port_2 , Output_Port_3 , Output_Port_4 , Polarity_Inversion_port_0 , Polarity_Inversion_port_1 , Polarity_Inversion_port_2 , Polarity_Inversion_port_3 , Polarity_Inversion_port_4 , Configuration_port_0 , Configuration_port_1 , Configuration_port_2 , Configuration_port_3 , Configuration_port_4 , Output_drive_strength_register_port_0A = 0x30 , Output_drive_strength_register_port_0B , Output_drive_strength_register_port_1A , Output_drive_strength_register_port_1B , Output_drive_strength_register_port_2A , Output_drive_strength_register_port_2B , Output_drive_strength_register_port_3A , Output_drive_strength_register_port_3B , Output_drive_strength_register_port_4A , reserved0 , Input_latch_register_port_0 , Input_latch_register_port_1 , Input_latch_register_port_2 , Input_latch_register_port_3 , Input_latch_register_port_4 , Pull_up_pull_down_enable_register_port_0 , Pull_up_pull_down_enable_register_port_1 , Pull_up_pull_down_enable_register_port_2 , Pull_up_pull_down_enable_register_port_3 , Pull_up_pull_down_enable_register_port_4 , Pull_up_pull_down_selection_register_port_0 , Pull_up_pull_down_selection_register_port_1 , Pull_up_pull_down_selection_register_port_2 , Pull_up_pull_down_selection_register_port_3 , Pull_up_pull_down_selection_register_port_4 , Interrupt_mask_register_port_0 , Interrupt_mask_register_port_1 , Interrupt_mask_register_port_2 , Interrupt_mask_register_port_3 , Interrupt_mask_register_port_4 , Interrupt_status_register_port_0 , Interrupt_status_register_port_1 , Interrupt_status_register_port_2 , Interrupt_status_register_port_3 , Interrupt_status_register_port_4 , Output_port_configuration_register , Interrupt_edge_register_port_0A , Interrupt_edge_register_port_0B , Interrupt_edge_register_port_1A , Interrupt_edge_register_port_1B , Interrupt_edge_register_port_2A , Interrupt_edge_register_port_2B , Interrupt_edge_register_port_3A , Interrupt_edge_register_port_3B , Interrupt_edge_register_port_4A , reserved1 , Interrupt_clear_register_port_0 , Interrupt_clear_register_port_1 , Interrupt_clear_register_port_2 , Interrupt_clear_register_port_3 , Interrupt_clear_register_port_4 , Input_status_port_0 , Input_status_port_1 , Input_status_port_2 , Input_status_port_3 , Input_status_port_4 , Individual_pin_output_port_0_configuration_register , Individual_pin_output_port_1_configuration_register , Individual_pin_output_port_2_configuration_register , Individual_pin_output_port_3_configuration_register , Individual_pin_output_port_4_configuration_register , Switch_debounce_enable_0 , Switch_debounce_enable_1 , Switch_debounce_count } |
enum | board { NONE , ARDUINO_SHIELD } |
![]() | |
enum | board { NONE , ARDUINO_SHIELD } |
Public Member Functions | |
PCAL6534 (uint8_t i2c_address=(0x44 > > 1)+0) | |
PCAL6534 (TwoWire &wire, uint8_t i2c_address=(0x44 > > 1)+0) | |
virtual | ~PCAL6534 () |
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) |
bool | ping (void) |
int | reg_w (uint8_t reg_adr, 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) |
![]() | |
PCAL6xxx_base (uint8_t i2c_address, const int nbits, const uint8_t arp[], uint8_t ai) | |
PCAL6xxx_base (TwoWire &wire, uint8_t i2c_address, const int nbits, const uint8_t arp[], uint8_t ai) | |
![]() | |
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) |
PCAL6534 class
Definition at line 1721 of file GPIO_NXP.h.
enum PCAL6534::board |
Constants for begin() method
Definition at line 1785 of file GPIO_NXP.h.
enum PCAL6534::reg_num |
Name of the PCAL6534 registers
Definition at line 1725 of file GPIO_NXP.h.
PCAL6534::PCAL6534 | ( | uint8_t | i2c_address = (0x44 >> 1) + 0 | ) |
PCAL6534::PCAL6534 | ( | TwoWire & | wire, |
uint8_t | i2c_address = (0x44 >> 1) + 0 |
||
) |
Constractor
wire | TwoWire instance |
i2c_address | I2C target address |
Definition at line 310 of file GPIO_NXP.cpp.
|
virtual |
Destractor
Definition at line 315 of file GPIO_NXP.cpp.
void PCAL6534::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 "PCAL6534::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 "PCAL6534::NONE" ot "PCAL6534::ARDUINO_SHIELD" |
void PCAL6534::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 |
void PCAL6534::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 PCAL6534::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 PCAL6534::input | ( | int | port | ) |
Input, single port
Basic GPIO port access function for single port input
port | Port number |
uint8_t * PCAL6534::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 PCAL6534::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 PCAL6534::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 |
bool PCAL6534::ping | ( | void | ) |
Ping the device
uint8_t PCAL6534::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 * PCAL6534::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 PCAL6534::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 * PCAL6534::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 |
uint16_t PCAL6534::read_r16 | ( | uint8_t | reg | ) |
Register read, 16 bit
This 16 bit access may ot be common but it's useful for sensor devices
reg | register index/address/pointer |
uint8_t PCAL6534::read_r8 | ( | uint8_t | reg | ) |
Register read, 8 bit
reg | register index/address/pointer |
uint8_t PCAL6534::reg_r | ( | uint8_t | reg_adr | ) |
Single register read
reg | register index/address/pointer |
int PCAL6534::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 PCAL6534::reg_w | ( | uint8_t | reg_adr, |
uint8_t * | data, | ||
uint16_t | size | ||
) |
Multiple register write
reg | register index/address/pointer |
data | pointer to data buffer |
size | data size |
int PCAL6534::reg_w | ( | uint8_t | reg_adr, |
uint8_t | data | ||
) |
Single register write
reg | register index/address/pointer |
data | pointer to data buffer |
size | data size |
void PCAL6534::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 PCAL6534::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 PCAL6534::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 PCAL6534::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 |
void PCAL6534::write_r16 | ( | uint8_t | reg, |
uint16_t | val | ||
) |
Register write, 16 bit
This 16 bit access may ot be common but it's useful for sensor devices
reg | register index/address/pointer |
val | data value |
void PCAL6534::write_r8 | ( | uint8_t | reg, |
uint8_t | val | ||
) |
Register write, 8 bit
reg | register index/address/pointer |
val | data value |
|
staticconstexpr |
Definition at line 1769 of file GPIO_NXP.h.
const int PCAL6534::n_bits |
Number of IO bits
Definition at line 1791 of file GPIO_NXP.h.
const int PCAL6534::n_ports |
Number of IO ports
Definition at line 1794 of file GPIO_NXP.h.