Adafruit PCF8574 Arduino Library
Public Member Functions | List of all members
Adafruit_PCF8575 Class Reference

Class that stores state and functions for interacting with the PCF8575 I2C Expander. More...

#include <Adafruit_PCF8575.h>

Public Member Functions

 Adafruit_PCF8575 ()
 Instantiates a new PCF8575 class.
 
bool begin (uint8_t i2c_addr=PCF8575_I2CADDR_DEFAULT, TwoWire *wire=&Wire)
 Sets up the hardware and initializes I2C. More...
 
bool digitalWriteWord (uint16_t d)
 Write one 'word' of data directly to the GPIO control register. More...
 
bool digitalWrite (uint8_t pinnum, bool val)
 Set one GPIO expander pin to 'high' (weak pullup) or 'low' (grounded) More...
 
uint16_t digitalReadWord (void)
 Read one 'word' of data directly from the GPIO control register. More...
 
bool digitalRead (uint8_t pinnum)
 Get a GPIO expander pin value. More...
 
bool pinMode (uint8_t pinnum, uint8_t val)
 Set one GPIO expander pin to 'output' (grounded) or 'input' (weak pullup) More...
 

Detailed Description

Class that stores state and functions for interacting with the PCF8575 I2C Expander.

Member Function Documentation

◆ begin()

bool Adafruit_PCF8575::begin ( uint8_t  i2c_address = PCF8575_I2CADDR_DEFAULT,
TwoWire *  wire = &Wire 
)

Sets up the hardware and initializes I2C.

Parameters
i2c_addressThe I2C address to be used.
wireThe Wire object to be used for I2C connections.
Returns
True if initialization was successful, otherwise false.

◆ digitalWriteWord()

bool Adafruit_PCF8575::digitalWriteWord ( uint16_t  d)

Write one 'word' of data directly to the GPIO control register.

Parameters
dThe data to write
Returns
True if we were able to write the data successfully over I2C

◆ digitalWrite()

bool Adafruit_PCF8575::digitalWrite ( uint8_t  pinnum,
bool  val 
)

Set one GPIO expander pin to 'high' (weak pullup) or 'low' (grounded)

Parameters
pinnumThe GPIO pin number, from 0 to 7 inclusive
valThe boolean value to write: true means activate the pullup and false means turn on the sinking transistor.
Returns
True if we were able to write the data successfully over I2C

◆ digitalReadWord()

uint16_t Adafruit_PCF8575::digitalReadWord ( void  )

Read one 'word' of data directly from the GPIO control register.

Returns
The byte of data read from the device

◆ digitalRead()

bool Adafruit_PCF8575::digitalRead ( uint8_t  pinnum)

Get a GPIO expander pin value.

Parameters
pinnumThe GPIO pin number, from 0 to 7 inclusive
Returns
True if the pin logic is NOT ground, false if the pin logic is ground

◆ pinMode()

bool Adafruit_PCF8575::pinMode ( uint8_t  pinnum,
uint8_t  val 
)

Set one GPIO expander pin to 'output' (grounded) or 'input' (weak pullup)

Parameters
pinnumThe GPIO pin number, from 0 to 15 inclusive
valThe value to write: INPUT or INPUT_PULLUP means activate the pullup and OUTPUT means turn on the sinking transistor, as this is an open drain device
Returns
True if we were able to write the data successfully over I2C

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