mirror of https://github.com/rusefi/bldc.git
Tabs vs spaces and some formatting
This commit is contained in:
parent
0d2610c9bc
commit
c1ad9b2b4f
20
hwconf/hw.c
20
hwconf/hw.c
|
@ -44,8 +44,7 @@ uint8_t hw_id_from_pins(void) {
|
|||
const uint16_t DELAY_MS = 5;
|
||||
uint8_t trits[hw_id_pins_size];
|
||||
uint8_t id = 1u; //Start at 1
|
||||
for (uint8_t i=0; i<hw_id_pins_size; i++)
|
||||
{
|
||||
for (uint8_t i=0; i<hw_id_pins_size; i++) {
|
||||
//Initialize pulldown
|
||||
palSetPadMode(hw_id_ports[i], hw_id_pins[i], PAL_MODE_INPUT_PULLDOWN);
|
||||
|
||||
|
@ -58,24 +57,16 @@ uint8_t hw_id_from_pins(void) {
|
|||
chThdSleepMilliseconds(DELAY_MS);
|
||||
bool pin_set_pullup = (palReadPad(hw_id_ports[i], hw_id_pins[i]));
|
||||
//Now determine the trit state
|
||||
if (!pin_set_pulldown && !pin_set_pullup)
|
||||
{
|
||||
if (!pin_set_pulldown && !pin_set_pullup) {
|
||||
//Tied to GND
|
||||
trits[i] = 1u;
|
||||
|
||||
}
|
||||
else if (pin_set_pulldown && pin_set_pullup)
|
||||
{
|
||||
} else if (pin_set_pulldown && pin_set_pullup) {
|
||||
//Tied to VCC
|
||||
trits[i] = 2u;
|
||||
}
|
||||
else if (!pin_set_pulldown && pin_set_pullup)
|
||||
{
|
||||
} else if (!pin_set_pulldown && pin_set_pullup) {
|
||||
//Floating
|
||||
trits[i] = 0u;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return hw_id_from_uuid();
|
||||
//To satisfy compiler warning
|
||||
trits[i] = 3u;
|
||||
|
@ -83,7 +74,6 @@ uint8_t hw_id_from_pins(void) {
|
|||
id += trits[i] * pow(3, i);
|
||||
palSetPadMode(hw_id_ports[i], hw_id_pins[i], PAL_MODE_INPUT);
|
||||
}
|
||||
|
||||
return id;
|
||||
}
|
||||
#endif //defined(HW_ID_PIN_GPIOS) && defined(HW_ID_PIN_PINS)
|
||||
|
|
Loading…
Reference in New Issue