#include "zapp_timer.h" static void app_timer_timeout_handler(void* p_context) { // zapp_timer_context* zcontext = (zapp_timer_context*)p_context; ZASSERT(zcontext != NULL); ZASSERT(zcontext->mark = 0xAABBCCDD); if (zcontext->timeout_handler) zcontext->timeout_handler(zcontext->usrcontext); } ret_code_t zapp_timer_create(zapp_timer_context* context, // app_timer_id_t* p_timer_id, app_timer_mode_t mode, app_timer_timeout_handler_t timeout_handler) { context->timeout_handler = timeout_handler; context->mark = 0xAABBCCDD; ret_code_t ret = app_timer_create(p_timer_id, mode, app_timer_timeout_handler); if (ret != NRF_SUCCESS) { return ret; } (*p_timer_id)->p_context = context; return ret; } ret_code_t zapp_timer_start(app_timer_id_t timer_id, uint32_t timeout_ticks, void* p_context) { // zapp_timer_context* zcontext = (zapp_timer_context*)timer_id->p_context; ZASSERT(zcontext != NULL); ZASSERT(zcontext->mark = 0xAABBCCDD); zcontext->usrcontext = p_context; return app_timer_start(timer_id, timeout_ticks, zcontext); }