18
18
// some pins can function as either digital or analog inputs, so we predefine
19
19
// which will operate in which mode
20
20
// X Y Th
21
- static const int analog_pins [] = { A0, A1, A6 };
22
- static const int digital_pins [] = { 3 , 5 , 6 , 7 , 8 , 9 , 14 };
21
+ static const int axes_pins [] = { A0, A1, A6 };
22
+ static const int button_pins [] = { 3 , 5 , 6 , 7 , 8 , 9 , 14 };
23
23
24
24
struct {
25
25
bool is_calibrated = false ;
@@ -85,7 +85,7 @@ void calibration()
85
85
Serial.println (" ========= Calibrating =========" );
86
86
for (int i = 0 ; i < AXIS_ARRAY_SIZE; i++) {
87
87
88
- uint16_t curr = analogRead (analog_pins [i]);
88
+ uint16_t curr = analogRead (axes_pins [i]);
89
89
Serial.print (" Axis: " );
90
90
Serial.print (i);
91
91
Serial.print (" - Raw Value: " );
@@ -118,11 +118,11 @@ void setupPins(void)
118
118
// Set all the digital pins as inputs
119
119
// with the pull-up enabled, except for the
120
120
// two serial line pins
121
- for (int pin : digital_pins ) {
121
+ for (int pin : button_pins ) {
122
122
pinMode (pin, INPUT_PULLUP);
123
123
}
124
124
125
- for (int Ai : analog_pins ) {
125
+ for (int Ai : axes_pins ) {
126
126
pinMode (Ai, INPUT);
127
127
digitalWrite (Ai, LOW);
128
128
}
@@ -196,7 +196,7 @@ int axisRead(int index, int filter_total, int option = CURVE)
196
196
return readToCurve (
197
197
map (
198
198
analogReadFilter (
199
- analog_pins [index],
199
+ axes_pins [index],
200
200
filter_total
201
201
),
202
202
calibration_data.min [index],
@@ -209,7 +209,7 @@ int axisRead(int index, int filter_total, int option = CURVE)
209
209
}
210
210
return map (
211
211
analogReadFilter (
212
- analog_pins [index],
212
+ axes_pins [index],
213
213
filter_total
214
214
),
215
215
calibration_data.min [index],
@@ -221,7 +221,7 @@ int axisRead(int index, int filter_total, int option = CURVE)
221
221
222
222
int buttonRead (int index)
223
223
{
224
- return !digitalRead (digital_pins [index]);
224
+ return !digitalRead (button_pins [index]);
225
225
}
226
226
227
227
// ===========================================================================
@@ -250,7 +250,7 @@ void setup()
250
250
void loop ()
251
251
{
252
252
// read the buttons
253
- for (int btn = 0 ; btn < (sizeof (digital_pins ) / sizeof (int )); btn++)
253
+ for (int btn = 0 ; btn < (sizeof (button_pins ) / sizeof (int )); btn++)
254
254
joystick.setButton (btn, buttonRead (btn));
255
255
256
256
// read the axes
0 commit comments