Interface with the Logitech Driving Force GT pedals (Gas + Brake)
More...
#include <SimRacing.h>
|
static String | getPedalName (PedalID pedal) |
| Utility function to get the string name for each pedal.
|
|
Interface with the Logitech Driving Force GT pedals (Gas + Brake)
Note that this is the older wheel made for the PS3. It is not the modern "Driving Force" wheel.
- See also
- https://en.wikipedia.org/wiki/Logitech_Driving_Force_GT
Definition at line 861 of file SimRacing.h.
◆ PedalID
◆ LogitechDrivingForceGT_Pedals()
SimRacing::LogitechDrivingForceGT_Pedals::LogitechDrivingForceGT_Pedals |
( |
PinNum | pinGas, |
|
|
PinNum | pinBrake, |
|
|
PinNum | pinDetect = UnusedPin ) |
Class constructor.
- Parameters
-
pinGas | the analog pin for the gas pedal potentiometer, DE-9 pin 2 |
pinBrake | the analog pin for the brake pedal potentiometer, DE-9 pin 3 |
pinDetect | the digital pin for device detection, DE-9 pin 4. Requires a pull-down resistor. |
Definition at line 714 of file SimRacing.cpp.
◆ begin()
void SimRacing::Pedals::begin |
( |
| ) |
|
|
virtualinherited |
◆ getNumPedals()
int SimRacing::Pedals::getNumPedals |
( |
| ) |
const |
|
inlineinherited |
Retrieves the number of pedals handled by the class.
- Returns
- the number of pedals handled by the class
Definition at line 390 of file SimRacing.h.
◆ getPedalName()
String SimRacing::Pedals::getPedalName |
( |
PedalID | pedal | ) |
|
|
staticinherited |
Utility function to get the string name for each pedal.
- Parameters
-
pedal | the pedal to get the name of |
- Returns
- the name of the pedal, as a String
Definition at line 527 of file SimRacing.cpp.
◆ getPosition()
long SimRacing::Pedals::getPosition |
( |
PedalID | pedal, |
|
|
long | rMin = 0, |
|
|
long | rMax = 100 ) const |
|
inherited |
Retrieves the buffered position for the pedal, rescaled to a nominal range using the calibration values.
By default this is rescaled to an integer percentage.
- Parameters
-
pedal | the pedal to retrieve position for |
rMin | the minimum output value for the rescaling function |
rMax | the maximum output value for the rescaling function |
- Returns
- the pedal position, buffered and rescaled
- Examples
- PedalsJoystick.ino, and PedalsPrint.ino.
Definition at line 507 of file SimRacing.cpp.
◆ getPositionRaw()
int SimRacing::Pedals::getPositionRaw |
( |
PedalID | pedal | ) |
const |
|
inherited |
Retrieves the buffered position for the pedal, ignoring the calibration data.
- Parameters
-
pedal | the pedal to retrieve position for |
- Returns
- the axis position, buffered
Definition at line 512 of file SimRacing.cpp.
◆ hasPedal()
bool SimRacing::Pedals::hasPedal |
( |
PedalID | pedal | ) |
const |
|
inherited |
◆ isConnected()
bool SimRacing::Peripheral::isConnected |
( |
| ) |
const |
|
inherited |
Check if the device is physically connected to the board.
That means it is both present and detected long enough to be considered 'stable'.
- Returns
- 'true' if the device is connected, 'false' otherwise
Definition at line 446 of file SimRacing.cpp.
◆ positionChanged()
bool SimRacing::Pedals::positionChanged |
( |
| ) |
const |
|
inlineinherited |
Checks whether the current pedal positions have changed since the last update.
- Returns
- 'true' if position has changed, 'false' otherwise
- Examples
- PedalsJoystick.ino.
Definition at line 397 of file SimRacing.h.
◆ serialCalibration()
void SimRacing::Pedals::serialCalibration |
( |
Stream & | iface = Serial | ) |
|
|
inherited |
Runs an interactive calibration tool using the serial interface.
- Parameters
-
iface | the serial interface to send and receive prompts. Defaults to Serial (CDC USB on most boards). |
- Examples
- PedalsPrint.ino.
Definition at line 547 of file SimRacing.cpp.
◆ setCalibration() [1/2]
Calibrate a pedal's min/max values for rescaling.
- Parameters
-
pedal | the pedal to set the calibration of |
cal | the calibration data to set |
Definition at line 521 of file SimRacing.cpp.
◆ setCalibration() [2/2]
Sets the calibration data (min/max) for the pedals.
- Parameters
-
gasCal | the calibration data for the gas pedal |
brakeCal | the calibration data for the brake pedal |
Definition at line 683 of file SimRacing.cpp.
◆ setDetectPtr()
Sets the pointer to the detector object.
The detector object is used to check if the peripheral is connected to the microcontroller. The object is polled on every update.
Although the detector instance is accessed via the Peripheral class, it is the responsibility of the dervied class to store the DeviceConnection object and manage its lifetime.
- Parameters
-
d | pointer to the detector object |
Definition at line 456 of file SimRacing.cpp.
◆ setStablePeriod()
void SimRacing::Peripheral::setStablePeriod |
( |
unsigned long | t | ) |
|
|
inherited |
Set how long the detection pin must be stable for before the device is considered to be 'connected'.
- Parameters
-
t | the amount of time, in ms, the input must be stable for (no changes) before it's interpreted as 'detected' |
Definition at line 460 of file SimRacing.cpp.
◆ update()
bool SimRacing::Peripheral::update |
( |
| ) |
|
|
inherited |
Perform a poll of the hardware to refresh the class state.
- Returns
- 'true' if device state changed, 'false' otherwise
- Examples
- HandbrakeJoystick.ino, HandbrakePrint.ino, LogitechShifterG25_Joystick.ino, LogitechShifterG25_Print.ino, LogitechShifterG27_Joystick.ino, LogitechShifterG27_Print.ino, LogitechShifter_Joystick.ino, LogitechShifter_Print.ino, PedalsJoystick.ino, and PedalsPrint.ino.
Definition at line 433 of file SimRacing.cpp.
◆ updateState()
bool SimRacing::Pedals::updateState |
( |
bool | connected | ) |
|
|
protectedvirtualinherited |
Perform an internal poll of the hardware to refresh the class state.
This function is called from within the public update() in order to refresh the cached state of the peripheral. It needs to be defined in every derived class. This function is the only place where the cached device state should be changed.
- Parameters
-
connected | the state of the device connection |
- Returns
- 'true' if device state changed, 'false' otherwise
Implements SimRacing::Peripheral.
Definition at line 482 of file SimRacing.cpp.
The documentation for this class was generated from the following files: