Skip to content

Commit

Permalink
FIXME: cpu/atmega_common: don't assert supported PWM mode
Browse files Browse the repository at this point in the history
This makes iteration over PWM modes in the test easier.
  • Loading branch information
maribu committed Sep 18, 2023
1 parent 06be70a commit 4b6c9e2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions cpu/atmega_common/periph/pwm.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,15 @@ static inline void apply_config(pwm_t dev)

uint32_t pwm_init(pwm_t dev, pwm_mode_t mode, uint32_t freq, uint16_t res)
{
(void)mode;
/* only left implemented, max resolution 256 */
assert(dev < PWM_NUMOF && mode == PWM_LEFT && res <= 256);
assert(dev < PWM_NUMOF && res <= 256);
/* resolution != 256 only valid if ch0 not used */
assert(!(res != 256 && pwm_conf[dev].pin_ch[0] != GPIO_UNDEF));

if (mode != PWM_LEFT) {
return 0;
}

/* disable PWM */
#if (defined(TCCR0A) && defined(TCCR0B)) || (defined(TCCR2A) && defined(TCCR2B))
pwm_conf[dev].dev->CRA = 0x00;
Expand Down

0 comments on commit 4b6c9e2

Please sign in to comment.