A31G11x F/W Packages  2.5.0
ABOV Cortex-M0+ Core based MCUs Integrated Driver
A31G11x_hal_timer1n.h
Go to the documentation of this file.
1 /***************************************************************************//****************************************************************************/
34 
35 #ifndef _TIMER1n_H_
36 #define _TIMER1n_H_
37 
38 #include "A31G11x.h"
39 #include "A31G11x_hal_aa_types.h"
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45 //******************************************************************************
46 // Constant
47 //******************************************************************************
48 
49 //---------- TIMER1n Enable/Disable Definition ----------
50 #define TIMER1n_DISABLE (0x0uL << 15)
51 #define TIMER1n_ENABLE (0x1uL << 15)
52 
53 //---------- TIMER1n Clock Selection Definition ----------
54 #define TIMER1n_CLKINT (0x0uL << 14)
55 #define TIMER1n_CLKEXT (0x1uL << 14)
56 
57 //---------- TIMER1n Mode Selection Definition ----------
58 #define TIMER1n_CNTM (0x0uL << 12)
59 #define TIMER1n_CAPM (0x1uL << 12)
60 #define TIMER1n_PPGONEM (0x2uL << 12)
61 #define TIMER1n_PPGREM (0x3uL << 12)
62 
63 //---------- TIMER1n External Clock Edge Selection Definition ----------
64 #define TIMER1n_FEDGE (0x0uL << 11)
65 #define TIMER1n_REDGE (0x1uL << 11)
66 
67 //---------- TIMER1n OUT Polarity Selection Definition ----------
68 #define TIMER1n_STHIGH (0x0uL << 8)
69 #define TIMER1n_STLOW (0x1uL << 8)
70 
71 //---------- TIMER1n Capture Polarity Selection Definition ----------
72 #define TIMER1n_CAPFALL (0x0uL << 6)
73 #define TIMER1n_CAPRISE (0x1uL << 6)
74 #define TIMER1n_CAPBOTH (0x2uL << 6)
75 
76 //---------- TIMER1n Match Interrupt Definition ----------
77 #define TIMER1n_MATINTEN (0x1uL << 5)
78 #define TIMER1n_MATINTDIS (0x0uL << 5)
79 
80 //---------- TIMER1n Capture Interrupt Definition ----------
81 #define TIMER1n_CAPINTEN (0x1uL << 4)
82 #define TIMER1n_CAPINTDIS (0x0uL << 4)
83 
84 #define TIMER1n_PRS_MASK 0x0FFF
85 
86 //******************************************************************************
87 // Type
88 //******************************************************************************
89 
90 //==============================================================================
91 // Enumeration
92 //==============================================================================
93 
95 typedef enum
96 {
100 
101 typedef enum
102 {
108 
109 typedef enum
110 {
116 
118 typedef enum
119 {
123 
125 typedef enum
126 {
130 
131 //==============================================================================
132 // Structure
133 //==============================================================================
134 
136 typedef struct
137 {
138  uint16_t ADR;
139  uint16_t BDR;
140  uint16_t Prescaler;
141  uint8_t StartLevel;
144  uint8_t CkSel;
147  uint8_t ECE;
149 
151 typedef struct
152 {
153  uint16_t ADR;
154  uint16_t BDR;
155  uint16_t Prescaler;
156  uint8_t StartLevel;
159  uint8_t CkSel;
162  uint8_t ECE;
164 
166 typedef struct
167 {
168  uint16_t ADR;
169  uint16_t Prescaler;
170  uint8_t ClrMode;
171  uint8_t CkSel;
172  uint8_t ECE;
174 
175 //******************************************************************************
176 // Macro
177 //******************************************************************************
178 
179 /*-------------------------------------------------------------------------*//*-------------------------------------------------------------------------*/
185 #define TIMER1n_EN( TIMER1x ) (TIMER1x->CR_b.T1nEN = 1)
186 #define TIMER1n_DIS( TIMER1x ) (TIMER1x->CR_b.T1nEN = 0)
187 
188 /*-------------------------------------------------------------------------*//*-------------------------------------------------------------------------*/
194 #define TIMER1n_ConCnt( TIMER1x ) (TIMER1x->CR_b.T1nPAU = 0)
195 #define TIMER1n_TempPau( TIMER1x ) (TIMER1x->CR_b.T1nPAU = 1)
196 
197 /*-------------------------------------------------------------------------*//*-------------------------------------------------------------------------*/
203 #define TIMER1n_ClrCnt( TIMER1x ) (TIMER1x->CR_b.T1nCLR = 1)
204 
205 /*-------------------------------------------------------------------------*//*-------------------------------------------------------------------------*/
211 #define TIMER1n_GetCnt( TIMER1x ) (TIMER1x->CNT)
212 
213 /*-------------------------------------------------------------------------*//*-------------------------------------------------------------------------*/
221 #define TIMER1n_SetAData( TIMER1x, u32AData ) (TIMER1x->ADR = u32AData)
222 
223 /*-------------------------------------------------------------------------*//*-------------------------------------------------------------------------*/
231 #define TIMER1n_SetBData( TIMER1x, u32BData ) (TIMER1x->BDR = u32BData)
232 
233 /*-------------------------------------------------------------------------*//*-------------------------------------------------------------------------*/
239 #define TIMER1n_GetCapData( TIMER1x ) (TIMER1x->CAPDR)
240 
241 /*-------------------------------------------------------------------------*//*-------------------------------------------------------------------------*/
247 #define T1nMaInt_GetFg( TIMER1x ) (TIMER1x->CR_b.T1nMIFLAG)
248 
249 /*-------------------------------------------------------------------------*//*-------------------------------------------------------------------------*/
255 #define T1nMaInt_ClrFg( TIMER1x ) (TIMER1x->CR_b.T1nMIFLAG = 1)
256 
257 /*-------------------------------------------------------------------------*//*-------------------------------------------------------------------------*/
263 #define T1nCapInt_GetFg( TIMER1x ) (TIMER1x->CR_b.T1nCIFLAG)
264 
265 /*-------------------------------------------------------------------------*//*-------------------------------------------------------------------------*/
271 #define T1nCapInt_ClrFg( TIMER1x ) (TIMER1x->CR_b.T1nCIFLAG = 1)
272 
273 /*-------------------------------------------------------------------------*//*-------------------------------------------------------------------------*/
276 /* Timer n Control register */
277 #define TIMER1n_CR_CKSEL_MASK (TIMER1n_CR_T1nCLK_Msk)
278 #define TIMER1n_CR_CKSEL_SET( n ) (n << TIMER1n_CR_T1nCLK_Pos)
279 
280 #define TIMER1n_CR_MODE_MASK (TIMER1n_CR_T1nMS_Msk)
281 #define TIMER1n_CR_MODE_SET( n ) (n << TIMER1n_CR_T1nMS_Pos)
282 
283 #define TIMER1n_CR_ECE_MASK (TIMER1n_CR_T1nECE_Msk)
284 #define TIMER1n_CR_ECE_SET( n ) (n << TIMER1n_CR_T1nECE_Pos)
285 
286 #define TIMER1n_CR_STARTLVL_MASK (TIMER1n_CR_T1nOPOL_Msk)
287 #define TIMER1n_CR_STARTLVL_SET( n ) (n << TIMER1n_CR_T1nOPOL_Pos)
288 
289 #define TIMER1n_CR_CPOL_MASK (TIMER1n_CR_T1nCPOL_Msk)
290 #define TIMER1n_CR_CPOL_SET( n ) (n << TIMER1n_CR_T1nCPOL_Pos)
291 
292 //******************************************************************************
293 // Function
294 //******************************************************************************
295 
296 HAL_Status_Type HAL_TIMER1n_Init( TIMER1n_Type* TIMER1x, TIMER1n_MODE_OPT TimerCounterMode, void* TIMER1n_Config );
297 HAL_Status_Type HAL_TIMER1n_DeInit( TIMER1n_Type* TIMER1x );
298 
299 HAL_Status_Type HAL_TIMER1n_ConfigInterrupt( TIMER1n_Type* TIMER1x, TIMER1n_INT_Type TIMER1n_IntCfg, FunctionalState NewState );
300 HAL_Status_Type HAL_TIMER1n_Cmd( TIMER1n_Type* TIMER1x, FunctionalState NewState );
301 HAL_Status_Type HAL_TIMER1n_SetRegister( TIMER1n_Type* TIMER1x, uint32_t u32T1nSet, uint32_t u32T1nClk );
302 
303 #ifdef __cplusplus
304 }
305 #endif
306 
307 #endif /* _TIMER1n_H_ */
308 
HAL_Status_Type
HAL_Status_Type HAL_TIMER1n_Init(TIMER1n_Type *TIMER1x, TIMER1n_MODE_OPT TimerCounterMode, void *TIMER1n_Config)
Initialize the TIMER1n peripheral with the specified parameters.
TIMER1n_CLR_MODE_OPT
Contains the ABOV typedefs for C standard types. It is intended to be used in ISO C conforming develo...
HAL_Status_Type HAL_TIMER1n_DeInit(TIMER1n_Type *TIMER1x)
Close Timer/Counter device.
TIMER1n_STARTLVL_OPT
TIMER1n_CKSEL_MODE_OPT
HAL_Status_Type HAL_TIMER1n_Cmd(TIMER1n_Type *TIMER1x, FunctionalState NewState)
Start/Stop Timer/Counter device.
FunctionalState
HAL_Status_Type HAL_TIMER1n_ConfigInterrupt(TIMER1n_Type *TIMER1x, TIMER1n_INT_Type TIMER1n_IntCfg, FunctionalState NewState)
Configure the peripheral interrupt.
struct TIMER1n_PWMCFG_Type TIMER1n_ONESHOTCFG_Type
TIMER1n_INT_Type
HAL_Status_Type HAL_TIMER1n_SetRegister(TIMER1n_Type *TIMER1x, uint32_t u32T1nSet, uint32_t u32T1nClk)
Set TIMER1n CR/PREDR Registers.
TIMER1n_MODE_OPT