1 /* 2 * Copyright (C) 2015-2020 Alibaba Group Holding Limited 3 */ 4 #ifndef __APP_SPEC_OSTIMER__ 5 #define __APP_SPEC_OSTIMER__ 6 #include "cmsis_os.h" 7 8 typedef struct{ 9 osTimerId timerid; 10 os_timer_type type; 11 os_ptimer ptimer; 12 uint32_t interval; 13 uint32_t ctx; 14 void *argument; 15 }SPEC_TIMER_CTX_T; 16 17 #define specTimerDef(name, function) \ 18 SPEC_TIMER_CTX_T spec_timer_ctx_##name = \ 19 {NULL, osTimerOnce, function, 0, 0, NULL}; \ 20 osTimerDef(name, app_spec_timer_handler) 21 22 #define specTimer osTimer 23 24 #define specTimerCtx(name) \ 25 &spec_timer_ctx_##name 26 27 void app_spec_timer_handler(void const *para); 28 osStatus app_spec_timer_create (SPEC_TIMER_CTX_T *spec_timer_ctx, const osTimerDef_t *timer_def, os_timer_type type, void *argument); 29 osStatus app_spec_timer_start (SPEC_TIMER_CTX_T *spec_timer_ctx, uint32_t millisec); 30 osStatus app_spec_timer_stop (SPEC_TIMER_CTX_T *spec_timer_ctx); 31 osStatus app_spec_timer_delete (SPEC_TIMER_CTX_T *spec_timer_ctx); 32 33 #endif 34