mdot_rtos
Fork of mbed-rtos by
Diff: rtos/RtosTimer.cpp
- Revision:
- 120:19af2d39a542
- Parent:
- 40:bd07334df5b1
--- a/rtos/RtosTimer.cpp Mon Jul 25 14:12:24 2016 +0100 +++ b/rtos/RtosTimer.cpp Wed Aug 10 16:09:20 2016 +0100 @@ -23,19 +23,21 @@ #include <string.h> +#include "mbed.h" #include "cmsis_os.h" #include "mbed_error.h" namespace rtos { -RtosTimer::RtosTimer(void (*periodic_task)(void const *argument), os_timer_type type, void *argument) { +void RtosTimer::constructor(mbed::Callback<void()> func, os_timer_type type) { #ifdef CMSIS_OS_RTX - _timer.ptimer = periodic_task; + _timer.ptimer = (void (*)(const void *))Callback<void()>::thunk; memset(_timer_data, 0, sizeof(_timer_data)); _timer.timer = _timer_data; #endif - _timer_id = osTimerCreate(&_timer, type, argument); + _function = func; + _timer_id = osTimerCreate(&_timer, type, &_function); } osStatus RtosTimer::start(uint32_t millisec) {