Arduino Sim Racing Library v1.1.5
|
Interface with analog handbrakes that use hall effect sensors. More...
#include <SimRacing.h>
Public Member Functions | |
Handbrake (PinNum pinAx, PinNum pinDetect=UnusedPin) | |
Class constructor. | |
virtual void | begin () |
Initializes the pin for reading from the handbrake. | |
virtual bool | update () |
Polls the handbrake to update its position. | |
long | getPosition (long rMin=0, long rMax=100) const |
Retrieves the buffered position for the handbrake axis, rescaled to a nominal range using the calibration values. | |
int | getPositionRaw () const |
Retrieves the buffered position for the handbrake, ignoring the calibration data. | |
bool | positionChanged () const |
Checks whether the handbrake's position has changed since the last update. | |
void | setCalibration (AnalogInput::Calibration newCal) |
Calibrate the axis' min/max values for rescaling. | |
void | serialCalibration (Stream &iface=Serial) |
Runs an interactive calibration tool using the serial interface. | |
bool | isConnected () const |
Check if the device is physically connected to the board. | |
Interface with analog handbrakes that use hall effect sensors.
Definition at line 688 of file SimRacing.h.
Class constructor.
pinAx | analog pin number for the handbrake axis |
pinDetect | the digital pin for device detection (high is detected) |
Definition at line 1009 of file SimRacing.cpp.
|
virtual |
Initializes the pin for reading from the handbrake.
Reimplemented from SimRacing::Peripheral.
Definition at line 1016 of file SimRacing.cpp.
long SimRacing::Handbrake::getPosition | ( | long | rMin = 0, |
long | rMax = 100 ) const |
Retrieves the buffered position for the handbrake axis, rescaled to a nominal range using the calibration values.
By default this is rescaled to an integer percentage (0 - 100)
rMin | the minimum output value |
rMax | the maximum output value |
Definition at line 1035 of file SimRacing.cpp.
int SimRacing::Handbrake::getPositionRaw | ( | ) | const |
Retrieves the buffered position for the handbrake, ignoring the calibration data.
Definition at line 1039 of file SimRacing.cpp.
|
inlinevirtual |
Check if the device is physically connected to the board.
That means it is both present and detected long enough to be considered 'stable'.
Reimplemented from SimRacing::Peripheral.
Definition at line 745 of file SimRacing.h.
|
inline |
Checks whether the handbrake's position has changed since the last update.
Definition at line 736 of file SimRacing.h.
void SimRacing::Handbrake::serialCalibration | ( | Stream & | iface = Serial | ) |
Runs an interactive calibration tool using the serial interface.
iface | the serial interface to send and receive prompts. Defaults to Serial (CDC USB on most boards). |
Definition at line 1048 of file SimRacing.cpp.
void SimRacing::Handbrake::setCalibration | ( | AnalogInput::Calibration | newCal | ) |
Calibrate the axis' min/max values for rescaling.
newCal | the calibration data struct to pass |
Definition at line 1043 of file SimRacing.cpp.
|
virtual |
Polls the handbrake to update its position.
Implements SimRacing::Peripheral.
Definition at line 1020 of file SimRacing.cpp.