[riot-devel] sample code: swtimer
babel at inf.fu-berlin.de
Sun Jun 2 20:21:56 CEST 2013
On 02.06.2013 20:06, Christian Mehlis wrote:
>> In function `main':
>> main.c:(.text+0x7d): undefined reference to `timex_set'
>> main.c:(.text+0xb9): undefined reference to `vtimer_set_wakeup'
>> collect2: Fehler: ld gab 1 als Ende-Status zurück
>> make: *** [all] Fehler 1
> ok, I added USEMODULE += vtimer to the makefile and now i have a .elf file :)
yes, when ld complains mostly not everything you need was build.
> but I don't have the expected behavior, I want some code called periodically.
> but I get this:
> $ ./bin/hello-world.elf
> RIOT native cpu initialized.
> RIOT native interrupts/signals initialized.
> RIOT native board initialized.
> RIOT native hardware initialization complete.
> kernel_init(): This is RIOT!
> kernel_init(): jumping into first task...
> Das Signal SIGNALRM empfangen (Der Wecker klingelt)
At first please add either the autoinit module or init the timer manual.
To only call the code in function blinker every second remove line 29 to
32 and change blinker to:
To have something more close to your original implementation you could
also delete the thread_create and use the vtimer to call the function
blinker like this:
t1.action = (void*) blinker;
t1.absolute = t_time;
t1.arg = null;
But this will call blinker only once, if you want to recall it you have
to set a new timer in blinker or else may set already 5 timer in your main.
Don't be confused about t1.absolute, vtimer_now() will be added in
You will stay in vtimer callback during your function call, so for
bigger actions I would suggest to create a new thread instead of calling
a function direct.
More information about the devel