application: add level shifter power control

This commit is contained in:
King Kévin 2021-03-11 11:16:31 +01:00
parent 7ede0c9862
commit 95e727203c
1 changed files with 5 additions and 1 deletions

View File

@ -613,9 +613,13 @@ void main(void)
gpio_set_output_options(GPIO_PORT(SIGNAL_PD_PIN), GPIO_OTYPE_OD, GPIO_OSPEED_2MHZ, GPIO_PIN(SIGNAL_PD_PIN)); // set output as open-drain
gpio_mode_setup(GPIO_PORT(SIGNAL_PD_PIN), GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, GPIO_PIN(SIGNAL_PD_PIN)); // configure pin as output
rcc_periph_clock_enable(GPIO_RCC(SIGNAL_PU_PIN)); // enable clock for port domain
gpio_set(GPIO_PORT(SIGNAL_PU_PIN), GPIO_PIN(SIGNAL_PU_PIN)); // ensure we are not enable pMOS
gpio_set(GPIO_PORT(SIGNAL_PU_PIN), GPIO_PIN(SIGNAL_PU_PIN)); // ensure we are do enable pMOS to pull up the signal
gpio_set_output_options(GPIO_PORT(SIGNAL_PU_PIN), GPIO_OTYPE_OD, GPIO_OSPEED_2MHZ, GPIO_PIN(SIGNAL_PU_PIN)); // set output as open-drain
gpio_mode_setup(GPIO_PORT(SIGNAL_PU_PIN), GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, GPIO_PIN(SIGNAL_PU_PIN)); // configure pin as output
rcc_periph_clock_enable(GPIO_RCC(TARGET_EN)); // enable clock for port domain
gpio_set(GPIO_PORT(TARGET_EN), GPIO_PIN(TARGET_EN)); // ensure we do not enable pMOS to power level shifters
gpio_set_output_options(GPIO_PORT(TARGET_EN), GPIO_OTYPE_OD, GPIO_OSPEED_2MHZ, GPIO_PIN(TARGET_EN)); // set output as open-drain
gpio_mode_setup(GPIO_PORT(TARGET_EN), GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, GPIO_PIN(TARGET_EN)); // configure pin as output
puts("OK\n");
puts("setup analog multiplexer: ");