Noiasca Tool Kit
Several helper functions and classes to make life with Arduino easier
Public Member Functions | List of all members
PCF8574expander Class Reference

PCF8574 Expander Hardware class. More...

#include <Noiasca_PCF8574.h>

Public Member Functions

 PCF8574expander (uint8_t i2cAddr)
 
 PCF8574expander (TwoWire &i2cPort, uint8_t i2cAddr)
 
void digitalWrite (uint8_t pin, uint8_t val)
 write to a pin More...
 
uint8_t getPinStatus ()
 read pin status More...
 
void setPinStatus (uint8_t _pinStatus)
 set pin status More...
 

Detailed Description

PCF8574 Expander Hardware class.

Takes Wire and I2C address and administrates the port. This connects the low level hardware. The class is needed becauses each pin on the PCF8574 should be treated seperately but the IC accepts only one byte for all 8 hardware pins

Constructor & Destructor Documentation

◆ PCF8574expander() [1/2]

PCF8574expander::PCF8574expander ( uint8_t  i2cAddr)
inline
Parameters
i2cAddrthe I2C address (0x20 - 0x27 or 0x38 - 0x3F)

◆ PCF8574expander() [2/2]

PCF8574expander::PCF8574expander ( TwoWire &  i2cPort,
uint8_t  i2cAddr 
)
inline
Parameters
i2cAddrthe I2C address (0x20 - 0x27 or 0x38 - 0x3F)
i2cPortuse Wire or any other TwoWire (I2C) interface you have available on your microcontroller

Member Function Documentation

◆ digitalWrite()

void PCF8574expander::digitalWrite ( uint8_t  pin,
uint8_t  val 
)
inline

write to a pin

set or unset an output pin.

Parameters
pinthe pin to write
valthe value LOW or HIGH

◆ getPinStatus()

uint8_t PCF8574expander::getPinStatus ( )
inline

read pin status

Returns
the value of the internal pin status

◆ setPinStatus()

void PCF8574expander::setPinStatus ( uint8_t  _pinStatus)
inline

set pin status

This function only sets the internal variable - doesn't change pins

Parameters
_pinStatusthe new value for the pin status