mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-17 10:52:44 +01:00
python expect hwtimer test included
This commit is contained in:
parent
c80ab019c4
commit
f6e76b8f24
5
projects/test_hwtimer_basic/Jamfile
Normal file
5
projects/test_hwtimer_basic/Jamfile
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
SubDir TOP projects test_hwtimer ;
|
||||||
|
|
||||||
|
Module test_hwtimer : main.c : hwtimer ;
|
||||||
|
|
||||||
|
UseModule test_hwtimer ;
|
29
projects/test_hwtimer_basic/main.c
Normal file
29
projects/test_hwtimer_basic/main.c
Normal file
@ -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.");
|
||||||
|
}
|
17
projects/test_hwtimer_basic/tests/test_hwtimer.py
Executable file
17
projects/test_hwtimer_basic/tests/test_hwtimer.py
Executable file
@ -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!")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user