Skip to content

Commit 7c81e77

Browse files
committed
Swap G25/G27 LED and detect pin order
This is arbitrary, but it's important to get this change in there before the API is locked for the major release. Originally, I figured that resistors were required for both pins (pull-down for the detect, series for the LED). In which case, it's more likely that users would want the detect feature (disabling inputs on disconnect) over the LED feature (...blinky). After some testing I've determined that even though the LED should probably have a 100 Ohm resistor, it will survive without it. That means it's more likely for users to set it, in which case it should take precedence over the detect pin. In addition, the LED pin is shared by the data input of the EEPROM chip. Although the library does not currently interface with the EEPROM, if it ever does that pin will become required. In which case, again, the detect pin would end up at the end of the list so it can have a default argument.
1 parent 00db3a5 commit 7c81e77

File tree

6 files changed

+22
-22
lines changed

6 files changed

+22
-22
lines changed

examples/Shifter/LogitechShifterG25/LogitechShifterG25_Joystick/LogitechShifterG25_Joystick.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const int Pin_ShifterDetect = SimRacing::UnusedPin; // DE-9 pin 1
5555
SimRacing::LogitechShifterG25 shifter(
5656
Pin_ShifterX, Pin_ShifterY,
5757
Pin_ShifterLatch, Pin_ShifterClock, Pin_ShifterData,
58-
Pin_ShifterDetect, Pin_ShifterLED
58+
Pin_ShifterLED, Pin_ShifterDetect
5959
);
6060
//SimRacing::LogitechShifterG25 shifter = SimRacing::CreateShieldObject<SimRacing::LogitechShifterG25, 2>();
6161

examples/Shifter/LogitechShifterG25/LogitechShifterG25_Print/LogitechShifterG25_Print.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const int Pin_ShifterDetect = SimRacing::UnusedPin; // DE-9 pin 1
5151
SimRacing::LogitechShifterG25 shifter(
5252
Pin_ShifterX, Pin_ShifterY,
5353
Pin_ShifterLatch, Pin_ShifterClock, Pin_ShifterData,
54-
Pin_ShifterDetect, Pin_ShifterLED
54+
Pin_ShifterLED, Pin_ShifterDetect
5555
);
5656
//SimRacing::LogitechShifterG25 shifter = SimRacing::CreateShieldObject<SimRacing::LogitechShifterG25, 2>();
5757

examples/Shifter/LogitechShifterG27/LogitechShifterG27_Joystick/LogitechShifterG27_Joystick.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ const int Pin_ShifterDetect = SimRacing::UnusedPin; // DE-9 pin 7
5353
SimRacing::LogitechShifterG27 shifter(
5454
Pin_ShifterX, Pin_ShifterY,
5555
Pin_ShifterLatch, Pin_ShifterClock, Pin_ShifterData,
56-
Pin_ShifterDetect, Pin_ShifterLED
56+
Pin_ShifterLED, Pin_ShifterDetect
5757
);
5858
//SimRacing::LogitechShifterG27 shifter = SimRacing::CreateShieldObject<SimRacing::LogitechShifterG27, 2>();
5959

examples/Shifter/LogitechShifterG27/LogitechShifterG27_Print/LogitechShifterG27_Print.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const int Pin_ShifterDetect = SimRacing::UnusedPin; // DE-9 pin 7
4949
SimRacing::LogitechShifterG27 shifter(
5050
Pin_ShifterX, Pin_ShifterY,
5151
Pin_ShifterLatch, Pin_ShifterClock, Pin_ShifterData,
52-
Pin_ShifterDetect, Pin_ShifterLED
52+
Pin_ShifterLED, Pin_ShifterDetect
5353
);
5454
//SimRacing::LogitechShifterG27 shifter = SimRacing::CreateShieldObject<SimRacing::LogitechShifterG27, 2>();
5555

src/SimRacing.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@ LogitechShifterG27 CreateShieldObject<LogitechShifterG27, 2>() {
8484
const PinNum Pin_Latch = 10; // DE-9 pin 3, aka chip select, requires 10k Ohm pull-up
8585
const PinNum Pin_Clock = 15; // DE-9 pin 1, should have 470 Ohm resistor to prevent shorts
8686

87-
const PinNum Pin_Detect = A2; // DE-9 pin 7, requires 10k Ohm pull-down
8887
const PinNum Pin_LED = 16; // DE-9 pin 5, has a 100-120 Ohm series resistor
88+
const PinNum Pin_Detect = A2; // DE-9 pin 7, requires 10k Ohm pull-down
8989

90-
return LogitechShifterG27(Pin_X_Wiper, Pin_Y_Wiper, Pin_Latch, Pin_Clock, Pin_DataOut, Pin_Detect, Pin_LED);
90+
return LogitechShifterG27(Pin_X_Wiper, Pin_Y_Wiper, Pin_Latch, Pin_Clock, Pin_DataOut, Pin_LED, Pin_Detect);
9191
}
9292

9393
template<>
@@ -102,10 +102,10 @@ LogitechShifterG25 CreateShieldObject<LogitechShifterG25, 2>() {
102102
const PinNum Pin_Latch = 10; // DE-9 pin 3, aka chip select, requires 10k Ohm pull-up
103103
const PinNum Pin_Clock = A2; // DE-9 pin 7, should have 470 Ohm resistor to prevent shorts
104104

105-
const PinNum Pin_Detect = 15; // DE-9 pin 1, requires 10k Ohm pull-down
106105
const PinNum Pin_LED = 16; // DE-9 pin 5, has a 100-120 Ohm series resistor
106+
const PinNum Pin_Detect = 15; // DE-9 pin 1, requires 10k Ohm pull-down
107107

108-
return LogitechShifterG25(Pin_X_Wiper, Pin_Y_Wiper, Pin_Latch, Pin_Clock, Pin_DataOut, Pin_Detect, Pin_LED);
108+
return LogitechShifterG25(Pin_X_Wiper, Pin_Y_Wiper, Pin_Latch, Pin_Clock, Pin_DataOut, Pin_LED, Pin_Detect);
109109
}
110110
#endif // ATmega32U4 for shield functions
111111

@@ -1148,8 +1148,8 @@ LogitechShifter::LogitechShifter(PinNum pinX, PinNum pinY, PinNum pinRev, PinNum
11481148
LogitechShifterG27::LogitechShifterG27(
11491149
PinNum pinX, PinNum pinY,
11501150
PinNum pinLatch, PinNum pinClock, PinNum pinData,
1151-
PinNum pinDetect,
1152-
PinNum pinLed
1151+
PinNum pinLed,
1152+
PinNum pinDetect
11531153
) :
11541154
LogitechShifter(pinX, pinY, UnusedPin, pinDetect),
11551155

@@ -1397,14 +1397,14 @@ const float LogitechShifterG25::CalReleasePoint = 0.50;
13971397
LogitechShifterG25::LogitechShifterG25(
13981398
PinNum pinX, PinNum pinY,
13991399
PinNum pinLatch, PinNum pinClock, PinNum pinData,
1400-
PinNum pinDetect,
1401-
PinNum pinLed
1400+
PinNum pinLed,
1401+
PinNum pinDetect
14021402
) :
14031403
LogitechShifterG27(
14041404
pinX, pinY,
14051405
pinLatch, pinClock, pinData,
1406-
pinDetect,
1407-
pinLed
1406+
pinLed,
1407+
pinDetect
14081408
),
14091409

14101410
sequentialProcess(false), // not in sequential mode

src/SimRacing.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -973,16 +973,16 @@ namespace SimRacing {
973973
* @param pinLatch digital output pin to pulse to latch data, DE-9 pin 3
974974
* @param pinClock digital output pin to pulse as a clock, DE-9 pin 1
975975
* @param pinData digital input pin to use for reading data, DE-9 pin 2
976-
* @param pinDetect the digital input pin for device detection, DE-9 pin 7.
977-
* Requires a pull-down resistor.
978976
* @param pinLed digital output pin to light the power LED on connection,
979977
* DE-9 pin 5
978+
* @param pinDetect digital input pin for device detection, DE-9 pin 7.
979+
* Requires a pull-down resistor.
980980
*/
981981
LogitechShifterG27(
982982
PinNum pinX, PinNum pinY,
983983
PinNum pinLatch, PinNum pinClock, PinNum pinData,
984-
PinNum pinDetect = UnusedPin,
985-
PinNum pinLed = UnusedPin
984+
PinNum pinLed = UnusedPin,
985+
PinNum pinDetect = UnusedPin
986986
);
987987

988988
/**
@@ -1106,16 +1106,16 @@ namespace SimRacing {
11061106
* @param pinLatch digital output pin to pulse to latch data, DE-9 pin 3
11071107
* @param pinClock digital output pin to pulse as a clock, DE-9 pin 7
11081108
* @param pinData digital input pin to use for reading data, DE-9 pin 2
1109-
* @param pinDetect the digital input pin for device detection, DE-9 pin 1.
1110-
* Requires a pull-down resistor.
11111109
* @param pinLed digital output pin to light the power LED on connection,
11121110
* DE-9 pin 5
1111+
* @param pinDetect digital input pin for device detection, DE-9 pin 1.
1112+
* Requires a pull-down resistor.
11131113
*/
11141114
LogitechShifterG25(
11151115
PinNum pinX, PinNum pinY,
11161116
PinNum pinLatch, PinNum pinClock, PinNum pinData,
1117-
PinNum pinDetect = UnusedPin,
1118-
PinNum pinLed = UnusedPin
1117+
PinNum pinLed = UnusedPin,
1118+
PinNum pinDetect = UnusedPin
11191119
);
11201120

11211121
/** @copydoc LogitechShifterG27::begin() */

0 commit comments

Comments
 (0)