Arduino Sim Racing Library v2.0.0
Loading...
Searching...
No Matches
SimRacing.h File Reference

Header file for the Sim Racing Library. More...

#include <Arduino.h>

Go to the source code of this file.

Classes

class  SimRacing::DeviceConnection
 Used for tracking whether a device is connected to a specific pin and stable. More...
 
class  SimRacing::AnalogInput
 Handle I/O for analog (ADC) inputs. More...
 
struct  SimRacing::AnalogInput::Calibration
 Simple struct containing min/max values for axis calibration. More...
 
class  SimRacing::Peripheral
 Abstract class for all peripherals. More...
 
class  SimRacing::Pedals
 Base class for all pedals instances. More...
 
class  SimRacing::TwoPedals
 Pedal implementation for devices with only gas and brake. More...
 
class  SimRacing::ThreePedals
 Pedal implementation for devices with gas, brake, and clutch. More...
 
class  SimRacing::Shifter
 Base class for all shifter instances. More...
 
class  SimRacing::AnalogShifter
 Interface with shifters using two potentiometers for gear position. More...
 
struct  SimRacing::AnalogShifter::GearPosition
 Simple struct to store X/Y coordinates for the calibration function. More...
 
class  SimRacing::Handbrake
 Interface with analog handbrakes that use hall effect sensors. More...
 
class  SimRacing::LogitechPedals
 Interface with the Logitech pedals (Gas, Brake, and Clutch) More...
 
class  SimRacing::LogitechDrivingForceGT_Pedals
 Interface with the Logitech Driving Force GT pedals (Gas + Brake) More...
 
class  SimRacing::LogitechShifter
 Interface with the Logitech Driving Force shifter. More...
 
class  SimRacing::LogitechShifterG27
 Interface with the Logitech G27 shifter. More...
 
class  SimRacing::LogitechShifterG25
 Interface with the Logitech G25 shifter. More...
 

Typedefs

using SimRacing::PinNum = int16_t
 Type alias for pin numbers, using Arduino numbering.
 
using SimRacing::LogitechShifterG923 = LogitechShifter
 Interface with the Logitech G923 shifter.
 
using SimRacing::LogitechShifterG29 = LogitechShifter
 Interface with the Logitech G29 shifter.
 
using SimRacing::LogitechShifterG920 = LogitechShifter
 Interface with the Logitech G920 shifter.
 

Enumerations

enum  SimRacing::Axis : uint8_t { SimRacing::X = 0 , SimRacing::Y = 1 }
 Enumeration for analog axis names, mapped to integers. More...
 
enum  SimRacing::Pedal {
  Gas = 0 , Accelerator = Gas , Throttle = Gas , Brake = 1 ,
  Clutch = 2
}
 Pedal ID names. More...
 

Functions

template<class T , uint8_t Version>
SimRacing::CreateShieldObject ()
 Create an object for use with one of the Sim Racing Shields, designed for the SparkFun Pro Micro (32U4).
 
template<>
LogitechPedals SimRacing::CreateShieldObject< LogitechPedals, 1 > ()
 Create a LogitechPedals object for the Pedals Shield v1.
 
template<>
LogitechPedals SimRacing::CreateShieldObject< LogitechPedals, 2 > ()
 Create a LogitechPedals object for the Pedals Shield v2.
 
template<>
LogitechShifter SimRacing::CreateShieldObject< LogitechShifter, 1 > ()
 Create a LogitechShifter object for the Shifter Shield v1.
 
template<>
LogitechShifter SimRacing::CreateShieldObject< LogitechShifter, 2 > ()
 Create a LogitechShifter object for the Shifter Shield v2.
 
template<>
LogitechShifterG27 SimRacing::CreateShieldObject< LogitechShifterG27, 2 > ()
 Create a LogitechShifterG27 object for the Shifter Shield v2.
 
template<>
LogitechShifterG25 SimRacing::CreateShieldObject< LogitechShifterG25, 2 > ()
 Create a LogitechShifterG25 object for the Shifter Shield v2.
 

Variables

const PinNum SimRacing::UnusedPin = -1
 Dummy pin number signaling that a pin is unused and can be safely ignored.
 

Detailed Description

Header file for the Sim Racing Library.

Definition in file SimRacing.h.

Typedef Documentation

◆ PinNum

using SimRacing::PinNum = int16_t

Type alias for pin numbers, using Arduino numbering.

Definition at line 37 of file SimRacing.h.

Enumeration Type Documentation

◆ Axis

enum SimRacing::Axis : uint8_t

Enumeration for analog axis names, mapped to integers.

Enumerator

Cartesian X axis.

Cartesian Y axis.

Definition at line 49 of file SimRacing.h.

Function Documentation

◆ CreateShieldObject()

template<class T , uint8_t Version>
T SimRacing::CreateShieldObject ( )

Create an object for use with one of the Sim Racing Shields, designed for the SparkFun Pro Micro (32U4).

This is a convenience function, so that users with a shield don't need to look up or remember the pin assignments for their hardware.

// Generic Usage
auto myObject = SimRacing::CreateShieldObject<ObjectType, Version>();
// Creating a LogitechShifter object for the v2 shifter shield
auto myShifter = SimRacing::CreateShieldObject<LogitechShifter, 2>();

The following classes are supported for the Pedals shield, v1:

The following classes are supported for the Shifter shield, v1:

Version 2 of the shifter shield includes support for all of the classes from v1, as well as the following:

Note
The default version of this template is undefined, so trying to create a class that is unsupported by the shield will generate a linker error. This is intentional.
Template Parameters
TThe class to create
VersionThe major version number of the shield
Returns
class instance, using the hardware pins on the shield
See also
https://github.com/dmadison/Sim-Racing-Shields

◆ CreateShieldObject< LogitechPedals, 1 >()

template<>
LogitechPedals SimRacing::CreateShieldObject< LogitechPedals, 1 > ( )

Create a LogitechPedals object for the Pedals Shield v1.

Definition at line 35 of file SimRacing.cpp.

◆ CreateShieldObject< LogitechPedals, 2 >()

template<>
LogitechPedals SimRacing::CreateShieldObject< LogitechPedals, 2 > ( )

Create a LogitechPedals object for the Pedals Shield v2.

Definition at line 48 of file SimRacing.cpp.

◆ CreateShieldObject< LogitechShifter, 1 >()

template<>
LogitechShifter SimRacing::CreateShieldObject< LogitechShifter, 1 > ( )

Create a LogitechShifter object for the Shifter Shield v1.

Definition at line 55 of file SimRacing.cpp.

◆ CreateShieldObject< LogitechShifter, 2 >()

template<>
LogitechShifter SimRacing::CreateShieldObject< LogitechShifter, 2 > ( )

Create a LogitechShifter object for the Shifter Shield v2.

Definition at line 69 of file SimRacing.cpp.

◆ CreateShieldObject< LogitechShifterG25, 2 >()

template<>
LogitechShifterG25 SimRacing::CreateShieldObject< LogitechShifterG25, 2 > ( )

Create a LogitechShifterG25 object for the Shifter Shield v2.

Definition at line 94 of file SimRacing.cpp.

◆ CreateShieldObject< LogitechShifterG27, 2 >()

template<>
LogitechShifterG27 SimRacing::CreateShieldObject< LogitechShifterG27, 2 > ( )

Create a LogitechShifterG27 object for the Shifter Shield v2.

Definition at line 76 of file SimRacing.cpp.

Variable Documentation

◆ UnusedPin

const PinNum SimRacing::UnusedPin = -1

Dummy pin number signaling that a pin is unused and can be safely ignored.

Examples
LogitechShifterG25_Joystick.ino, LogitechShifterG25_Print.ino, LogitechShifterG27_Joystick.ino, LogitechShifterG27_Print.ino, LogitechShifter_Joystick.ino, and LogitechShifter_Print.ino.

Definition at line 43 of file SimRacing.h.