File tree Expand file tree Collapse file tree 2 files changed +17
-13
lines changed Expand file tree Collapse file tree 2 files changed +17
-13
lines changed Original file line number Diff line number Diff line change @@ -273,12 +273,24 @@ bool BraccioClass::expander_init()
273
273
274
274
/* Set all motor status LEDs to red. */
275
275
for (int id = SmartServoClass::MIN_MOTOR_ID; id <= SmartServoClass::MAX_MOTOR_ID; id++) {
276
- setRed (id);
276
+ expander_setRed (id);
277
277
}
278
278
279
279
return true ;
280
280
}
281
281
282
+ void BraccioClass::expander_setGreen (int const i)
283
+ {
284
+ _expander.writePin (i * 2 - 1 , 0 );
285
+ _expander.writePin (i * 2 - 2 , 1 );
286
+ }
287
+
288
+ void BraccioClass::expander_setRed (int const i)
289
+ {
290
+ _expander.writePin (i * 2 - 1 , 1 );
291
+ _expander.writePin (i * 2 - 2 , 0 );
292
+ }
293
+
282
294
bool BraccioClass::isPingAllowed ()
283
295
{
284
296
mbed::ScopedLock<rtos::Mutex> lock (_motors_connected_mtx);
@@ -305,9 +317,9 @@ void BraccioClass::motorConnectedThreadFunc()
305
317
306
318
for (int id = SmartServoClass::MIN_MOTOR_ID; id <= SmartServoClass::MAX_MOTOR_ID; id++) {
307
319
if (connected (id))
308
- setGreen (id);
320
+ expander_setGreen (id);
309
321
else
310
- setRed (id);
322
+ expander_setRed (id);
311
323
}
312
324
}
313
325
delay (1000 );
Original file line number Diff line number Diff line change @@ -97,6 +97,8 @@ class BraccioClass
97
97
PD_UFP_log_c PD_UFP;
98
98
TCA6424A _expander;
99
99
bool expander_init ();
100
+ void expander_setGreen (int const i);
101
+ void expander_setRed (int const i);
100
102
101
103
bool _is_ping_allowed;
102
104
bool _is_motor_connected[SmartServoClass::NUM_MOTORS];
@@ -150,16 +152,6 @@ class BraccioClass
150
152
pd_events.set (1 );
151
153
}
152
154
153
- void setGreen (int i) {
154
- _expander.writePin (i * 2 - 1 , 0 );
155
- _expander.writePin (i * 2 - 2 , 1 );
156
- }
157
-
158
- void setRed (int i) {
159
- _expander.writePin (i * 2 - 1 , 1 );
160
- _expander.writePin (i * 2 - 2 , 0 );
161
- }
162
-
163
155
void pd_thread ();
164
156
};
165
157
You can’t perform that action at this time.
0 commit comments