OpenSourceSimWheelESP32
Open-source wireless steering wheel/button box for ESP32 boards
Loading...
Searching...
No Matches
SimWheel.hpp File Reference

Public API for firmware customization. More...

#include "InputSpecification.hpp"
#include <type_traits>

Go to the source code of this file.

Namespaces

namespace  inputs
 Everything related to hardware inputs and their events.
 
namespace  inputHub
 Everything related to the combined state of all inputs and their treatment.
 
namespace  inputHub::clutch
 Clutch operation.
 
namespace  inputHub::dpad
 Directional pad operation.
 
namespace  inputHub::altButtons
 ALT buttons operation.
 
namespace  inputHub::securityLock
 Security lock operation.
 
namespace  inputHub::neutralGear
 Neutral gear operation.
 
namespace  inputHub::codedSwitch
 Support for binary-coded switches attached to any input hardware.
 
namespace  inputMap
 Translates firmware-defined input numbers to user-defined input numbers.
 
namespace  hid
 Everything related to the HID protocol.
 
namespace  power
 Everything related to power management.
 
namespace  batteryMonitor
 Everything related to the measurement of available battery charge.
 
namespace  pixels
 Everything related to pixel control.
 
namespace  telemetry
 Holds received telemetry data.
 
namespace  ui
 Everything related to the user interface, if available.
 
namespace  firmware
 Firmware operation.
 

Functions

void inputs::addButton (InputGPIO pin, InputNumber inputNumber)
 Add a button attached to a single pin to the hardware inputs.
 
void inputs::addRotaryEncoder (InputGPIO clkPin, InputGPIO dtPin, InputNumber cwInputNumber, InputNumber ccwInputNumber, bool useAlternateEncoding=false)
 Add incremental rotary encoder inputs bound to specific input numbers.
 
void inputs::addButtonMatrix (const ButtonMatrix &matrix, bool negativeLogic=false)
 Add a button matrix to the hardware inputs.
 
void inputs::addAnalogMultiplexerGroup (OutputGPIO selectorPin1, OutputGPIO selectorPin2, OutputGPIO selectorPin3, const AnalogMultiplexerGroup< Mux8Pin > &chips)
 Add a group of 8-channel multiplexers to the hardware inputs.
 
void inputs::addAnalogMultiplexerGroup (OutputGPIO selectorPin1, OutputGPIO selectorPin2, OutputGPIO selectorPin3, OutputGPIO selectorPin4, const AnalogMultiplexerGroup< Mux16Pin > &chips)
 Add a group of 16-channel multiplexers to the hardware inputs.
 
void inputs::addAnalogMultiplexerGroup (OutputGPIO selectorPin1, OutputGPIO selectorPin2, OutputGPIO selectorPin3, OutputGPIO selectorPin4, OutputGPIO selectorPin5, const AnalogMultiplexerGroup< Mux32Pin > &chips)
 Add a group of 32-channel multiplexers to the hardware inputs.
 
void inputs::addMCP23017Expander (const MCP23017Expander &chip, uint8_t address, bool isFullAddress=false, I2CBus bus=I2CBus::PRIMARY)
 Add a MCP23017 GPIO expander to the hardware inputs.
 
void inputs::addPCF8574Expander (const PCF8574Expander &chip, uint8_t address, bool isFullAddress=false, I2CBus bus=I2CBus::PRIMARY)
 Add a PCF8574 GPIO expander to the hardware inputs.
 
void inputs::add74HC165NChain (OutputGPIO loadPin, OutputGPIO nextPin, InputGPIO inputPin, const ShiftRegisterChain &chain, InputNumber SER_inputNumber=UNSPECIFIED::VALUE, const bool negativeLogic=true)
 Add a chain of 74HC165N PISO shift registers to the hardware inputs.
 
void inputs::addRotaryCodedSwitch (const RotaryCodedSwitch &spec, InputGPIO pin0, InputGPIO pin1, InputGPIO pin2, bool complementaryCode=true)
 Add a binary coded rotary switch up to 8 positions.
 
void inputs::addRotaryCodedSwitch (const RotaryCodedSwitch &spec, InputGPIO pin0, InputGPIO pin1, InputGPIO pin2, InputGPIO pin3, bool complementaryCode=true)
 Add a binary coded rotary switch up to 16 positions.
 
void inputs::addRotaryCodedSwitch (const RotaryCodedSwitch &spec, InputGPIO pin0, InputGPIO pin1, InputGPIO pin2, InputGPIO pin3, InputGPIO pin4, bool complementaryCode=true)
 Add a binary coded rotary switch up to 32 positions.
 
void inputs::initializeI2C (GPIO sclPin, GPIO sdaPin, I2CBus bus=I2CBus::PRIMARY, bool enableInternalPullup=true)
 Initialize an I2C bus to certain pins.
 
void inputs::setAnalogClutchPaddles (ADC_GPIO leftClutchPin, ADC_GPIO rightClutchPin)
 Set two potentiometers as clutch paddles. Each one will work as an analog axis.
 
void inputHub::clutch::inputs (InputNumber leftInputNumber, InputNumber rightInputNumber)
 Select two input numbers for clutch operation.
 
void inputHub::clutch::bitePointInputs (InputNumber increase, InputNumber decrease)
 Set inputs for clutch calibration while one and only one clutch paddle is pressed.
 
void inputHub::clutch::cycleWorkingModeInputs (InputNumberCombination inputNumbers)
 Set a combination of inputs to cycle the working mode of clutch paddles. All inputs must be activated at the same time and none of the others.
 
void inputHub::clutch::cmdRecalibrateAxisInputs (InputNumberCombination inputNumbers)
 Set a combination of inputs to command a recalibration of the analog clutch paddles.
 
void inputHub::dpad::inputs (InputNumber padUpNumber, InputNumber padDownNumber, InputNumber padLeftNumber, InputNumber padRightNumber)
 Configure directional pad buttons.
 
void inputHub::dpad::cycleWorkingModeInputs (InputNumberCombination inputNumbers)
 Set a combination of inputs to cycle the working mode of the DPAD. All inputs must be activated at the same time and none of the others.
 
void inputHub::altButtons::inputs (InputNumberCombination inputNumbers)
 Set a list of input numbers as ALT buttons. Any of them will engage the alternate mode.
 
void inputHub::altButtons::cycleWorkingModeInputs (InputNumberCombination inputNumbers)
 Set a combination of inputs to cycle the working mode of ALT buttons. All inputs must be activated at the same time and none of the others.
 
void inputHub::securityLock::cycleWorkingModeInputs (InputNumberCombination inputNumbers)
 Set a combination of inputs to cycle the working mode of the security lock. All inputs must be activated at the same time and none of the others.
 
void inputHub::neutralGear::set (InputNumber neutral, InputNumberCombination combination={JOY_LSHIFT_PADDLE, JOY_RSHIFT_PADDLE})
 Set a "virtual" button for the neutral gear.
 
void inputHub::codedSwitch::add (InputNumber bit1, InputNumber bit2, InputNumber bit4, CodedSwitch8 spec)
 Add a binary-coded switch up to 8 positions.
 
void inputHub::codedSwitch::add (InputNumber bit1, InputNumber bit2, InputNumber bit4, InputNumber bit8, CodedSwitch16 spec)
 Add a binary-coded switch up to 16 positions.
 
void inputHub::codedSwitch::add (InputNumber bit1, InputNumber bit2, InputNumber bit4, InputNumber bit8, InputNumber bit16, CodedSwitch32 spec)
 Add a binary-coded switch up to 32 positions.
 
void inputMap::set (InputNumber firmware_defined, UserInputNumber user_defined, UserInputNumber user_defined_alt_engaged)
 Set a default mapping for an input number.
 
void inputMap::set (InputNumber firmware_defined, UserInputNumber user_defined_alt_engaged)
 Set a default mapping for an input number when alternate mode is engaged.
 
void inputMap::setOptimal ()
 Set an "optimal" default input map.
 
void hid::configure (std::string deviceName, std::string deviceManufacturer, bool enableAutoPowerOff=true, uint16_t vendorID=0, uint16_t productID=0)
 Initialize Bluetooth/USB device.
 
void hid::connectivity (Connectivity option)
 Choose a connectivity option.
 
void power::configureWakeUp (RTC_GPIO wakeUpPin)
 Initialize power management.
 
void power::configurePowerLatch (OutputGPIO latchPin, PowerLatchMode mode=PowerLatchMode::POWER_OPEN_DRAIN, uint32_t waitMs=5000)
 Configure an external latch circuit for power on and off.
 
void batteryMonitor::configure (ADC_GPIO battREADPin, OutputGPIO battENPin=UNSPECIFIED::VALUE)
 Monitor battery charge using a battery monitor circuit or a voltage divider.
 
void batteryMonitor::configure (I2CBus bus=I2CBus::PRIMARY, uint8_t i2c_address=0xFF)
 Monitor battery charge using a "fuel gauge".
 
void batteryMonitor::setPeriod (uint32_t seconds)
 Set time interval between measurements.
 
void batteryMonitor::setWarningSoC (uint8_t percentage)
 Set a battery level to warn to the user.
 
void batteryMonitor::setPowerOffSoC (uint8_t percentage)
 Set a battery level to shutdown the system.
 
void batteryMonitor::setExternalPowerWitness (InputGPIO sensePin)
 Set a GPIO pin to sense the power wire.
 
void batteryMonitor::setChargingWitness (InputGPIO sensePin, bool negativeLogic=true, bool enableInternalPullResistor=true)
 Set a GPIO pin to sense if the battery is being charged.
 
void pixels::configure (PixelGroup group, OutputGPIO dataPin, uint8_t pixelCount, bool useLevelShift, PixelDriver pixelType=PixelDriver::WS2812, PixelFormat pixelFormat=PixelFormat::AUTO, uint8_t globalBrightness=0xFF)
 Configure an LED strip for pixel control.
 
void ui::add (AbstractUserInterface *instance)
 Add a user interface instance.
 
template<typename UIClass , typename... _Args>
void ui::add (_Args... __args)
 Add an user interface class.
 
void ui::addPixelControlNotifications ()
 Add UI notifications using pixel control.
 
void firmware::run ()
 Run the custom firmware (non blocking)
 
void firmware::run (void(*func)())
 Run the custom firmware and show errors (non blocking)
 

Variables

TelemetryData telemetry::data
 Received telemetry data.
 

Detailed Description

Public API for firmware customization.

Author
Ángel Fernández Pineda. Madrid. Spain.
Date
2025-02-04

Definition in file SimWheel.hpp.