[riot-devel] vtimer_usleep_until or similar

Daniel Amkær Sørensen daniel.amkaer at gmail.com
Tue Oct 21 16:12:16 CEST 2014


Okay, thanks. :-)

Is it better to use the hwtimer for forced periodicity, or is it not meant
for that?

2014-10-21 16:09 GMT+02:00 Martine Lenders <authmillenon at gmail.com>:

> Hi again,
>
> 2014-10-21 16:08 GMT+02:00 Martine Lenders <authmillenon at gmail.com>:
>
>>
>> static char RUN_STACK[KERNEL_CONF_STACKSIZE_DEFAULT];
>>
>> void *run(void *run_args)
>> {
>>     (void)run_args;
>>
>>     while (1) {
>>         function_call(args);
>>
>>         thread_sleep();
>>     }
>>
>>     return NULL;
>> }
>>
>> int main(void)
>> {
>>     vtimer_t timer;
>>     timex_t inc = timex_set(0, utime_increment);
>>     kernel_pid_t pid = thread_create(RUN_STACK,
>>                                      KERNEL_CONF_STACKTEST_DEFAULT,
>>                                      PRIORITY_MAIN - 1,
>>                                      CREATE_SLEEPING | CREATE_STACKTEST,
>>                                      run, NULL, "runner");
>>
>>     while (1) {
>>         vtimer_set_wakeup(&timer, inc, pid);
>>         vtimer_sleep(inc);
>>     }
>> }
>>
> (This code was neither compiled nor tested, so beware ;))
>
> Cheers,
> Martine
>
> _______________________________________________
> devel mailing list
> devel at riot-os.org
> http://lists.riot-os.org/mailman/listinfo/devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/devel/attachments/20141021/ff9058cf/attachment.html>


More information about the devel mailing list