From de3f8a1ae5b180ca124ade527e39d78b6924ba60 Mon Sep 17 00:00:00 2001 From: Ludwig Ortmann Date: Wed, 22 Jan 2014 20:12:36 +0100 Subject: [PATCH 1/2] improve test_hwtimer usefulness make the delays noticeable for humans use HWTIMER_TICKS macro for platform independency --- tests/test_hwtimer/main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/test_hwtimer/main.c b/tests/test_hwtimer/main.c index 231fe4ec0c..f9e8697f70 100644 --- a/tests/test_hwtimer/main.c +++ b/tests/test_hwtimer/main.c @@ -16,16 +16,16 @@ int main(void) puts("Initializing hwtimer [OK]."); -#define BASE_DELAY 100000UL -#define DELTA_DELAY 10000UL +#define BASE_DELAY (1000UL * 1000UL) +#define DELTA_DELAY (100UL * 1000UL) #define MSGLEN 12 // == strlen("callback %2i") char msg[MSGLEN * ARCH_MAXTIMERS]; // == [callback 1\0callback 2\0...] - unsigned long delay = BASE_DELAY + (ARCH_MAXTIMERS * DELTA_DELAY); + unsigned long delay = BASE_DELAY + ((ARCH_MAXTIMERS-1) * DELTA_DELAY); /* make the first timer first to fire so timers do not run out linearly */ char *msgn = msg; snprintf(msgn, MSGLEN, "callback %2x", 1); - hwtimer_set(BASE_DELAY, callback, (void*) msgn); + hwtimer_set(HWTIMER_TICKS(BASE_DELAY), callback, (void*) msgn); printf("set %s\n", msgn); /* set up to ARCH_MAXTIMERS-1 because hwtimer_wait below also @@ -34,7 +34,7 @@ int main(void) msgn = msg + (i*MSGLEN); delay -= DELTA_DELAY; snprintf(msgn, MSGLEN, "callback %2x", i+1); - hwtimer_set(delay, callback, (void*) msgn); + hwtimer_set(HWTIMER_TICKS(delay), callback, (void*) msgn); printf("set %s\n", msgn); } From 9d55fde0520140d1b08017f0464fcb475805fcbc Mon Sep 17 00:00:00 2001 From: Ludwig Ortmann Date: Wed, 22 Jan 2014 21:32:09 +0100 Subject: [PATCH 2/2] increase inter-timer delay --- tests/test_hwtimer/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_hwtimer/main.c b/tests/test_hwtimer/main.c index f9e8697f70..a61ec303db 100644 --- a/tests/test_hwtimer/main.c +++ b/tests/test_hwtimer/main.c @@ -17,7 +17,7 @@ int main(void) puts("Initializing hwtimer [OK]."); #define BASE_DELAY (1000UL * 1000UL) -#define DELTA_DELAY (100UL * 1000UL) +#define DELTA_DELAY (1000UL * 1000UL) #define MSGLEN 12 // == strlen("callback %2i") char msg[MSGLEN * ARCH_MAXTIMERS]; // == [callback 1\0callback 2\0...] unsigned long delay = BASE_DELAY + ((ARCH_MAXTIMERS-1) * DELTA_DELAY);