Skip to content
Snippets Groups Projects
Commit 808b1abd authored by Joakim Nohlgård's avatar Joakim Nohlgård
Browse files

Merge pull request #3623 from gebart/pr/kinetis-timer-stop-fix

cpu/kinetis_common: periph/timer, read PIT value before stopping
parents 35b1a30b cf5db434
No related branches found
No related tags found
No related merge requests found
......@@ -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);
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment