mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
cpu/kinetis_common: periph/timer, read PIT value before stopping
Reading CVAL after stopping timer seem to return zero. Ref. manual states: "The counter period can be restarted, by first disabling, and then enabling the timer with TCTRLn[TEN]", but does not state whether the reset of CVAL happens on TEN 0->1 transition, or 1->0 transtion. Empirical evidence suggests the latter is the implemented behaviour.
This commit is contained in:
parent
77ca7a50bc
commit
cf5db434e6
@ -149,8 +149,8 @@ int timer_set_absolute(tim_t dev, int channel, unsigned int value)
|
||||
#if TIMER_0_EN
|
||||
|
||||
case TIMER_0:
|
||||
pit_timer_stop(TIMER_0_COUNTER_CH);
|
||||
cu_timer[dev].counter32b = pit_timer_read(dev, TIMER_0_COUNTER_CH);
|
||||
pit_timer_stop(TIMER_0_COUNTER_CH);
|
||||
cu_timer[dev].diff = value - cu_timer[dev].counter32b;
|
||||
TIMER_DEV->CHANNEL[TIMER_0_COUNTER_CH].LDVAL = cu_timer[dev].diff;
|
||||
pit_timer_start(TIMER_0_COUNTER_CH);
|
||||
@ -159,8 +159,8 @@ int timer_set_absolute(tim_t dev, int channel, unsigned int value)
|
||||
#if TIMER_1_EN
|
||||
|
||||
case TIMER_1:
|
||||
pit_timer_stop(TIMER_1_COUNTER_CH);
|
||||
cu_timer[dev].counter32b = pit_timer_read(dev, TIMER_1_COUNTER_CH);
|
||||
pit_timer_stop(TIMER_1_COUNTER_CH);
|
||||
cu_timer[dev].diff = value - cu_timer[dev].counter32b;
|
||||
TIMER_DEV->CHANNEL[TIMER_1_COUNTER_CH].LDVAL = cu_timer[dev].diff;
|
||||
pit_timer_start(TIMER_1_COUNTER_CH);
|
||||
|
Loading…
Reference in New Issue
Block a user