mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/rtos2-utils.git
synced 2025-06-11 02:26:00 +00:00
Fully changed timer to fully use std::function<>
This commit is contained in:
parent
d591560c95
commit
87ef535471
@ -39,6 +39,11 @@
|
|||||||
*/
|
*/
|
||||||
#define STA_RTOS_THREAD_FLAG_TERMINATE ( 1UL << 30 )
|
#define STA_RTOS_THREAD_FLAG_TERMINATE ( 1UL << 30 )
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Request thread start.
|
||||||
|
*/
|
||||||
|
#define STA_RTOS_THREAD_FLAG_START ( 1UL << 29 )
|
||||||
|
|
||||||
|
|
||||||
#define STA_RTOS_THREAD_FLAGS_ERROR_CODE_BITS UINT32_C( 0x0000000F )
|
#define STA_RTOS_THREAD_FLAGS_ERROR_CODE_BITS UINT32_C( 0x0000000F )
|
||||||
#define STA_RTOS_THREAD_FLAGS_ERROR_CODE_EXT_BITS UINT32_C( 0x7FFFFFF0 )
|
#define STA_RTOS_THREAD_FLAGS_ERROR_CODE_EXT_BITS UINT32_C( 0x7FFFFFF0 )
|
||||||
|
@ -28,7 +28,7 @@ namespace sta
|
|||||||
* @param callback The callback function to call upon timer timeout.
|
* @param callback The callback function to call upon timer timeout.
|
||||||
* @param arg The argument to pass to the callback function.
|
* @param arg The argument to pass to the callback function.
|
||||||
*/
|
*/
|
||||||
RtosTimer(void (*callback)(void *arg), void *arg);
|
RtosTimer(std::function<void(void*)>, void *arg);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initializes the timer with a callback that has no effect.
|
* @brief Initializes the timer with a callback that has no effect.
|
||||||
@ -43,7 +43,7 @@ namespace sta
|
|||||||
* @param callback The callback function to call upon timer timeout.
|
* @param callback The callback function to call upon timer timeout.
|
||||||
* @param arg The argument to pass to the callback function.
|
* @param arg The argument to pass to the callback function.
|
||||||
*/
|
*/
|
||||||
void setCallback(void (*callback)(void *arg), void *arg);
|
void setCallback(std::function<void(void*)> callback, void *arg);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Run the timer for a given number of milliseconds.
|
* @brief Run the timer for a given number of milliseconds.
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
|
|
||||||
namespace sta {
|
namespace sta {
|
||||||
RtosTimer::RtosTimer(void (*callback)(void *arg), void *arg)
|
RtosTimer::RtosTimer(std::function<void(void*)> callback, void *arg)
|
||||||
: timer_id_{NULL},
|
: timer_id_{NULL},
|
||||||
timer_attr_{.name="Timer", .attr_bits=osTimerOnce},
|
timer_attr_{.name="Timer", .attr_bits=osTimerOnce},
|
||||||
callback_{callback},
|
callback_{callback},
|
||||||
@ -28,7 +28,7 @@ namespace sta {
|
|||||||
osTimerDelete(timer_id_);
|
osTimerDelete(timer_id_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RtosTimer::setCallback(void (*callback)(void *arg), void *arg)
|
void RtosTimer::setCallback(std::function<void(void*)> callback, void *arg)
|
||||||
{
|
{
|
||||||
callback_ = callback;
|
callback_ = callback;
|
||||||
callbackArg_ = arg;
|
callbackArg_ = arg;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user