A31L12x F/W Packages  1.4.0
ABOV Cortex-M0+ Core based MCUs Integrated Driver
A31L12x_hal_rtcc.h
Go to the documentation of this file.
1 /***************************************************************************//****************************************************************************/
34 
35 #ifndef _RTCC_H_
36 #define _RTCC_H_
37 
38 #include "A31L12x.h"
39 #include "A31L12x_hal_aa_types.h"
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45 //******************************************************************************
46 // Constant
47 //******************************************************************************
48 
49 //========== RTCC_CR ========================================
50 
51 //---------- RTCC En/Disable Definition ----------
52 #define RTCC_RTDIS (0x0uL << RTCC_CR_RTEN_Pos)
53 #define RTCC_RTEN (0x1uL << RTCC_CR_RTEN_Pos)
54 
55 //---------- RTCC Interrupt Interval Selection Definition ----------
56 #define RTCC_RTIN_DIS (0x0uL << RTCC_CR_RTIN_Pos)
57 #define RTCC_RTIN_500ms (0x1uL << RTCC_CR_RTIN_Pos)
58 #define RTCC_RTIN_1sec (0x2uL << RTCC_CR_RTIN_Pos)
59 #define RTCC_RTIN_1min (0x3uL << RTCC_CR_RTIN_Pos)
60 #define RTCC_RTIN_1hour (0x4uL << RTCC_CR_RTIN_Pos)
61 #define RTCC_RTIN_1day (0x5uL << RTCC_CR_RTIN_Pos)
62 #define RTCC_RTIN_1month (0x6uL << RTCC_CR_RTIN_Pos)
63 
64 //---------- 12/24-hour System Selection Definition ----------
65 #define RTCC_HS_12hour (0x0uL << RTCC_CR_HS24_Pos)
66 #define RTCC_HS_24hour (0x1uL << RTCC_CR_HS24_Pos)
67 
68 //---------- RTCOUT Selection Definition ----------
69 #define RTCC_RTO_1Hz (0x0uL << RTCC_CR_OUTSEL_Pos)
70 #define RTCC_RTO_32kHz (0x1uL << RTCC_CR_OUTSEL_Pos)
71 
72 //---------- RTCC Alarm Match Operation En/Disable Definition ----------
73 #define RTCC_ALDIS (0x0uL << RTCC_CR_ALEN_Pos)
74 #define RTCC_ALEN (0x1uL << RTCC_CR_ALEN_Pos)
75 
76 //---------- RTCC Alarm Match Interrupt En/Disable Definition ----------
77 #define RTCC_ALIDIS (0x0uL << RTCC_CR_ALIEN_Pos)
78 #define RTCC_ALIEN (0x1uL << RTCC_CR_ALIEN_Pos)
79 
80 //******************************************************************************
81 // Type
82 //******************************************************************************
83 
84 //==============================================================================
85 // Enumeration
86 //==============================================================================
87 
88 typedef enum
89 {
98 
99 typedef enum
100 {
101  RTCC_12HS = 0,
103 } RTCC_HS24_OPT;
104 
105 typedef enum
106 {
110 
111 typedef enum
112 {
120 } RTCC_WEEK_OPT;
121 
122 //==============================================================================
123 // Structure
124 //==============================================================================
125 
127 typedef struct
128 {
129  uint8_t rtccIntIn;
138  uint8_t rtccHS24;
141  uint8_t rtccOutsel;
144 } RTCC_CFG_Type;
145 
146 //******************************************************************************
147 // Macro
148 //******************************************************************************
149 /*-------------------------------------------------------------------------*//*-------------------------------------------------------------------------*/
155 #define RTCC_SetSEC( u32SecData ) (RTCC->SEC = u32SecData)
156 
157 /*-------------------------------------------------------------------------*//*-------------------------------------------------------------------------*/
163 #define RTCC_SetMIN( u32MinData ) (RTCC->MIN = u32MinData)
164 
165 /*-------------------------------------------------------------------------*//*-------------------------------------------------------------------------*/
171 #define RTCC_SetHOUR( u32HourData ) (RTCC->HOUR = u32HourData)
172 
173 /*-------------------------------------------------------------------------*//*-------------------------------------------------------------------------*/
179 #define RTCC_SetDAY( u32DayData ) (RTCC->DAY = u32DayData)
180 
181 /*-------------------------------------------------------------------------*//*-------------------------------------------------------------------------*/
187 #define RTCC_SetWEEK( u32WeekData ) (RTCC->WEEK = u32WeekData)
188 
189 /*-------------------------------------------------------------------------*//*-------------------------------------------------------------------------*/
195 #define RTCC_SetMONTH( u32MonthData ) (RTCC->MONTH = u32MonthData)
196 
197 /*-------------------------------------------------------------------------*//*-------------------------------------------------------------------------*/
203 #define RTCC_SetYEAR( u32YearData ) (RTCC->YEAR = u32YearData)
204 
205 /*-------------------------------------------------------------------------*//*-------------------------------------------------------------------------*/
209 #define RTCC_InInt_GetFg() (RTCC->CR_b.RTIFLAG)
210 
211 /*-------------------------------------------------------------------------*//*-------------------------------------------------------------------------*/
215 #define RTCC_InInt_ClrFg() (RTCC->CR_b.RTIFLAG = 1)
216 
217 /*-------------------------------------------------------------------------*//*-------------------------------------------------------------------------*/
220 /* RTCC Control register */
221 
222 #define RTCC_CR_RTIN_MASK (RTCC_CR_RTIN_Msk)
223 #define RTCC_CR_RTIN_SET( n ) (n << RTCC_CR_RTIN_Pos)
224 
225 #define RTCC_CR_HS24_MASK (RTCC_CR_HS24_Msk)
226 #define RTCC_CR_HS24_SET( n ) (n << RTCC_CR_HS24_Pos)
227 
228 #define RTCC_CR_OUTSEL_MASK (RTCC_CR_OUTSEL_Msk)
229 #define RTCC_CR_OUTSEL_SET( n ) (n << RTCC_CR_OUTSEL_Pos)
230 
231 //******************************************************************************
232 // Function
233 //******************************************************************************
234 
235 HAL_Status_Type HAL_RTCC_Init( void* RTCC_Config );
236 void HAL_RTCC_DeInit( void );
237 
238 void HAL_RTCC_SetRegister( uint32_t );
239 void HAL_RTCC_Cmd( FunctionalState NewState );
240 void HAL_RTCC_RewriteYEAR( uint32_t );
241 void HAL_RTCC_RewriteMONTH( uint32_t );
242 void HAL_RTCC_RewriteWEEK( uint32_t );
243 void HAL_RTCC_RewriteDAY( uint32_t );
244 void HAL_RTCC_RewriteHOUR( uint32_t );
245 void HAL_RTCC_RewriteMIN( uint32_t );
246 void HAL_RTCC_RewriteSEC( uint32_t );
247 
248 #ifdef __cplusplus
249 }
250 #endif
251 
252 #endif /* _RTCC_H_ */
RTCC_WEEK_OPT
Contains the ABOV typedefs for C standard types. It is intended to be used in ISO C conforming develo...
void HAL_RTCC_RewriteMIN(uint32_t)
Rewrite to RTCC MIN Register.
void HAL_RTCC_SetRegister(uint32_t)
Set RTC_CR Registers.
HAL_Status_Type
void HAL_RTCC_DeInit(void)
Close RTCC.
RTCC_INT_INTERVAL_OPT
RTCC_RTCOUT_OPT
void HAL_RTCC_RewriteSEC(uint32_t)
Rewrite to RTCC SEC Register.
void HAL_RTCC_RewriteYEAR(uint32_t)
Rewrite to RTCC YEAR Register.
void HAL_RTCC_Cmd(FunctionalState NewState)
Enable/Disable RTCC Operation.
void HAL_RTCC_RewriteHOUR(uint32_t)
Rewrite to RTCC HOUR Register.
RTCC_HS24_OPT
HAL_Status_Type HAL_RTCC_Init(void *RTCC_Config)
Initialize the RTCC peripheral with the specified parameters.
FunctionalState
void HAL_RTCC_RewriteDAY(uint32_t)
Rewrite to RTCC DAY Register.
void HAL_RTCC_RewriteMONTH(uint32_t)
Rewrite to RTCC MONTH Register.
void HAL_RTCC_RewriteWEEK(uint32_t)
Rewrite to RTCC WEEK Register.