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

#include <GPIO_NXP.h>

Inheritance diagram for PCAL6408A:
PCAL6xxx_base GPIO_base

Public Types

enum  reg_num {
  Input_Port , Output_Port , Polarity_Inversion , Configuration ,
  Output_drive_strength_0 = 0x40 , Output_drive_strength_1 , Input_latch , Pull_up_pull_down_enable ,
  Pull_up_pull_down_selection , Interrupt_mask , Interrupt_status , Output_port_configuration
}
 
enum  board { NONE , ARDUINO_SHIELD }
 
- Public Types inherited from GPIO_base
enum  board { NONE , ARDUINO_SHIELD }
 

Public Member Functions

 PCAL6408A (uint8_t i2c_address=(0x40 > > 1)+0)
 
 PCAL6408A (TwoWire &wire, uint8_t i2c_address=(0x40 > > 1)+0)
 
virtual ~PCAL6408A ()
 
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 Member Functions inherited from PCAL6xxx_base
 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)
 
- Public Member Functions inherited from GPIO_base
 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
 
- 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)
 

Detailed Description

PCAL6408A class

Definition at line 663 of file GPIO_NXP.h.

Member Enumeration Documentation

◆ board

Constants for begin() method

Definition at line 714 of file GPIO_NXP.h.

◆ reg_num

Name of the PCAL6408A registers

Definition at line 667 of file GPIO_NXP.h.

Constructor & Destructor Documentation

◆ PCAL6408A() [1/2]

PCAL6408A::PCAL6408A ( uint8_t  i2c_address = (0x40 >> 1) + 0)

Constractor

Parameters
i2c_addressI2C target address

Definition at line 248 of file GPIO_NXP.cpp.

◆ PCAL6408A() [2/2]

PCAL6408A::PCAL6408A ( TwoWire &  wire,
uint8_t  i2c_address = (0x40 >> 1) + 0 
)

Constractor

Parameters
wireTwoWire instance
i2c_addressI2C target address

Definition at line 253 of file GPIO_NXP.cpp.

◆ ~PCAL6408A()

PCAL6408A::~PCAL6408A ( )
virtual

Destractor

Definition at line 258 of file GPIO_NXP.cpp.

Member Function Documentation

◆ begin()

void PCAL6408A::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 "PCAL6408A::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 "PCAL6408A::NONE" ot "PCAL6408A::ARDUINO_SHIELD"

◆ config() [1/2]

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

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

◆ config() [2/2]

void PCAL6408A::config ( uint8_t *  vp)

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

◆ input() [1/2]

uint8_t PCAL6408A::input ( int  port)

Input, single port

Basic GPIO port access function for single port input

Parameters
portPort number
Returns
Port read value

◆ input() [2/2]

uint8_t * PCAL6408A::input ( uint8_t *  vp)

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

◆ output() [1/2]

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

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

◆ output() [2/2]

void PCAL6408A::output ( uint8_t *  vp)

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

◆ read_port() [1/2]

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

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

◆ read_port() [2/2]

uint8_t * PCAL6408A::read_port ( access_word  w,
uint8_t *  vp 
)

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

◆ read_port16() [1/2]

uint16_t PCAL6408A::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'

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

◆ read_port16() [2/2]

uint16_t * PCAL6408A::read_port16 ( access_word  w,
uint16_t *  vp 
)

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

◆ write_port() [1/2]

void PCAL6408A::write_port ( access_word  w,
uint8_t *  vp 
)

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

◆ write_port() [2/2]

void PCAL6408A::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'

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

◆ write_port16() [1/2]

void PCAL6408A::write_port16 ( access_word  w,
uint16_t *  vp 
)

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

◆ write_port16() [2/2]

void PCAL6408A::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'

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

Member Data Documentation

◆ access_ref

constexpr uint8_t PCAL6408A::access_ref
staticconstexpr
Initial value:
= {
Input_Port,
Output_Port,
Polarity_Inversion,
Configuration,
Output_drive_strength_0,
Input_latch,
Pull_up_pull_down_enable,
Pull_up_pull_down_selection,
Interrupt_mask,
Interrupt_status,
Output_port_configuration,
}

Definition at line 698 of file GPIO_NXP.h.

◆ n_bits

const int PCAL6408A::n_bits

Number of IO bits

Definition at line 720 of file GPIO_NXP.h.

◆ n_ports

const int PCAL6408A::n_ports

Number of IO ports

Definition at line 723 of file GPIO_NXP.h.


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