From 6774111f771c29a4fe4635dea3cec3b0f6a1c1f2 Mon Sep 17 00:00:00 2001 From: Fabio Utzig Date: Sat, 22 Aug 2015 22:29:07 +0000 Subject: [PATCH] [AVR] PWM driver without callback doesnt enable int git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@8236 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/ports/AVR/pwm_lld.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/os/hal/ports/AVR/pwm_lld.c b/os/hal/ports/AVR/pwm_lld.c index 6e60f4120..bec1559e5 100644 --- a/os/hal/ports/AVR/pwm_lld.c +++ b/os/hal/ports/AVR/pwm_lld.c @@ -366,7 +366,8 @@ void pwm_lld_start(PWMDriver *pwmp) *regs_table[i].tccrb &= ~(1 << CS11); *regs_table[i].tccrb |= (1 << CS12) | (1 << CS10); - *regs_table[i].timsk = (1 << TOIE1); + if (pwmp->config->callback != NULL) + *regs_table[i].timsk = (1 << TOIE1); } } @@ -468,7 +469,7 @@ void pwm_lld_enable_channel(PWMDriver *pwmp, *ocrh = val >> 8; *ocrl = val & 0xFF; *regs_table[i].tifr |= (1 << (channel + 1)); - if (pwmp->config->channels[channel].callback) + if (pwmp->config->channels[channel].callback != NULL) *regs_table[i].timsk |= (1 << (channel + 1)); }