From 4b6c9e2c0ff4f6cc54aed9250ef5b22e3c164759 Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Wed, 5 Jul 2023 10:28:51 +0200 Subject: [PATCH] FIXME: cpu/atmega_common: don't assert supported PWM mode This makes iteration over PWM modes in the test easier. --- cpu/atmega_common/periph/pwm.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cpu/atmega_common/periph/pwm.c b/cpu/atmega_common/periph/pwm.c index edf39b477593e..5d859089d2d1a 100644 --- a/cpu/atmega_common/periph/pwm.c +++ b/cpu/atmega_common/periph/pwm.c @@ -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;