diff --git a/src/pwmout.c b/src/pwmout.c --- a/src/pwmout.c +++ b/src/pwmout.c @@ -86,10 +86,19 @@ void pwmout_init(void) // functionality. this is a problem. // also duty cycling isn't working correctly... -void pwmout_process(uint16_t duty) +void pwmout_process(int16_t duty) { + if(duty == 0) + { + HAL_GPIO_WritePin(SSR, 0); + HAL_GPIO_WritePin(LED, 0); + // TODO: Disable timer + } + if(duty < 0) + duty = -duty; - htim17.Instance->CCR1 = duty; + + htim17.Instance->CCR1 = duty; //duty; // HAL_GPIO_TogglePin(SSR_GPIO_Port, SSR_PIN); // uint32_t ssr_output = duty; // meh