From 72048849474c59a70f1148dd41c6f4be9a36a02d Mon Sep 17 00:00:00 2001 From: Kyrylo Yatsenko Date: Tue, 14 Oct 2014 16:35:38 +0300 Subject: [PATCH] Fixes in avr_timer_reconfigure after refactoring Several fixes after fcce7868a2fe2ef028b7f6c1741a12380b82a9cc: - Remove zeroing of mode in which erased mode seleced in avr_timer_write - Fix wrong brackets in ?: in avr_timer_wgm_pwm mode --- simavr/sim/avr_timer.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/simavr/sim/avr_timer.c b/simavr/sim/avr_timer.c index 5ed5745..7d4d715 100644 --- a/simavr/sim/avr_timer.c +++ b/simavr/sim/avr_timer.c @@ -237,8 +237,6 @@ static void avr_timer_reconfigure(avr_timer_t * p) { avr_t * avr = p->io.avr; - avr_timer_wgm_t zero={0}; - p->mode = zero; // cancel everything p->comp[AVR_TIMER_COMPA].comp_cycles = 0; p->comp[AVR_TIMER_COMPB].comp_cycles = 0; @@ -258,8 +256,8 @@ static void avr_timer_reconfigure(avr_timer_t * p) avr_timer_configure(p, p->cs_div_clock, _timer_get_ocr(p, AVR_TIMER_COMPA)); } break; case avr_timer_wgm_pwm: { - uint16_t top = p->mode.top == (avr_timer_wgm_reg_ocra ? - _timer_get_ocr(p, AVR_TIMER_COMPA) : _timer_get_icr(p)); + uint16_t top = (p->mode.top == avr_timer_wgm_reg_ocra) ? + _timer_get_ocr(p, AVR_TIMER_COMPA) : _timer_get_icr(p); avr_timer_configure(p, p->cs_div_clock, top); } break; case avr_timer_wgm_fast_pwm: -- 2.39.5