1 /**
2   ******************************************************************************
3   * @file    lib_tmr.h
4   * @author  Application Team
5   * @version V4.4.0
6   * @date    2018-09-27
7   * @brief   Timer library.
8   ******************************************************************************
9   * @attention
10   *
11   ******************************************************************************
12   */
13 #ifndef __LIB_TMR_H
14 #define __LIB_TMR_H
15 
16 #ifdef __cplusplus
17  extern "C" {
18 #endif
19 
20 #include "target.h"
21 
22 typedef struct
23 {
24   uint32_t Period;
25   uint32_t ClockSource;
26   uint32_t EXTGT;
27 } TMR_InitType;
28 //ClockSource
29 #define TMR_CLKSRC_INTERNAL     0
30 #define TMR_CLKSRC_EXTERNAL     TMR_CTRL_EXTCLK
31 //ClockGate
32 #define TMR_EXTGT_DISABLE       0
33 #define TMR_EXTGT_ENABLE        TMR_CTRL_EXTEN
34 
35 /* Private macros ------------------------------------------------------------*/
36 #define  IS_TMR_CLKSRC(__CLKSRC__)  (((__CLKSRC__) == TMR_CLKSRC_INTERNAL) || ((__CLKSRC__) == TMR_CLKSRC_EXTERNAL))
37 
38 #define  IS_TMR_EXTGT(__EXTGT__)  (((__EXTGT__) == TMR_EXTGT_DISABLE) || ((__EXTGT__) == TMR_EXTGT_ENABLE))
39 
40 
41 /* Exported Functions ------------------------------------------------------- */
42 /* Timer Exported Functions Group1:
43                                     (De)Initialization  ----------------------*/
44 void TMR_DeInit(TMR_TypeDef *TMRx);
45 void TMR_Init(TMR_TypeDef *TMRx, TMR_InitType *InitStruct);
46 void TMR_StructInit(TMR_InitType *InitStruct);
47 /* Timer Exported Functions Group2:
48                                     Interrupt (flag) -------------------------*/
49 void TMR_INTConfig(TMR_TypeDef *TMRx, uint32_t NewState);
50 uint8_t TMR_GetINTStatus(TMR_TypeDef *TMRx);
51 void TMR_ClearINTStatus(TMR_TypeDef *TMRx);
52 /* Timer Exported Functions Group3:
53                                     MISC Configuration -----------------------*/
54 void TMR_Cmd(TMR_TypeDef *TMRx, uint32_t NewState);
55 uint32_t TMR_GetCurrentValue(TMR_TypeDef *TMRx);
56 
57 #ifdef __cplusplus
58 }
59 #endif
60 
61 #endif  /* __LIB_TMR_H */
62 
63 /*********************************** END OF FILE ******************************/
64