Skip to content

Commit

Permalink
Fixed some typos in new timer API. Ref. issue #18.
Browse files Browse the repository at this point in the history
  • Loading branch information
terjeio committed Oct 14, 2024
1 parent 8ccfaa0 commit 8e49217
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Src/driver_spindles.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ inline static void spindle1_on (spindle_ptrs_t *spindle)
inline static void spindle1_dir (bool ccw)
{
#ifdef SPINDLE1_DIRECTION_PIN
DIGITAL_OUT(SPINDLE_DIRECTION_PORT, SPINDLE_DIRECTION_BIT, ccw ^ spindle_config->cfg.invert.ccw);
DIGITAL_OUT(SPINDLE1_DIRECTION_PORT, SPINDLE1_DIRECTION_BIT, ccw ^ spindle_config->cfg.invert.ccw);
#else
UNUSED(ccw);
#endif
Expand All @@ -294,7 +294,7 @@ inline static void spindle1_dir (bool ccw)
// Start or stop spindle
static void spindle1SetState (spindle_ptrs_t *spindle, spindle_state_t state, float rpm)
{
if (!state.on)
if (!state.on || rpm == 0.0f)
spindle1_off();
else {
spindle1_dir(state.ccw);
Expand Down
2 changes: 1 addition & 1 deletion Src/pwm.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ bool pwm_is_available (GPIO_TypeDef *port, uint8_t pin)
return pwm->ccr != pwm_claimed[i].ccr;
} while(i);

return !timer_is_claimed(pwm->timer);
return pwm && !timer_is_claimed(pwm->timer);
}

const pwm_signal_t *pwm_claim (GPIO_TypeDef *port, uint8_t pin)
Expand Down
2 changes: 1 addition & 1 deletion Src/timers.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ uint32_t timer_clk_enable (TIM_TypeDef *timer)
__HAL_RCC_TIM13_CLK_ENABLE();
break;
#endif
#ifdef TIM7
#ifdef TIM14
case (uint32_t)TIM14:
__HAL_RCC_TIM14_CLK_ENABLE();
break;
Expand Down

0 comments on commit 8e49217

Please sign in to comment.