/** * @file timer.h * @author chipsea * @brief * @version 0.1 * @date 2020-11-30 * @copyright Copyright (c) 2020, CHIPSEA Co., Ltd. * @note */ #ifndef __TIMER_H__ #define __TIMER_H__ #ifdef __cplusplus extern "C" { #endif #include "types.h" #include "cst92f2x.h" #define FREE_TIMER_NUMBER 2 typedef enum{ AP_TIMER_ID_5 = 5, AP_TIMER_ID_6 = 6, }UserTimer_e; enum{ HAL_EVT_TIMER_5 = AP_TIMER_ID_5, HAL_EVT_TIMER_6 = AP_TIMER_ID_6, HAL_EVT_WAKEUP = 0x10, HAL_EVT_SLEEP }; typedef void(*ap_tm_hdl_t)(uint8_t evt); int HalTimerInit(ap_tm_hdl_t callback); int HalTimerDeinit(void); int HalTimerSet(UserTimer_e timeId, uint32_t us); int HalTimerMaskInt(UserTimer_e timeId, bool en); int HalTimerStop(UserTimer_e timeId); __ATTR_SECTION_SRAM__ void HalTimer5IRQHandler(void); __ATTR_SECTION_SRAM__ void HalTimer6IRQHandler(void); extern void SetTimer(AP_TIM_TypeDef *TIMx, int time); extern void set_timer(AP_TIM_TypeDef *TIMx, int time); extern uint32_t ReadCurrentTime(void); extern uint32 ReadLLRemainderTime(void); extern uint32_t read_current_fine_time(void); #ifndef BASE_TIME_UINTS #define BASE_TIME_UNITS (0x3fffff) #endif #ifdef __cplusplus } #endif #endif