@@ -34,7 +34,13 @@ namespace SimRacing {
3434 /* *
3535 * Type alias for pin numbers, using Arduino numbering
3636 */
37- using PinNum = uint8_t ;
37+ using PinNum = int16_t ;
38+
39+ /* *
40+ * Dummy pin number signaling that a pin is unused
41+ * and can be safely ignored
42+ */
43+ const PinNum UnusedPin = -1 ;
3844
3945
4046 /* *
@@ -69,7 +75,7 @@ namespace SimRacing {
6975 /* *
7076 * Class constructor
7177 *
72- * @param pin the pin number being read. Can be 'NOT_A_PIN ' to disable.
78+ * @param pin the pin number being read. Can be 'UnusedPin ' to disable.
7379 * @param invert whether the input is inverted, so 'LOW' is detected instead of 'HIGH'
7480 * @param detectTime the amount of time, in ms, the input must be stable for
7581 * before it's interpreted as 'detected'
@@ -114,7 +120,7 @@ namespace SimRacing {
114120 */
115121 bool readPin () const ;
116122
117- const PinNum Pin; // /< The pin number being read from. Can be 'NOT_A_PIN ' to disable
123+ const PinNum Pin; // /< The pin number being read from. Can be 'UnusedPin ' to disable
118124 const bool Inverted; // /< Whether the input is inverted, so 'LOW' is detected instead of 'HIGH'
119125 unsigned long stablePeriod; // /< The amount of time the input must be stable for (ms)
120126
@@ -231,7 +237,7 @@ namespace SimRacing {
231237 void setCalibration (Calibration newCal);
232238
233239 private:
234- const PinNum Pin = NOT_A_PIN ; // /< the digital pin number for this input
240+ const PinNum Pin = UnusedPin ; // /< the digital pin number for this input
235241 int position; // /< the axis' position in its range, buffered
236242 Calibration cal; // /< the calibration values for the axis
237243 };
@@ -391,7 +397,7 @@ namespace SimRacing {
391397 * @param brakePin the analog pin for the brake pedal potentiometer
392398 * @param detectPin the digital pin for device detection (high is detected)
393399 */
394- TwoPedals (PinNum gasPin, PinNum brakePin, PinNum detectPin = NOT_A_PIN );
400+ TwoPedals (PinNum gasPin, PinNum brakePin, PinNum detectPin = UnusedPin );
395401
396402 /* *
397403 * Sets the calibration data (min/max) for the pedals
@@ -420,7 +426,7 @@ namespace SimRacing {
420426 * @param clutchPin the analog pin for the clutch pedal potentiometer
421427 * @param detectPin the digital pin for device detection (high is detected)
422428 */
423- ThreePedals (PinNum gasPin, PinNum brakePin, PinNum clutchPin, PinNum detectPin = NOT_A_PIN );
429+ ThreePedals (PinNum gasPin, PinNum brakePin, PinNum clutchPin, PinNum detectPin = UnusedPin );
424430
425431 /* *
426432 * Sets the calibration data (min/max) for the pedals
@@ -548,7 +554,7 @@ namespace SimRacing {
548554 * @param pinRev the digital input pin for the 'reverse' button
549555 * @param detectPin the digital pin for device detection (high is detected)
550556 */
551- AnalogShifter (PinNum pinX, PinNum pinY, PinNum pinRev = NOT_A_PIN , PinNum detectPin = NOT_A_PIN );
557+ AnalogShifter (PinNum pinX, PinNum pinY, PinNum pinRev = UnusedPin , PinNum detectPin = UnusedPin );
552558
553559 /* *
554560 * Initializes the hardware pins for reading the gear states.
@@ -687,7 +693,7 @@ namespace SimRacing {
687693 * @param pinAx analog pin number for the handbrake axis
688694 * @param detectPin the digital pin for device detection (high is detected)
689695 */
690- Handbrake (PinNum pinAx, PinNum detectPin = NOT_A_PIN );
696+ Handbrake (PinNum pinAx, PinNum detectPin = UnusedPin );
691697
692698 /* *
693699 * Initializes the pin for reading from the handbrake.
@@ -754,7 +760,7 @@ namespace SimRacing {
754760 class LogitechPedals : public ThreePedals {
755761 public:
756762 /* * @copydoc ThreePedals::ThreePedals */
757- LogitechPedals (PinNum gasPin, PinNum brakePin, PinNum clutchPin, PinNum detectPin = NOT_A_PIN );
763+ LogitechPedals (PinNum gasPin, PinNum brakePin, PinNum clutchPin, PinNum detectPin = UnusedPin );
758764 };
759765
760766 /* *
@@ -769,7 +775,7 @@ namespace SimRacing {
769775 class LogitechDrivingForceGT_Pedals : public TwoPedals {
770776 public:
771777 /* * @copydoc TwoPedals::TwoPedals */
772- LogitechDrivingForceGT_Pedals (PinNum gasPin, PinNum brakePin, PinNum detectPin = NOT_A_PIN );
778+ LogitechDrivingForceGT_Pedals (PinNum gasPin, PinNum brakePin, PinNum detectPin = UnusedPin );
773779 };
774780
775781 /* *
@@ -781,7 +787,7 @@ namespace SimRacing {
781787 class LogitechShifter : public AnalogShifter {
782788 public:
783789 /* * @copydoc AnalogShifter::AnalogShifter */
784- LogitechShifter (PinNum pinX, PinNum pinY, PinNum pinRev = NOT_A_PIN , PinNum detectPin = NOT_A_PIN );
790+ LogitechShifter (PinNum pinX, PinNum pinY, PinNum pinRev = UnusedPin , PinNum detectPin = UnusedPin );
785791 };
786792
787793
0 commit comments