GPIO_NXP_Arduino 1.1.0
GPIO device operation sample code for Arduino
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Attributes | List of all members
GPIO_base Class Reference

#include <GPIO_NXP.h>

Inheritance diagram for GPIO_base:
GPIO_SPI PCA9554 PCA9555 PCAL6xxx_base PCAL97xx_base PCAL6408A PCAL6416A PCAL6524 PCAL6534 PCAL9722

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
 

Detailed Description

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.

Member Enumeration Documentation

◆ board

enum GPIO_base::board

Definition at line 47 of file GPIO_NXP.h.

Constructor & Destructor Documentation

◆ GPIO_base() [1/2]

GPIO_base::GPIO_base ( uint8_t i2c_address,
int nbits,
const uint8_t * arp,
uint8_t ai )

Constractor

Parameters
i2c_addressI2C target address
nbitsNumber of IO bits
arpPointer to register access reference table
aiAuto-increment flag

Definition at line 5 of file GPIO_NXP.cpp.

◆ GPIO_base() [2/2]

GPIO_base::GPIO_base ( TwoWire & wire,
uint8_t i2c_address,
int nbits,
const uint8_t * arp,
uint8_t ai )

Constractor

Parameters
wireTwoWire instance
i2c_addressI2C target address
nbitsNumber of IO bits
arpPointer to register access reference table
aiAuto-increment flag

Definition at line 15 of file GPIO_NXP.cpp.

◆ ~GPIO_base()

GPIO_base::~GPIO_base ( )
virtual

Destractor

Definition at line 33 of file GPIO_NXP.cpp.

Member Function Documentation

◆ begin()

void GPIO_base::begin ( board env = NONE)
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 devoce is used as it self, this method doesn't need to be called.

Parameters
envThis argument can be given as "GPIO_base::NONE" ot "GPIO_base::ARDUINO_SHIELD"

Definition at line 37 of file GPIO_NXP.cpp.

◆ config() [1/2]

void GPIO_base::config ( const uint8_t * vp)
virtual

Config, all ports

Basic GPIO port access function for all port configuration

Parameters
vpPointer 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.

◆ config() [2/2]

void GPIO_base::config ( int port,
uint8_t config,
uint8_t mask = 0 )
virtual

Config, single port

Basic GPIO port access function for single port configuration

Parameters
portPort number
valueValue to be written into configuration register
maskBit 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(), and PORT::config().

◆ input() [1/2]

uint8_t GPIO_base::input ( int port)
virtual

Input, single port

Basic GPIO port access function for single port input

Parameters
portPort number
Returns
Port read value

Reimplemented in PCA9554, PCA9555, PCAL6408A, PCAL6416A, PCAL6524, PCAL6534, and PCAL9722.

Definition at line 68 of file GPIO_NXP.cpp.

◆ input() [2/2]

uint8_t * GPIO_base::input ( uint8_t * vp)
virtual

Input, all ports

Basic GPIO port access function for all ports input

Parameters
vpPointer to an array of values. The array should have 'n_ports' length
Returns
Pointer to vp

Reimplemented in PCA9554, PCA9555, PCAL6408A, PCAL6416A, PCAL6524, PCAL6534, and PCAL9722.

Definition at line 73 of file GPIO_NXP.cpp.

◆ output() [1/2]

void GPIO_base::output ( const uint8_t * vp)
virtual

Output, all ports

Basic GPIO port access function for all ports output

Parameters
vpPointer 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 63 of file GPIO_NXP.cpp.

◆ output() [2/2]

void GPIO_base::output ( int port,
uint8_t value,
uint8_t mask = 0 )
virtual

Output, single port

Basic GPIO port access function for single port output

Parameters
portPort number
valueValue to be output
maskBit 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.

Referenced by PORT::operator=().

◆ print_bin()

void GPIO_base::print_bin ( uint8_t v)
static

Definition at line 188 of file GPIO_NXP.cpp.

◆ read_port() [1/2]

uint8_t GPIO_base::read_port ( access_word w,
int port_num = 0 )
virtual

Read single port method

Single port register access function using word of 'access_word'

Parameters
wAccsess word. This should be choosen from access_word'
port_numOption, to specify port number
Returns
Register read value

Reimplemented in PCA9554, PCA9555, PCAL6408A, PCAL6416A, PCAL6524, PCAL6534, and PCAL9722.

Definition at line 178 of file GPIO_NXP.cpp.

◆ read_port() [2/2]

uint8_t * GPIO_base::read_port ( access_word w,
uint8_t * vp )
virtual

Read all port method

All port register access function using word of 'access_word'

Parameters
wAccsess word. This should be choosen from access_word'
vpPointer to an array of values. The array should have 'n_ports' length
Returns
Pointer to vp

Reimplemented in PCA9554, PCA9555, PCAL6408A, PCAL6416A, PCAL6524, PCAL6534, and PCAL9722.

Definition at line 130 of file GPIO_NXP.cpp.

Referenced by input().

◆ read_port16() [1/2]

uint16_t GPIO_base::read_port16 ( access_word w,
int port_num = 0 )
virtual

Read single port method

Single port 16 bit register access function using word of 'access_word'

Parameters
wAccsess word. This should be choosen from access_word'
port_numOption, to specify port number
Returns
Register read value

Reimplemented in PCA9554, PCA9555, PCAL6408A, PCAL6416A, PCAL6524, PCAL6534, and PCAL9722.

Definition at line 183 of file GPIO_NXP.cpp.

◆ read_port16() [2/2]

uint16_t * GPIO_base::read_port16 ( access_word w,
uint16_t * vp )
virtual

Read all port method

All port 16 bit register access function using word of 'access_word'

Parameters
wAccsess word. This should be choosen from access_word'
vpPointer to an array of values. The array should have 'n_ports' length
Returns
Pointer to vp

Reimplemented in PCA9554, PCA9555, PCAL6408A, PCAL6416A, PCAL6524, PCAL6534, and PCAL9722.

Definition at line 143 of file GPIO_NXP.cpp.

◆ write_port() [1/2]

void GPIO_base::write_port ( access_word w,
const uint8_t * vp )
virtual

Write all port method

All port register access function using word of 'access_word'

Parameters
wAccsess word. This should be choosen from access_word'
vpPointer 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.

Referenced by config(), and output().

◆ write_port() [2/2]

void GPIO_base::write_port ( access_word w,
uint8_t value,
int port_num = 0 )
virtual

Write single port method

Single port register access function using word of 'access_word'

Parameters
wAccsess word. This should be choosen from access_word'
valueValue to be written into a register
port_numOption, to specify port number

Reimplemented in PCA9554, PCA9555, PCAL6408A, PCAL6416A, PCAL6524, PCAL6534, and PCAL9722.

Definition at line 168 of file GPIO_NXP.cpp.

◆ write_port16() [1/2]

void GPIO_base::write_port16 ( access_word w,
const uint16_t * vp )
virtual

Write all port method

All port 16 bit register access function using word of 'access_word'

Parameters
wAccsess word. This should be choosen from access_word'
vpPointer 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.

◆ write_port16() [2/2]

void GPIO_base::write_port16 ( access_word w,
uint16_t value,
int port_num = 0 )
virtual

Write single port method

Single port 16 bit register access function using word of 'access_word'

Parameters
wAccsess word. This should be choosen from access_word'
valueValue to be written into a register
port_numOption, to specify port number

Reimplemented in PCA9554, PCA9555, PCAL6408A, PCAL6416A, PCAL6524, PCAL6534, and PCAL9722.

Definition at line 173 of file GPIO_NXP.cpp.

Member Data Documentation

◆ auto_increment

const uint8_t GPIO_base::auto_increment
protected

Definition at line 226 of file GPIO_NXP.h.

◆ n_bits

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().

◆ n_ports

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().


The documentation for this class was generated from the following files: