#ifndef _BSP_EVENT_H_ #define _BSP_EVENT_H_ #ifdef __cplusplus extern "C" { #endif #include "kit_macro.h" struct _EventItem; typedef void (*EventCall)(struct _EventItem *grp,uint8_t idx); typedef struct { uint32_t tick; uint32_t enable_dly; uint32_t disable_dly; EventCall pre_call; }EventParamArrary; typedef struct _EventItem { uint8_t cnt; uint8_t cur_cnt; bool enable_cond; bool disable_cond; uint32_t flag; // uint32_t *tick_arr; EventParamArrary *param_arr; }EventItem; #define EVENT_STATIC_INIT(_name, _len) \ EventParamArrary _name##_param_array[_len]; \ EventItem _name = \ { \ (_len), \ (0), \ false, \ true, \ 0, \ _name##_param_array, \ } #define EVENT_STATIC_INIT_CCM(_name, _len) \ EventParamArrary _name##_param_array[_len] __attribute__((section (".CCM_RAM"))); \ EventItem _name __attribute__((section (".CCM_RAM"))) = \ { \ (_len), \ (0), \ false, \ true, \ 0, \ _name##_param_array, \ } void bsp_event_poll(EventItem *item, uint16_t base_time); kit_ret_e bsp_event_register(EventItem *item, uint32_t enable_dly, uint32_t disable_dly, EventCall call); #ifdef __cplusplus } #endif #endif