OpenSourceSimWheelESP32
Open-source wireless steering wheel/button box for ESP32 boards
Loading...
Searching...
No Matches
SimWheelInternals.hpp
Go to the documentation of this file.
1
12#pragma once
13
14//-------------------------------------------------------------------
15// Imports
16//-------------------------------------------------------------------
17
18#include "InternalTypes.hpp"
19#include "SimWheelTypes.hpp"
20
21//-------------------------------------------------------------------
22// GLOBALS
23//-------------------------------------------------------------------
24
25//-------------------------------------------------------------------
26// API
27//-------------------------------------------------------------------
28
29namespace internals
30{
31 namespace batteryMonitor
32 {
37 void getReady();
38
44
51
60
61 } // namespace batteryMonitor
62
63 namespace batteryCalibration
64 {
69 void getReady();
70
75 void clear();
76
83 void addSample(int reading);
84
90 // void save();
91 }
92
93 namespace pixels
94 {
99 void getReady();
100
113 void show(
114 const ::std::vector<Pixel> &telemetry,
115 const ::std::vector<Pixel> &buttons,
116 const ::std::vector<Pixel> &individual);
117
126 uint8_t getCount(PixelGroup group);
127 } // namespace pixels
128
129 namespace ui
130 {
134 void getReady();
135
141 void routeInput(uint8_t inputNumber);
142 } // namespace ui
143
144 namespace inputs
145 {
150 void getReady();
151
157 void addFakeInput(FakeInput *instance);
158
165 inline void notifyInputEvent(const DecouplingEvent &input);
166 } // namespace inputs
167
168 namespace inputHub
169 {
174 void getReady();
175
182 } // namespace inputHub
183
184 namespace storage
185 {
187 void getReady();
188 } // namespace storage
189
190 namespace inputMap
191 {
196 void getReady();
197
203 void clear();
204
213 void map(bool isAltModeEngaged, uint128_t &bitmap);
214 } // namespace inputMap
215
216 namespace power
217 {
222 void getReady();
223 } // namespace power
224
225 namespace hid
226 {
227
250 void begin(
251 std::string deviceName,
252 std::string deviceManufacturer,
253 bool enableAutoPowerOff,
254 uint16_t VID,
255 uint16_t PID,
256 bool usb_enable = true,
257 bool ble_enable = true,
258 bool exclusive = false);
259
268
276
282
291
307 const uint128_t &inputs,
308 uint8_t POVstate,
309 uint8_t leftAxis,
310 uint8_t rightAxis,
311 uint8_t clutchAxis);
312
317 void reset();
318
325 namespace common
326 {
328 void getReady();
329
338 uint16_t onGetFeature(
339 uint8_t report_id,
340 uint8_t *buffer,
341 uint16_t len);
342
351 uint8_t report_id,
352 const uint8_t *buffer,
353 uint16_t len);
354
363 uint8_t report_id,
364 const uint8_t *buffer,
365 uint16_t len);
366
373 void onReset(uint8_t *report);
374
389 uint8_t *report,
390 bool notifyConfigChanges,
391 const uint128_t &inputs,
392 uint8_t POVstate,
393 uint8_t leftAxis,
394 uint8_t rightAxis,
395 uint8_t clutchAxis);
396
405 const BatteryStatus &status);
406
407 } // namespace common
408 } // namespace hid
409} // namespace internals
Types and constants used everywhere for firmware implementation.
void configureForTesting()
Configure period, warning and power-off limits for testing.
void * getHardwareInstance()
Get the Hardware Instance object.
void reportInput(const uint128_t &inputs, uint8_t POVstate, uint8_t leftAxis, uint8_t rightAxis, uint8_t clutchAxis)
Report HID inputs.
void addFakeInput(FakeInput *instance)
Add a fake input instance for testing.
void clear()
Clear calibration data (but may persist in flash memory).
void getReady()
Prepare to run.
bool isConnected()
Tell if there is a host connection.
uint8_t getCount(PixelGroup group)
Get the total number of pixels in a group.
bool supportsCustomHardwareID()
Support for a custom PID/VID.
void notifyInputEvent(const DecouplingEvent &input)
Push an input event into the decoupling queue (for testing)
void reset()
Report all inputs as not active.
void addSample(int reading)
Add an ADC reading to calibration data. The battery should get fully charged before first call.
void reportChangeInConfig()
Report a change in user settings (clutch function, etc.)
void map(bool isAltModeEngaged, uint128_t &bitmap)
Map a firmware-defined input bitmap.
void show(const ::std::vector< Pixel > &telemetry, const ::std::vector< Pixel > &buttons, const ::std::vector< Pixel > &individual)
Show pixel data in all groups.
void begin(std::string deviceName, std::string deviceManufacturer, bool enableAutoPowerOff, uint16_t VID, uint16_t PID, bool usb_enable=true, bool ble_enable=true, bool exclusive=false)
Start BLE/Bluetooth HID.
void onRawInput(DecouplingEvent &input)
Process a single input event.
void configureFakeMonitor(BatteryStatus *fakeStatus)
Configure a fake monitor for testing.
void routeInput(uint8_t inputNumber)
Route an input event to all UI instances.
void reportBatteryLevel(const BatteryStatus &status)
Report current battery level and status to the host computer.
Types and constants required for custom firmware setup.
PixelGroup
Available RGB LED groups for pixel control.
Everything related to the measurement of available battery charge.
Definition SimWheel.hpp:647
Everything related to the HID protocol.
Definition SimWheel.hpp:573
Everything related to the combined state of all inputs and their treatment.
Definition SimWheel.hpp:275
Translates firmware-defined input numbers to user-defined input numbers.
Definition SimWheel.hpp:520
Everything related to hardware inputs and their events.
Definition SimWheel.hpp:31
uint16_t onGetFeature(uint8_t report_id, uint8_t *buffer, uint16_t len)
Send feature report.
void onOutput(uint8_t report_id, const uint8_t *buffer, uint16_t len)
Receive an output report.
void getReady()
Prepare to run.
void onReset(uint8_t *report)
Resets data for the input report.
void onReportInput(uint8_t *report, bool notifyConfigChanges, const uint128_t &inputs, uint8_t POVstate, uint8_t leftAxis, uint8_t rightAxis, uint8_t clutchAxis)
Sets data for the input report.
BatteryStatusChrData toBleBatteryStatus(const BatteryStatus &status)
Convert a battery status to the data format required by the BAS specification (BLE only)
void onSetFeature(uint8_t report_id, const uint8_t *buffer, uint16_t len)
Receive a feature report.
Everything related to pixel control.
Definition SimWheel.hpp:735
Everything related to power management.
Definition SimWheel.hpp:616
Holds received telemetry data.
Definition SimWheel.hpp:773
Everything related to the user interface, if available.
Definition SimWheel.hpp:787
Data format for the Battery Level Status characteristic (packed)
Battery status.
Decoupling event.
Fake input specification used for testing.
128-bit integer