mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-06-20 23:18:39 +03:00
Initial commit
This commit is contained in:
28
external/CMSIS_5/CMSIS/RTOS/Template/CPP/RtosTimer.cpp
vendored
Normal file
28
external/CMSIS_5/CMSIS/RTOS/Template/CPP/RtosTimer.cpp
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
#include "RtosTimer.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "cmsis_os.h"
|
||||
//#include "error.h"
|
||||
|
||||
namespace rtos {
|
||||
|
||||
RtosTimer::RtosTimer(void (*periodic_task)(void const *argument), os_timer_type type, void *argument) {
|
||||
#ifdef CMSIS_OS_RTX
|
||||
_timer.ptimer = periodic_task;
|
||||
|
||||
memset(_timer_data, 0, sizeof(_timer_data));
|
||||
_timer.timer = _timer_data;
|
||||
#endif
|
||||
_timer_id = osTimerCreate(&_timer, type, argument);
|
||||
}
|
||||
|
||||
osStatus RtosTimer::start(uint32_t millisec) {
|
||||
return osTimerStart(_timer_id, millisec);
|
||||
}
|
||||
|
||||
osStatus RtosTimer::stop(void) {
|
||||
return osTimerStop(_timer_id);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user