PCA9555

Dependents:   Telliskivi2_2014 PowerManagementBoard_Rev_A_2017

Embed: (wiki syntax)

« Back to documentation index

PCA9555 Class Reference

PCA9555 Class Reference

Interface to the PCA9555 I2C 16 Bit IO expander. More...

#include <PCA9555.h>

Public Member Functions

 PCA9555 (PinName sda, PinName scl, PinName interrupPin, int address)
 Create an instance of the PCA9555 connected to specfied I2C pins, with the specified address.
int read ()
 Read the IO pin levels.
void write (int data)
 Write to the IO pins.
void setPin (unsigned int pinNumber)
 Set one pin.
void clearPin (unsigned int pinNumber)
 Clear one pin.
void togglePin (unsigned int pinNumber)
 Toggle one pin.
bool getPin (unsigned int pinNumber)
 Get state of pin.
void setDirection (int data)
 Set direction of pin.

Detailed Description

Interface to the PCA9555 I2C 16 Bit IO expander.

Definition at line 7 of file PCA9555.h.


Constructor & Destructor Documentation

PCA9555 ( PinName  sda,
PinName  scl,
PinName  interrupPin,
int  address 
)

Create an instance of the PCA9555 connected to specfied I2C pins, with the specified address.

Parameters:
sdaThe I2C data pin
sclThe I2C clock pin
interruptPinThe pin connected to PCA9555 interrupt
addressThe I2C address for this PCA9555

Definition at line 3 of file PCA9555.cpp.


Member Function Documentation

void clearPin ( unsigned int  pinNumber )

Clear one pin.

Parameters:
pinNumberThe number of pin to clear

Definition at line 72 of file PCA9555.cpp.

bool getPin ( unsigned int  pinNumber )

Get state of pin.

Parameters:
pinNumberThe number of pin

Definition at line 86 of file PCA9555.cpp.

int read (  )

Read the IO pin levels.

Returns:
The two bytes read

Definition at line 23 of file PCA9555.cpp.

void setDirection ( int  data )

Set direction of pin.

Parameters:
pinNumberThe number of pin to set

Definition at line 13 of file PCA9555.cpp.

void setPin ( unsigned int  pinNumber )

Set one pin.

Parameters:
pinNumberThe number of pin to set

Definition at line 67 of file PCA9555.cpp.

void togglePin ( unsigned int  pinNumber )

Toggle one pin.

Parameters:
pinNumberThe number of pin to toggle

Definition at line 77 of file PCA9555.cpp.

void write ( int  data )

Write to the IO pins.

Parameters:
dataThe 16 bits to write to the IO port

Definition at line 52 of file PCA9555.cpp.