Skip to content

Commit

Permalink
Merge pull request #3623 from gebart/pr/kinetis-timer-stop-fix
Browse files Browse the repository at this point in the history
cpu/kinetis_common: periph/timer, read PIT value before stopping
  • Loading branch information
Joakim Nohlgård committed Sep 21, 2015
2 parents 35b1a30 + cf5db43 commit 808b1ab
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cpu/kinetis_common/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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_BASE->CHANNEL[TIMER_0_COUNTER_CH].LDVAL = cu_timer[dev].diff;
pit_timer_start(TIMER_0_COUNTER_CH);
Expand All @@ -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_BASE->CHANNEL[TIMER_1_COUNTER_CH].LDVAL = cu_timer[dev].diff;
pit_timer_start(TIMER_1_COUNTER_CH);
Expand Down

0 comments on commit 808b1ab

Please sign in to comment.