Fixes for platform timer code

Some platforms are missing timer channels, this is now left to the
(missing) preprocessor definitions on those platforms, no
platform-specific defines needed anymore.
Also fix usage of timer counter register 3 (hardcoded) in
cpu/avr/dev/clock.c -- this code isn't used on many platforms as it
requires a very special quartz clock frequency but this now also uses
the platform timer specification.
This commit is contained in:
Ralf Schlatterbeck 2014-06-26 18:00:30 +02:00
parent b6be226e69
commit 08abd8807d
3 changed files with 36 additions and 23 deletions

View file

@ -371,13 +371,13 @@ volatile static uint8_t osccalhigh,osccallow;
if (seconds < 60) { //give a minute to stabilize
if(++lockcount >= 8192UL*128/RTIMER_ARCH_SECOND) {
lockcount=0;
rtimer_phase = TCNT3 & 0x0fff;
rtimer_phase = PLAT_TCNT & 0x0fff;
if (seconds < 2) OSCCAL=100;
if (last_phase > rtimer_phase) osccalhigh=++OSCCAL; else osccallow=--OSCCAL;
last_phase = rtimer_phase;
}
} else {
uint8_t error = (TCNT3 - last_phase) & 0x3f;
uint8_t error = (PLAT_TCNT - last_phase) & 0x3f;
if (error == 0) {
} else if (error<32) {
OSCCAL=osccallow-1;