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;