Arduino Sim Racing Library v1.1.4
|
Base class for all shifter instances. More...
#include <SimRacing.h>
Public Member Functions | |
Shifter (int8_t min, int8_t max) | |
int8_t | getGear () const |
char | getGearChar () const |
String | getGearString () const |
bool | gearChanged () const |
int8_t | getGearMin () |
int8_t | getGearMax () |
virtual void | begin () |
virtual bool | update ()=0 |
virtual bool | isConnected () const |
Static Public Member Functions | |
static char | getGearChar (int gear) |
static String | getGearString (int gear) |
Protected Attributes | |
const int8_t | MinGear |
the lowest selectable gear | |
const int8_t | MaxGear |
the highest selectable gear | |
int8_t | currentGear |
index of the current gear | |
bool | changed |
whether the gear has changed since the previous update | |
Base class for all shifter instances.
Definition at line 445 of file SimRacing.h.
SimRacing::Shifter::Shifter | ( | int8_t | min, |
int8_t | max | ||
) |
Class constructor
min | the lowest gear possible |
max | the highest gear possible |
Definition at line 585 of file SimRacing.cpp.
|
inlinevirtualinherited |
Initialize the hardware (if necessary)
Reimplemented in SimRacing::Pedals, SimRacing::AnalogShifter, and SimRacing::Handbrake.
Definition at line 242 of file SimRacing.h.
|
inline |
Checks whether the current gear has changed since the last update.
Definition at line 507 of file SimRacing.h.
|
inline |
Returns the currently selected gear.
Will either be reverse (-1), neutral (0), or the current gear indexed at 1 (1st gear is 1, 2nd gear is 2, etc.).
Definition at line 463 of file SimRacing.h.
char SimRacing::Shifter::getGearChar | ( | ) | const |
Returns a character that represents the current gear.
Definition at line 607 of file SimRacing.cpp.
|
static |
Returns a character that represents the given gear.
'r' for reverse, 'n' for neutral, or the number of the current gear.
gear | the gear index to get the representation for |
Definition at line 589 of file SimRacing.cpp.
|
inline |
Retrieves the maximum possible gear index.
Definition at line 521 of file SimRacing.h.
|
inline |
Retrieves the minimum possible gear index.
Definition at line 514 of file SimRacing.h.
String SimRacing::Shifter::getGearString | ( | ) | const |
Returns a String that represents the current gear.
Definition at line 648 of file SimRacing.cpp.
|
static |
Returns a String that represents the given gear.
"reverse" for reverse, "neutral" for neutral, and then "1st", "2nd", "3rd", and so on.
gear | the gear index to get the representation for |
Definition at line 611 of file SimRacing.cpp.
|
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'.
Reimplemented in SimRacing::Pedals, SimRacing::AnalogShifter, and SimRacing::Handbrake.
Definition at line 252 of file SimRacing.h.
|
pure virtualinherited |
Perform a poll of the hardware to refresh the class state
Implemented in SimRacing::Pedals, SimRacing::AnalogShifter, and SimRacing::Handbrake.
|
protected |
whether the gear has changed since the previous update
Definition at line 528 of file SimRacing.h.
|
protected |
index of the current gear
Definition at line 527 of file SimRacing.h.
|
protected |
the highest selectable gear
Definition at line 525 of file SimRacing.h.
|
protected |
the lowest selectable gear
Definition at line 524 of file SimRacing.h.