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

Use eight single-color LEDS as "rev lights". More...

#include <SimWheelUI.hpp>

Public Member Functions

 PCF8574RevLights (uint8_t hardwareAddress, I2CBus bus=I2CBus::SECONDARY, uint8_t factoryAddress=0b0100000, RevLightsMode displayMode=RevLightsMode::LEFT_TO_RIGHT)
 Create "rev lights" using PCF8574 and single-color LEDs.
 
virtual void onStart () override
 Called just once after initialization.
 
virtual void onConnected () override
 Notify device is connected.
 
virtual void onTelemetryData (const TelemetryData *pTelemetryData) override
 Notify new telemetry data.
 
virtual void serveSingleFrame (uint32_t elapsedMs) override
 Draw a single frame.
 
virtual void onBitePoint (uint8_t bitePoint) override
 Notify a change in the current bite point.
 
virtual void onLowBattery () override
 Notify low battery.
 
virtual void onSaveSettings () override
 Notify that user settings have been saved to flash memory.
 
virtual void shutdown () override
 Cut power to the UI hardware.
 
virtual uint8_t getMaxFPS () override
 Get the maximum FPS supported by the underlying hardware.
 
virtual uint16_t getStackSize () override
 Get the stack size required by this user interface.
 
- Public Member Functions inherited from AbstractUserInterface
 AbstractUserInterface (const AbstractUserInterface &)=delete
 
AbstractUserInterfaceoperator= (const AbstractUserInterface &)=delete
 
virtual void onBLEdiscovering ()
 Notify device is in discovery mode.
 

Additional Inherited Members

- Public Attributes inherited from AbstractUserInterface
bool requiresPowertrainTelemetry = false
 Set to true to receive and use powertrain telemetry data.
 
bool requiresECUTelemetry = false
 Set to true to receive and use ECU telemetry data.
 
bool requiresRaceControlTelemetry = false
 Set to true to receive and use race control telemetry data.
 
bool requiresGaugeTelemetry = false
 Set to true to receive and use telemetry data for gauges.
 
- Protected Member Functions inherited from AbstractUserInterface
uint32_t frameTimer (uint32_t &timerVariable, uint32_t elapsedTimeMs, uint32_t timeLimitMs)
 Simple timer.
 

Detailed Description

Use eight single-color LEDS as "rev lights".

Definition at line 82 of file SimWheelUI.hpp.

Constructor & Destructor Documentation

◆ PCF8574RevLights()

PCF8574RevLights::PCF8574RevLights ( uint8_t hardwareAddress,
I2CBus bus = I2CBus::SECONDARY,
uint8_t factoryAddress = 0b0100000,
RevLightsMode displayMode = RevLightsMode::LEFT_TO_RIGHT )

Create "rev lights" using PCF8574 and single-color LEDs.

Parameters
hardwareAddressAn I2C hardware address (3 bits), as configured using pins A0, A1 and A2.
busI2C bus.
factoryAddressFixed factory-defined part of the full I2C address (7 bits).
displayModeDisplay mode.

Member Function Documentation

◆ getMaxFPS()

virtual uint8_t PCF8574RevLights::getMaxFPS ( )
inlineoverridevirtual

Get the maximum FPS supported by the underlying hardware.

Note
You must override this method to receive telemetry data
Returns
uint8_t Frames per second.

Reimplemented from AbstractUserInterface.

Definition at line 110 of file SimWheelUI.hpp.

◆ getStackSize()

virtual uint16_t PCF8574RevLights::getStackSize ( )
inlineoverridevirtual

Get the stack size required by this user interface.

Warning
You should override this method if you get "stack canary" or "dual exception" errors.
Returns
uin16_t Stack size in bytes for the notification/frameserver daemon. Return zero to use a default value. Increase the stack size if you get "stack canary" or "dual exception" errors and reboots.

Reimplemented from AbstractUserInterface.

Definition at line 111 of file SimWheelUI.hpp.

◆ onBitePoint()

virtual void PCF8574RevLights::onBitePoint ( uint8_t bitePoint)
overridevirtual

Notify a change in the current bite point.

Parameters
bitePointLast known bite point.

Reimplemented from AbstractUserInterface.

◆ onConnected()

virtual void PCF8574RevLights::onConnected ( )
overridevirtual

Notify device is connected.

Reimplemented from AbstractUserInterface.

◆ onLowBattery()

virtual void PCF8574RevLights::onLowBattery ( )
overridevirtual

Notify low battery.

Note
Called at timed intervals while the low battery condition persists.

Reimplemented from AbstractUserInterface.

◆ onSaveSettings()

virtual void PCF8574RevLights::onSaveSettings ( )
overridevirtual

Notify that user settings have been saved to flash memory.

Reimplemented from AbstractUserInterface.

◆ onStart()

virtual void PCF8574RevLights::onStart ( )
overridevirtual

Called just once after initialization.

Reimplemented from AbstractUserInterface.

◆ onTelemetryData()

virtual void PCF8574RevLights::onTelemetryData ( const TelemetryData * pTelemetryData)
overridevirtual

Notify new telemetry data.

Parameters
pTelemetryDataPointer to telemetry data. Can be null. Safe to store for later use.
Note
For this method to get called, user code must meet the following requirements:
  • getMaxFPS must return non-zero.
  • At instance creation, one of the requiresXXXTelemetry attributes must be set to true.
Always called just before serveSingleFrame(). This method may draw a display frame into a buffer, while serveSingleFrame() just displays that frame buffer.
pTelemetryData is null when no telemetry data has been received in the previous two seconds. May be used to turn the display off.
Must not enter an infinite loop. Must return as soon as possible.

Reimplemented from AbstractUserInterface.

◆ serveSingleFrame()

virtual void PCF8574RevLights::serveSingleFrame ( uint32_t elapsedMs)
overridevirtual

Draw a single frame.

Parameters
elapsedMsElapsed milliseconds since last call.
Note
Called at timed intervals when no notifications are pending. Do not assume perfect timing.
Must not enter an infinite loop. Must return as soon as possible.

Reimplemented from AbstractUserInterface.

◆ shutdown()

virtual void PCF8574RevLights::shutdown ( )
overridevirtual

Cut power to the UI hardware.

Note
This is a command, not a notification. Not reversible.

Reimplemented from AbstractUserInterface.


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