OpenSourceSimWheelESP32
Open-source wireless steering wheel/button box for ESP32 boards
Loading...
Searching...
No Matches
PCF8574LedDriver Class Reference

8-LED driver based on the PCF8574 GPIO expander More...

#include <OutputHardware.hpp>

Public Member Functions

 PCF8574LedDriver (I2CBus bus, uint8_t address7bits)
 Construct a LED driver.
 
void setLed (uint8_t index, bool state)
 Set the state of a single LED.
 
void shiftLeft ()
 Shift all lights to the left.
 
void shiftRight ()
 Shift all lights to the right.
 
void swap ()
 Invert the state of all LEDs.
 
void show () const
 Show the required LEDs all at once.
 
uint8_t getState () const
 Get the state of each LED.
 
void setState (uint8_t state)
 Set the state of each LED all at once.
 

Detailed Description

8-LED driver based on the PCF8574 GPIO expander

Note
For single-color LEDs. P0 is the left-most LED. P7 is the right-most LED.

Definition at line 194 of file OutputHardware.hpp.

Constructor & Destructor Documentation

◆ PCF8574LedDriver()

PCF8574LedDriver::PCF8574LedDriver ( I2CBus bus,
uint8_t address7bits )

Construct a LED driver.

Parameters
busI2C bus where the chip is attached to.
address7bitsFull I2C address in 7-bit format.

◆ ~PCF8574LedDriver()

PCF8574LedDriver::~PCF8574LedDriver ( )
inline

Definition at line 264 of file OutputHardware.hpp.

Member Function Documentation

◆ getState()

uint8_t PCF8574LedDriver::getState ( ) const
inline

Get the state of each LED.

Returns
uint8_t A bitmap. 1 means turn on. 0 means turn off.

Definition at line 253 of file OutputHardware.hpp.

◆ setLed()

void PCF8574LedDriver::setLed ( uint8_t index,
bool state )

Set the state of a single LED.

Note
Not displayed immediately
Parameters
indexLED index in the range [0,7]. P0 has index 0.
stateTrue to turn on, false to turn off.

◆ setState()

void PCF8574LedDriver::setState ( uint8_t state)
inline

Set the state of each LED all at once.

Note
Not displayed immediately
Parameters
stateA bitmap. 1 means turn on. 0 means turn off.

Definition at line 262 of file OutputHardware.hpp.

◆ shiftLeft()

void PCF8574LedDriver::shiftLeft ( )

Shift all lights to the left.

Note
Not displayed immediately. P0 is the left-most LED.

◆ shiftRight()

void PCF8574LedDriver::shiftRight ( )

Shift all lights to the right.

Note
Not displayed immediately. P0 is the left-most LED.

◆ swap()

void PCF8574LedDriver::swap ( )
inline

Invert the state of all LEDs.

Note
Not displayed immediately

Definition at line 240 of file OutputHardware.hpp.


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