From: Kyrylo Yatsenko Date: Tue, 14 Oct 2014 13:35:38 +0000 (+0300) Subject: Fixes in avr_timer_reconfigure after refactoring X-Git-Tag: v1.3~67^2~1 X-Git-Url: https://git.htl-mechatronik.at/public/?a=commitdiff_plain;h=72048849474c59a70f1148dd41c6f4be9a36a02d;p=sx%2Fsimavr.git 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 --- 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: