c.w
January 25, 2023, 12:42pm
#1
According to the firmware reference it should be possible to setup a periodic kernel:
Following code triggers the callback after 1s (obviously only once).
MsgHandler_Add(APP_TEST_TIMER_MSG_ID, test_timer_msg_cb);
ke_timer_set(APP_TEST_TIMER_MSG_ID, TASK_APP, KE_TIME_IN_SEC(1));
How can I set it up to trigger periodically?
For example, with peripheral timers there is TIMER_FREE_RUN
or TIMER_SHOT_MODE
respectively.
@c.w
The kernel timer can’t do the same job as free run, used by General-purpose system timer.
It needs to restart the kernel timer in the message handler. Like this to do periodic feature.
unsigned int APP_Timer(ke_msg_id_t const msg_id,
void const *param,
ke_task_id_t const dest_id,
ke_task_id_t const src_id)
{
/* Restart timer */
ke_timer_set(APP_TEST_TIMER, TASK_APP, TIMER_2S_SETTING);
Thank you for using our community forum!