Arduino Sim Racing Library v1.1.3
SimRacing::LogitechDrivingForceGT_Pedals Class Reference

Interface with the Logitech Driving Force GT pedals (Gas + Brake) More...

#include <SimRacing.h>

Inheritance diagram for SimRacing::LogitechDrivingForceGT_Pedals:
SimRacing::TwoPedals SimRacing::Pedals SimRacing::Peripheral

Public Types

using PedalID = SimRacing::Pedal
 

Public Member Functions

 LogitechDrivingForceGT_Pedals (uint8_t gasPin, uint8_t brakePin, uint8_t detectPin=NOT_A_PIN)
 
void setCalibration (AnalogInput::Calibration gasCal, AnalogInput::Calibration brakeCal)
 
void setCalibration (PedalID pedal, AnalogInput::Calibration cal)
 
virtual void begin ()
 
virtual bool update ()
 
long getPosition (PedalID pedal, long rMin=0, long rMax=100) const
 
int getPositionRaw (PedalID pedal) const
 
bool hasPedal (PedalID pedal) const
 
int getNumPedals () const
 
bool positionChanged () const
 
void serialCalibration (Stream &iface=Serial)
 
bool isConnected () const
 

Static Public Member Functions

static String getPedalName (PedalID pedal)
 

Detailed Description

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 763 of file SimRacing.h.

Member Typedef Documentation

◆ PedalID

Scoped alias for SimRacing::Pedal

Definition at line 279 of file SimRacing.h.

Constructor & Destructor Documentation

◆ LogitechDrivingForceGT_Pedals()

SimRacing::LogitechDrivingForceGT_Pedals::LogitechDrivingForceGT_Pedals ( uint8_t  gasPin,
uint8_t  brakePin,
uint8_t  detectPin = NOT_A_PIN 
)

Class constructor

Parameters
gasPinthe analog pin for the gas pedal potentiometer
brakePinthe analog pin for the brake pedal potentiometer
detectPinthe digital pin for device detection (high is detected)

Definition at line 574 of file SimRacing.cpp.

Member Function Documentation

◆ begin()

void SimRacing::Pedals::begin ( )
virtualinherited

Initialize the hardware (if necessary)

Reimplemented from SimRacing::Peripheral.

Examples
PedalsJoystick.ino, and PedalsPrint.ino.

Definition at line 344 of file SimRacing.cpp.

◆ 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 332 of file SimRacing.h.

◆ getPedalName()

String SimRacing::Pedals::getPedalName ( PedalID  pedal)
staticinherited

Utility function to get the string name for each pedal.

Parameters
pedalthe pedal to get the name of
Returns
the name of the pedal, as a String

Definition at line 390 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
pedalthe pedal to retrieve position for
rMinthe minimum output value for the rescaling function
rMaxthe maximum output value for the rescaling function
Returns
the pedal position, buffered and rescaled
Examples
PedalsJoystick.ino, and PedalsPrint.ino.

Definition at line 370 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
pedalthe pedal to retrieve position for
Returns
the axis position, buffered

Definition at line 375 of file SimRacing.cpp.

◆ hasPedal()

bool SimRacing::Pedals::hasPedal ( PedalID  pedal) const
inherited

Checks if a given pedal is present in the class.

Parameters
pedalthe pedal to check
Returns
'true' if there is data for the pedal, 'false' otherwise
Examples
PedalsJoystick.ino, and PedalsPrint.ino.

Definition at line 380 of file SimRacing.cpp.

◆ isConnected()

bool SimRacing::Pedals::isConnected ( ) const
inlinevirtualinherited

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

Reimplemented from SimRacing::Peripheral.

Definition at line 358 of file SimRacing.h.

◆ 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 339 of file SimRacing.h.

◆ serialCalibration()

void SimRacing::Pedals::serialCalibration ( Stream &  iface = Serial)
inherited

Runs an interactive calibration tool using the serial interface.

Parameters
ifacethe serial interface to send and receive prompts. Defaults to Serial (CDC USB on most boards).
Examples
PedalsPrint.ino.

Definition at line 410 of file SimRacing.cpp.

◆ setCalibration() [1/2]

void SimRacing::TwoPedals::setCalibration ( AnalogInput::Calibration  gasCal,
AnalogInput::Calibration  brakeCal 
)
inherited

Sets the calibration data (min/max) for the pedals

Parameters
gasCalthe calibration data for the gas pedal
brakeCalthe calibration data for the brake pedal

Definition at line 546 of file SimRacing.cpp.

◆ setCalibration() [2/2]

void SimRacing::Pedals::setCalibration ( PedalID  pedal,
AnalogInput::Calibration  cal 
)
inherited

Calibrate a pedal's min/max values for rescaling.

Parameters
pedalthe pedal to set the calibration of
calthe calibration data to set

Definition at line 384 of file SimRacing.cpp.

◆ update()

bool SimRacing::Pedals::update ( )
virtualinherited

Perform a poll of the hardware to refresh the class state

Returns
'true' if device state changed, 'false' otherwise

Implements SimRacing::Peripheral.

Examples
PedalsJoystick.ino, and PedalsPrint.ino.

Definition at line 348 of file SimRacing.cpp.


The documentation for this class was generated from the following files: