/** * @copyright 2017 Indie Semiconductor. * * This file is proprietary to Indie Semiconductor. * All rights reserved. Reproduction or distribution, in whole * or in part, is forbidden except by express written permission * of Indie Semiconductor. * * @file timer_device.h */ #ifndef CTT_DEVICE_H__ #define CTT_DEVICE_H__ #include #include /* Timer 2 have been used by lin stack ,please don't use !!! */ #define HW_CTT_TIMER_NUM 5U #define HW_TIMER_RELOAD 49535U typedef enum{ CT2 = 0U, CT3 = 1U, CT4 = 2U, CT5 = 3U, CT6 = 4U, }HwCTTId_t; typedef enum{ CTT_CLK_DIV_1 = 0U, CTT_CLK_DIV_2, CTT_CLK_DIV_4, CTT_CLK_DIV_8, CTT_CLK_DIV_16, CTT_CLK_DIV_32, CTT_CLK_DIV_64, CTT_CLK_DIV_128, CTT_CLK_DIV_256, CTT_CLK_DIV_512, CTT_CLK_DIV_1024, CTT_CLK_DIV_2048, CTT_CLK_DIV_4096, }CttTimer_Prescaler_t; typedef enum{ HW_TIMER_MODE = 0U, HW_COUNT_MODE, HW_GATED_TIMER_MODE_WITH_GATE_ACTIVE_LOW, HW_GATED_TIMER_MODE_WITH_GATE_ACTIVE_HIGH, HW_RELOAD_MODE, HW_CAPTURE_MODE, HW_INCREMENTAL_INTERFACE_MODE_ROTATION_DETECTION, HW_INCREMENTAL_INTERFACE_MODE_EDGE_DETECTION, } HwCttTimeMode_t; typedef void (*CttTimeoutCallbackFunc_t)(void); typedef struct{ /* Timer parameters */ uint32_t timeReloadCnt; uint32_t periodCount; HwCttTimeMode_t mode; CttTimeoutCallbackFunc_t handler; } HwCttTimer_t; void CTT2_Init(HwCttTimeMode_t mode, CttTimer_Prescaler_t prescale, uint16_t timeoutTicks); void CTT2_Time_Reload(uint16_t count); void CTT_Disable(HwCTTId_t timerId); //void Time_1ms_callback(void); //void Time_SwitchPhase_callback(void); #endif /* __CTT_DEVICE_H__ */