From 7531d0c678ff3c388d8ca148211ff82c3c3380c1 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Sat, 4 Jun 2016 19:40:58 -0400 Subject: [PATCH] avr: Define timer1 timers and prevent their use as PWM at runtime Instead of commenting out the timer1 pwm definitions, detect them at runtime. Signed-off-by: Kevin O'Connor --- src/avr/gpio.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/avr/gpio.c b/src/avr/gpio.c index 20598dc4..365053a9 100644 --- a/src/avr/gpio.c +++ b/src/avr/gpio.c @@ -56,23 +56,23 @@ static const struct gpio_pwm_info pwm_regs[] PROGMEM = { #if CONFIG_MACH_atmega168 { &OCR0A, &TCCR0A, &TCCR0B, 1<ocr), flags & GP_8BIT }; + if (rega == &TCCR1A) + shutdown("Can not user timer1 for PWM; timer1 is used for timers"); // Setup PWM timer uint8_t flag = irq_save();