Main Page | Modules | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

otPCA9505 Class Reference
[PCA9505 - 40-Bit I/O Expander with Serial Interface.PCA9505 - 40-Bit I/O Expander with Serial Interface.]

40-Bit I/O Expander with Serial Interface.

#include <otPCA9505.h>


Public Types

typedef otPCA9505::PortIndex PortIndex
enum  PortIndex {
  PORT_A, PORT_B, PORT_C, PORT_D,
  PORT_E
}

Public Member Functions

 otPCA9505 ()
void init (U8 addressIndex=0)
void setPortDir (U8 a, U8 b, U8 c, U8 d, U8 e)
void setPortDir (PortIndex pi, U8 dir)
void setPortDir (PortIndex pi, U8 bit, bool out)
void setPortPolarity (U8 a, U8 b, U8 c, U8 d, U8 e)
void setPortPolarity (PortIndex pi, U8 inv)
void setPortPolarity (PortIndex pi, U8 bit, bool invert)
void setPortInterrupt (U8 a, U8 b, U8 c, U8 d, U8 e)
void setPortInterrupt (PortIndex pi, U8 ena)
void setPortInterrupt (PortIndex pi, U8 bit, bool enable)
void writePort (U8 a, U8 b, U8 c, U8 d, U8 e)
void writePort (PortIndex pi, U8 val)
void setBit (PortIndex pi, U8 bit, bool set)
U8 readPort (PortIndex pi)
void readPort (U8 *port)
bool testBit (PortIndex pi, U8 bit)


Member Typedef Documentation

typedef otPCA9505::PortIndex otPCA9505.PortIndex
 


Member Enumeration Documentation

enum otPCA9505::PortIndex
 

Enumeration values:
PORT_A  Port A.
PORT_B  Port B.
PORT_C  Port C.
PORT_D  Port D.
PORT_E  Port E.


Constructor & Destructor Documentation

otPCA9505.otPCA9505  ) 
 

Create the class.


Member Function Documentation

void otPCA9505.init U8  addressIndex = 0  ) 
 

Init the port and set the base address

Parameters:
addressIndex Select which device is selected in the range 0:7

void otPCA9505.readPort U8 port  ) 
 

Read all ports

Parameters:
port Pointer to a byte array of 5 elements
Returns:
port[0] = PORT_A, ...

U8 otPCA9505.readPort PortIndex  pi  ) 
 

Read a port contents

Parameters:
pi Port index, see PortIndex.
Returns:
The port contents

void otPCA9505.setBit PortIndex  pi,
U8  bit,
bool  set
 

Set a bit of a specific port

Parameters:
pi Port index, see PortIndex.
bit Bit selection 7:0
set True to set, false to clear

void otPCA9505.setPortDir PortIndex  pi,
U8  bit,
bool  out
 

Set direction of a specific port and related bit, set TRUE for output or FALSE for input

Parameters:
pi Port index, see PortIndex.
bit Bit selection 7:0
out Set true for output, false for input

void otPCA9505.setPortDir PortIndex  pi,
U8  dir
 

Set direction of a specific port, , set each bit to 1 for output or 0 for input

Parameters:
pi Port index, see PortIndex.
dir Set each bit to 1 for output or 0 for input

void otPCA9505.setPortDir U8  a,
U8  b,
U8  c,
U8  d,
U8  e
 

Set direction of each of each port, set each bit to 1 for output or 0 for input

Parameters:
a Port A direction
b Port B direction
c Port C direction
d Port D direction
e Port E direction

void otPCA9505.setPortInterrupt PortIndex  pi,
U8  bit,
bool  enable
 

Set the interrupt mask of a specific port and related bit, set TRUE for interrupt enable or FALSE for mask

Parameters:
pi Port index, see PortIndex.
bit Bit selection 7:0
enable Set true to enable

void otPCA9505.setPortInterrupt PortIndex  pi,
U8  ena
 

Set the interrupt mask of a specific port, set each bit to 1 for interrupt enable or 0 for mask

Parameters:
pi Port index, see PortIndex.
ena Set true for enable, false for mask

void otPCA9505.setPortInterrupt U8  a,
U8  b,
U8  c,
U8  d,
U8  e
 

Set the interrupt mask of each port, set each bit to 1 for interrupt enable or 0 for mask

Parameters:
a Port A interrupt mask
b Port B interrupt mask
c Port C interrupt mask
d Port D interrupt mask
e Port E interrupt mask

void otPCA9505.setPortPolarity PortIndex  pi,
U8  bit,
bool  invert
 

Set polarity of a specific port and related bit, set TRUE for invert or FALSE for not invert

Parameters:
pi Port index, see PortIndex.
bit Bit selection 7:0
invert Set true for invert, false for not invert

void otPCA9505.setPortPolarity PortIndex  pi,
U8  inv
 

Set polarity of a specific port, set each bit to 1 for invert or 0 for not invert

Parameters:
pi Port index, see PortIndex.
inv Set each bit to 1 for invert or 0 for not

void otPCA9505.setPortPolarity U8  a,
U8  b,
U8  c,
U8  d,
U8  e
 

Set polarity of each of each port, set each bit to 1 for invert or 0 for not invert

Parameters:
a Port A polarity
b Port B polarity
c Port C polarity
d Port D polarity
e Port E polarity

bool otPCA9505.testBit PortIndex  pi,
U8  bit
 

Test a bit of a specific port

Parameters:
pi Port index, see PortIndex.
bit Bit selection 7:0
Returns:
True if a specific bit is set or false if not

void otPCA9505.writePort PortIndex  pi,
U8  val
 

Write a specific port

Parameters:
pi Port index, see PortIndex.
val Data to be write

void otPCA9505.writePort U8  a,
U8  b,
U8  c,
U8  d,
U8  e
 

Write on all ports

Parameters:
a Port A
b Port B
c Port C
d Port D
e Port E


The documentation for this class was generated from the following file: footer
otStudio - Library Reference - (C) 2020-23 Officina Turini, All Rights Reserved
Document built with Doxygen 1.4.0