From 95e727203c6bf72a5134ea132c01a8cb7f7ecfee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?King=20K=C3=A9vin?= Date: Thu, 11 Mar 2021 11:16:31 +0100 Subject: [PATCH] application: add level shifter power control --- application.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/application.c b/application.c index 47a4398..a421197 100644 --- a/application.c +++ b/application.c @@ -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: ");