hellen bugfix: all four LEDs should light up on start-up
This commit is contained in:
parent
20cf22665e
commit
9de0c10f24
|
@ -46,19 +46,23 @@ void detectHellenMcuType() {
|
||||||
// check each mcu module type sequentially
|
// check each mcu module type sequentially
|
||||||
for (int mcuType = 0; mcuType < 2; mcuType++) {
|
for (int mcuType = 0; mcuType < 2; mcuType++) {
|
||||||
brain_pin_e ledPin = led1Pins[mcuType];
|
brain_pin_e ledPin = led1Pins[mcuType];
|
||||||
|
ioportid_t port = getBrainPinPort(ledPin);
|
||||||
|
int hwIndex = getBrainPinIndex(ledPin);
|
||||||
// set LED1 pin to output & clear the state (discharge parasitic capacitance)
|
// set LED1 pin to output & clear the state (discharge parasitic capacitance)
|
||||||
palSetPadMode(getBrainPinPort(ledPin), getBrainPinIndex(ledPin), PAL_MODE_OUTPUT_PUSHPULL);
|
palSetPadMode(port, hwIndex, PAL_MODE_OUTPUT_PUSHPULL);
|
||||||
palClearPad(getBrainPinPort(ledPin), getBrainPinIndex(ledPin));
|
palClearPad(port, hwIndex);
|
||||||
// set LED1 pin to input
|
// set LED1 pin to input
|
||||||
palSetPadMode(getBrainPinPort(ledPin), getBrainPinIndex(ledPin), PAL_MODE_INPUT); // todo: currently we don't use PAL_MODE_INPUT_PULLDOWN - needs more testing
|
palSetPadMode(port, hwIndex, PAL_MODE_INPUT); // todo: currently we don't use PAL_MODE_INPUT_PULLDOWN - needs more testing
|
||||||
// wait for the pin state to settle down
|
// wait for the pin state to settle down
|
||||||
chThdSleepMilliseconds(1);
|
chThdSleepMilliseconds(1);
|
||||||
// get the pin states
|
// get the pin states
|
||||||
padState[mcuType] = 1;
|
padState[mcuType] = 1;
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
// we get "1" only if all readings are "1"
|
// we get "1" only if all readings are "1"
|
||||||
padState[mcuType] &= palReadPad(getBrainPinPort(ledPin), getBrainPinIndex(ledPin));
|
padState[mcuType] &= palReadPad(port, hwIndex);
|
||||||
}
|
}
|
||||||
|
// back to output mode
|
||||||
|
palSetPadMode(port, hwIndex, PAL_MODE_OUTPUT_PUSHPULL);
|
||||||
}
|
}
|
||||||
efiPrintf("Hellen board pin states = %d %d", padState[0], padState[1]);
|
efiPrintf("Hellen board pin states = %d %d", padState[0], padState[1]);
|
||||||
if (padState[0] && !padState[1]) {
|
if (padState[0] && !padState[1]) {
|
||||||
|
|
Loading…
Reference in New Issue