attenuator: set initial state of outputs to 'low'
otherwise they might be high, which means the latch is permanently enabled.
This commit is contained in:
parent
e8849c28ea
commit
abfceb45f5
|
@ -153,11 +153,14 @@ void attenuator_init(const struct attenuator_cfg *cfg,
|
||||||
for (k = 0; k < ARRAY_SIZE(banks); k++) {
|
for (k = 0; k < ARRAY_SIZE(banks); k++) {
|
||||||
if (!pins[k])
|
if (!pins[k])
|
||||||
continue;
|
continue;
|
||||||
|
printf("GPIO Bank %u: 0x%08lx\n", k, pins[k]);
|
||||||
|
|
||||||
rcc_periph_clock_enable(periph[k]);
|
rcc_periph_clock_enable(periph[k]);
|
||||||
#ifdef STM32F1
|
#ifdef STM32F1
|
||||||
gpio_set_mode(banks[k], GPIO_MODE_OUTPUT_2_MHZ, GPIO_CNF_OUTPUT_PUSHPULL, pins[k]);
|
gpio_set_mode(banks[k], GPIO_MODE_OUTPUT_2_MHZ, GPIO_CNF_OUTPUT_PUSHPULL, pins[k]);
|
||||||
#else
|
#else
|
||||||
gpio_mode_setup(banks[k], GPIO_MODE_OUTPUT, 0, pins[k]);
|
gpio_mode_setup(banks[k], GPIO_MODE_OUTPUT, 0, pins[k]);
|
||||||
#endif
|
#endif
|
||||||
|
gpio_clear(banks[k], pins[k]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue