GPIO_NXP_Arduino 0.4.0
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, 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) |
Static Public Member Functions | |
static void | print_bin (uint8_t v) |
Public Attributes | |
const int | n_bits |
const int | n_ports |
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, |
const int | nbits, | ||
const uint8_t * | arp, | ||
uint8_t | ai | ||
) |
Constractor
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.
GPIO_base::GPIO_base | ( | TwoWire & | wire, |
uint8_t | i2c_address, | ||
const int | nbits, | ||
const uint8_t * | arp, | ||
uint8_t | ai | ||
) |
Constractor
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 |
Destractor
Definition at line 33 of file GPIO_NXP.cpp.
void GPIO_base::begin | ( | board | env = NONE | ) |
Device initialization
This method is not used current version
Definition at line 37 of file GPIO_NXP.cpp.
void GPIO_base::config | ( | int | port, |
uint8_t | config, | ||
uint8_t | mask = 0 |
||
) |
Config, single
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 |
Definition at line 80 of file GPIO_NXP.cpp.
Referenced by config().
void GPIO_base::config | ( | uint8_t * | vp | ) |
Config, all
Basic GPIO port access function for all port configuration
vp | Pointer to array of configuration values. The array should have 'n_ports' length |
Definition at line 88 of file GPIO_NXP.cpp.
uint8_t GPIO_base::input | ( | int | port | ) |
Input, single
Basic GPIO port access function for single port input
port | Port number |
Definition at line 68 of file GPIO_NXP.cpp.
uint8_t * GPIO_base::input | ( | uint8_t * | vp | ) |
Input, all
Basic GPIO port access function for all ports input
vp | Pointer to an array of values. The array should have 'n_ports' length |
Definition at line 73 of file GPIO_NXP.cpp.
void GPIO_base::output | ( | int | port, |
uint8_t | value, | ||
uint8_t | mask = 0 |
||
) |
Output, single
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 |
Definition at line 55 of file GPIO_NXP.cpp.
void GPIO_base::output | ( | uint8_t * | vp | ) |
Output, all
Basic GPIO port access function for all ports output
vp | Pointer to an array of values. The array should have 'n_ports' length |
Definition at line 63 of file GPIO_NXP.cpp.
|
static |
Definition at line 183 of file GPIO_NXP.cpp.
uint8_t GPIO_base::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 |
Definition at line 173 of file GPIO_NXP.cpp.
uint8_t * GPIO_base::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 |
Definition at line 125 of file GPIO_NXP.cpp.
Referenced by input().
uint16_t GPIO_base::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 |
Definition at line 178 of file GPIO_NXP.cpp.
uint16_t * GPIO_base::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 |
Definition at line 138 of file GPIO_NXP.cpp.
void GPIO_base::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 |
Definition at line 93 of file GPIO_NXP.cpp.
void GPIO_base::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 |
Definition at line 163 of file GPIO_NXP.cpp.
void GPIO_base::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 |
Definition at line 104 of file GPIO_NXP.cpp.
void GPIO_base::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 |
Definition at line 168 of file GPIO_NXP.cpp.
const int GPIO_base::n_bits |
Number of IO bits
Definition at line 53 of file GPIO_NXP.h.
Referenced by 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 read_port(), read_port16(), write_port(), and write_port16().