diff --git a/projects/test_hwtimer_basic/Jamfile b/projects/test_hwtimer_basic/Jamfile new file mode 100644 index 0000000000000000000000000000000000000000..e9f9af9ec8e536b9a43c4ba7879e9286afca5185 --- /dev/null +++ b/projects/test_hwtimer_basic/Jamfile @@ -0,0 +1,5 @@ +SubDir TOP projects test_hwtimer ; + +Module test_hwtimer : main.c : hwtimer ; + +UseModule test_hwtimer ; diff --git a/projects/test_hwtimer_basic/main.c b/projects/test_hwtimer_basic/main.c new file mode 100644 index 0000000000000000000000000000000000000000..8e215d1056c90f5d74160b69d01936c763d1a9c6 --- /dev/null +++ b/projects/test_hwtimer_basic/main.c @@ -0,0 +1,29 @@ +#include <stdio.h> +#include <hwtimer.h> +#include <kernel.h> +#include <board.h> + +void callback(void* ptr) { + puts((char*)ptr); +} + +extern uint32_t hwtimer_now(); + +int main(void) +{ + puts("hwtimer test project."); + + puts("Initializing hwtimer..."); + hwtimer_init(); + + puts("Initializing hwtimer [OK]."); + + +// while (TA0R < 20000); + + hwtimer_set(20000LU, callback, (void*)"callback1"); + hwtimer_set(50000LU, callback, (void*)"callback2"); + hwtimer_set(30000LU, callback, (void*)"callback3"); + + puts("hwtimer set."); +} diff --git a/projects/test_hwtimer_basic/tests/test_hwtimer.py b/projects/test_hwtimer_basic/tests/test_hwtimer.py new file mode 100755 index 0000000000000000000000000000000000000000..261c511bb15a8be00b80a59bab5777a7ec163354 --- /dev/null +++ b/projects/test_hwtimer_basic/tests/test_hwtimer.py @@ -0,0 +1,17 @@ +#!/usr/bin/python + +import pexpect +import os +import subprocess + +child = pexpect.spawn ("board/msba2/tools/bin/pseudoterm %s" % os.environ["PORT"]) + +null = open('/dev/null', 'wb') +subprocess.call(['jam', 'reset'], stdout=null) + +child.expect ('OK\r\n'); +child.expect ('callback1\r\n'); +child.expect ('callback3\r\n'); +child.expect ('callback2\r\n'); +print("Test successful!") +