fan_ctrl_pwm: properly set pin mode to alternate function
This commit is contained in:
parent
fd1b4990e2
commit
860ea0e768
|
@ -46,6 +46,7 @@ void fan_ctrl_pwm_enable(void)
|
||||||
gpio_set(DCDC_PORT, DCDC_BYPASS_SWITCH_PIN);
|
gpio_set(DCDC_PORT, DCDC_BYPASS_SWITCH_PIN);
|
||||||
|
|
||||||
// Enable PWM output on the PWM GPIO
|
// 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);
|
gpio_set_af(FAN_PORT, GPIO_AF0, FAN_PWM_PIN);
|
||||||
|
|
||||||
// start the PWM timer
|
// start the PWM timer
|
||||||
|
@ -63,6 +64,7 @@ void fan_ctrl_pwm_disable(void)
|
||||||
timer_disable_counter(TIM21);
|
timer_disable_counter(TIM21);
|
||||||
|
|
||||||
// configure the PWM GPIO as input so the fan runs full speed if powered
|
// 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue