![]() |
OpenSourceSimWheelESP32
Open-source wireless steering wheel/button box for ESP32 boards
|
Types and constants used everywhere for firmware implementation. More...
#include <cstdint>#include <cassert>#include <array>#include <vector>#include <stdexcept>#include <semaphore>#include <chrono>#include <optional>#include "esp_task_wdt.h"Go to the source code of this file.
Classes | |
| struct | FakeInput |
| Fake input specification used for testing. More... | |
| struct | DeviceCapabilities |
| Set of device capabilities. More... | |
| class | BitQueue |
| Queue for 61 bits. More... | |
| struct | DecouplingEvent |
| Decoupling event. More... | |
| struct | BatteryStatus |
| Battery status. More... | |
| struct | BatteryStatusChrData |
| Data format for the Battery Level Status characteristic (packed) More... | |
| struct | InternalEvent< eventType, _Args > |
| Subscribable events. More... | |
| struct | InternalEvent< eventType, void > |
| Subscribable events requiring void handlers. More... | |
Macros | |
| #define | PRIVATE private |
| For tesing. | |
| #define | PROTECTED protected |
| For tesing. | |
| #define | BITMASK(count, first) |
Return a mask for a number of consecutive buttons (count) starting from first. A mask is a bit array where each bit determines if a button is to be used or not. 1 means not used. 0 means in use. Masks are required to combine the state from multiple input bitmaps. For example, BITMASK(2,2) returns 0b(...)11110011 which means that buttons numbered 2 and 3 are in use. | |
| #define | NBITMASK(count, first) |
| Return the logical negation of a bit mask. | |
| #define | CLUTCH_NONE_VALUE 0 |
| Value for a fully released clutch. | |
| #define | CLUTCH_FULL_VALUE 254 |
| Value for a fully engaged clutch. | |
| #define | CLUTCH_DEFAULT_VALUE 127 |
| Default bite point value. | |
| #define | CLUTCH_1_4_VALUE 64 |
| Value for 1/4 engaged clutch. | |
| #define | CLUTCH_3_4_VALUE 192 |
| Value for 3/4 engaged clutch. | |
| #define | CLUTCH_INVALID_VALUE 255 |
| Invalid clutch value used for masking. | |
| #define | INPUT_TASK_PRIORITY (tskIDLE_PRIORITY + 2) |
| Priority of background tasks. | |
| #define | MAX_DECOUPLING_EVENT_COUNT 64 |
| Queue size for decoupling events. | |
| #define | AUTO_POWER_OFF_DELAY_SECS 60 |
| Time to wait for connection before power off (in seconds) | |
Enumerations | |
| enum class | DeviceCapability : uint8_t { CLUTCH_BUTTON = 0 , CLUTCH_ANALOG = 1 , ALT = 2 , DPAD = 3 , BATTERY = 4 , BATTERY_CALIBRATION_AVAILABLE = 5 , TELEMETRY_POWERTRAIN = 6 , TELEMETRY_ECU = 7 , TELEMETRY_RACE_CONTROL = 8 , TELEMETRY_GAUGES = 9 , ROTARY_ENCODERS = 10 , _MAX_VALUE = ROTARY_ENCODERS } |
| Enumeration of device capabilities. More... | |
| enum class | ClutchWorkingMode : uint8_t { CLUTCH = 0 , AXIS , ALT , BUTTON , LAUNCH_CONTROL_MASTER_LEFT , LAUNCH_CONTROL_MASTER_RIGHT , _MAX_VALUE = LAUNCH_CONTROL_MASTER_RIGHT , _DEFAULT_VALUE = CLUTCH } |
| User-selected working mode of the clutch paddles. More... | |
| enum class | AltButtonsWorkingMode : uint8_t { Regular = 0 , ALT , _MAX_VALUE = ALT , _DEFAULT_VALUE = ALT } |
| User-selected working mode of "ALT" buttons. More... | |
| enum class | PulseWidthMultiplier : uint8_t { X1 = 1 , X2 , X3 , X4 , X5 , X6 , _MAX_VALUE = X6 , _DEFAULT_VALUE = X2 } |
| User-selected pulse width multiplier. More... | |
| enum class | DPadWorkingMode : uint8_t { Regular = 0 , Navigation , _MAX_VALUE = Navigation , _DEFAULT_VALUE = Navigation } |
| User-selected working mode of directional pads. More... | |
| enum class | InternalEventType : uint8_t { Start , Shutdown , Disconnected , Connected , BitePoint , ClutchWorkingMode , AltButtonsWorkingMode , DPadWorkingMode , SettingsSaved , PulseWidthMultiplier , LowBattery , SaveSetting , LoadSetting , NewBatteryStatus } |
| Available internal event types. More... | |
| enum class | UserSetting : uint8_t { ALL = 0 , AXIS_CALIBRATION , AXIS_POLARITY , PULSE_WIDTH , SECURITY_LOCK , BITE_POINT , CLUTCH_WORKING_MODE , ALT_WORKING_MODE , DPAD_WORKING_MODE , INPUT_MAP , CUSTOM_HARDWARE_ID , BATTERY_AUTO_CALIBRATION , BATTERY_CALIBRATION_DATA , _MAX_VALUE = BATTERY_CALIBRATION_DATA } |
| User setting to be stored in flash memory. More... | |
| enum | SimpleCommand { CMD_RESERVED = 0 , CMD_AXIS_RECALIBRATE = 1 , CMD_BATT_RECALIBRATE = 2 , CMD_RESET_BUTTONS_MAP = 3 , CMD_SAVE_NOW = 4 , CMD_REVERSE_LEFT_AXIS = 5 , CMD_REVERSE_RIGHT_AXIS = 6 , CMD_SHOW_PIXELS = 7 , CMD_RESET_PIXELS = 8 , _MAX_VALUE = 8 } |
| Simple commands accepted from a feature HID report. More... | |
Types and constants used everywhere for firmware implementation.
Definition in file InternalTypes.hpp.
| #define AUTO_POWER_OFF_DELAY_SECS 60 |
Time to wait for connection before power off (in seconds)
Definition at line 775 of file InternalTypes.hpp.
| #define BITMASK | ( | count, | |
| first ) |
Return a mask for a number of consecutive buttons (count) starting from first. A mask is a bit array where each bit determines if a button is to be used or not. 1 means not used. 0 means in use. Masks are required to combine the state from multiple input bitmaps. For example, BITMASK(2,2) returns 0b(...)11110011 which means that buttons numbered 2 and 3 are in use.
Definition at line 112 of file InternalTypes.hpp.
| #define CLUTCH_1_4_VALUE 64 |
Value for 1/4 engaged clutch.
Definition at line 236 of file InternalTypes.hpp.
| #define CLUTCH_3_4_VALUE 192 |
Value for 3/4 engaged clutch.
Definition at line 238 of file InternalTypes.hpp.
| #define CLUTCH_DEFAULT_VALUE 127 |
Default bite point value.
Definition at line 234 of file InternalTypes.hpp.
| #define CLUTCH_FULL_VALUE 254 |
Value for a fully engaged clutch.
Definition at line 232 of file InternalTypes.hpp.
| #define CLUTCH_INVALID_VALUE 255 |
Invalid clutch value used for masking.
Definition at line 240 of file InternalTypes.hpp.
| #define CLUTCH_NONE_VALUE 0 |
Value for a fully released clutch.
Definition at line 230 of file InternalTypes.hpp.
| #define INPUT_TASK_PRIORITY (tskIDLE_PRIORITY + 2) |
Priority of background tasks.
Definition at line 306 of file InternalTypes.hpp.
| #define MAX_DECOUPLING_EVENT_COUNT 64 |
Queue size for decoupling events.
Definition at line 397 of file InternalTypes.hpp.
| #define NBITMASK | ( | count, | |
| first ) |
Return the logical negation of a bit mask.
Definition at line 120 of file InternalTypes.hpp.
| #define PRIVATE private |
For tesing.
Definition at line 29 of file InternalTypes.hpp.
| #define PROTECTED protected |
For tesing.
Definition at line 32 of file InternalTypes.hpp.
| typedef InternalEvent<InternalEventType::LoadSetting, UserSetting> LoadSetting |
Request to load a user setting.
Definition at line 758 of file InternalTypes.hpp.
| typedef InternalEvent< InternalEventType::AltButtonsWorkingMode, AltButtonsWorkingMode> OnAltButtonsWorkingMode |
New ALT buttons working mode.
Definition at line 712 of file InternalTypes.hpp.
| typedef InternalEvent< InternalEventType::NewBatteryStatus, const BatteryStatus &> OnBatteryStatus |
New battery level (state of charge) or battery status.
Definition at line 751 of file InternalTypes.hpp.
| typedef InternalEvent<InternalEventType::BitePoint, uint8_t> OnBitePoint |
New bite point.
Definition at line 696 of file InternalTypes.hpp.
New clutch working mode.
Definition at line 703 of file InternalTypes.hpp.
| typedef InternalEvent<InternalEventType::Connected, void> OnConnected |
Host connection.
Definition at line 690 of file InternalTypes.hpp.
| typedef InternalEvent<InternalEventType::Disconnected, void> OnDisconnected |
No host connection.
Definition at line 684 of file InternalTypes.hpp.
| typedef InternalEvent<InternalEventType::DPadWorkingMode, void> OnDPadWorkingMode |
New DPAD working mode.
Definition at line 719 of file InternalTypes.hpp.
| typedef InternalEvent<InternalEventType::LowBattery, void> OnLowBattery |
Notified when a low battery condition is detected.
Definition at line 742 of file InternalTypes.hpp.
| typedef InternalEvent< InternalEventType::PulseWidthMultiplier, PulseWidthMultiplier> OnPulseWidthMultiplier |
New pulse width multiplier.
Definition at line 735 of file InternalTypes.hpp.
| typedef InternalEvent<InternalEventType::SettingsSaved, void> OnSettingsSaved |
Save event.
Definition at line 726 of file InternalTypes.hpp.
| typedef InternalEvent<InternalEventType::Shutdown, void> OnShutdown |
The system is about to shutdown.
Definition at line 677 of file InternalTypes.hpp.
| typedef InternalEvent<InternalEventType::Start, void> OnStart |
| typedef InternalEvent<InternalEventType::SaveSetting, UserSetting> SaveSetting |
Request to save a user setting.
Definition at line 765 of file InternalTypes.hpp.
|
strong |
User-selected working mode of "ALT" buttons.
| Enumerator | |
|---|---|
| Regular | Regular button. |
| ALT | Engage or disengage alternate mode. |
Definition at line 250 of file InternalTypes.hpp.
|
strong |
User-selected working mode of the clutch paddles.
Definition at line 211 of file InternalTypes.hpp.
|
strong |
Enumeration of device capabilities.
Definition at line 132 of file InternalTypes.hpp.
|
strong |
User-selected working mode of directional pads.
| Enumerator | |
|---|---|
| Regular | Regular button. |
| Navigation | Navigation control. |
Definition at line 288 of file InternalTypes.hpp.
|
strong |
Available internal event types.
Definition at line 517 of file InternalTypes.hpp.
|
strong |
User-selected pulse width multiplier.
Definition at line 268 of file InternalTypes.hpp.
| enum SimpleCommand |
Simple commands accepted from a feature HID report.
Definition at line 785 of file InternalTypes.hpp.
|
strong |
User setting to be stored in flash memory.
Definition at line 556 of file InternalTypes.hpp.