From 860ea0e768907fa430268a50bace15f0a276e7ff Mon Sep 17 00:00:00 2001 From: Thomas Kolb Date: Sun, 1 Oct 2023 20:32:07 +0200 Subject: [PATCH] fan_ctrl_pwm: properly set pin mode to alternate function --- src/fan_ctrl_pwm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/fan_ctrl_pwm.c b/src/fan_ctrl_pwm.c index 30a8d2e..feb23c7 100644 --- a/src/fan_ctrl_pwm.c +++ b/src/fan_ctrl_pwm.c @@ -46,6 +46,7 @@ void fan_ctrl_pwm_enable(void) gpio_set(DCDC_PORT, DCDC_BYPASS_SWITCH_PIN); // Enable PWM output on the PWM GPIO + gpio_mode_setup(FAN_PORT, GPIO_MODE_AF, GPIO_PUPD_NONE, FAN_PWM_PIN); gpio_set_af(FAN_PORT, GPIO_AF0, FAN_PWM_PIN); // start the PWM timer @@ -63,6 +64,7 @@ void fan_ctrl_pwm_disable(void) timer_disable_counter(TIM21); // configure the PWM GPIO as input so the fan runs full speed if powered + gpio_mode_setup(FAN_PORT, GPIO_MODE_INPUT, GPIO_PUPD_NONE, FAN_PWM_PIN); }