MG32L003 Standard Peripherals Firmware Library
Data Structures | Macros | Functions
mg32l003_rtc.h File Reference

This file contains all the functions prototypes for the RTC firmware library. More...

#include "mg32l003.h"

Go to the source code of this file.

Data Structures

struct  RTC_TimeTypeDef
 RTC Time structure definition. More...
 
struct  RTC_DateTypeDef
 RTC Date structure definition. More...
 
struct  RTC_AlarmEnableTypeDef
 RTC ALARM Enable structure definition. More...
 
struct  RTC_AlarmTypeDef
 RTC Alarm structure definition. More...
 
struct  RTC_InitTypeDef
 RTC Init structures definition. More...
 
struct  RTC_HandleTypeDef
 Time Handle Structure definition. More...
 

Macros

#define RTC_HOURFORMAT_24   RTC_CR_FMT
 
#define RTC_HOURFORMAT_12   0x00000000U
 
#define IS_RTC_HOUR_FORMAT(FORMAT)
 
#define IS_RTC_HOUR12(HOUR)   (((HOUR) > 0) && ((HOUR) <= 12))
 
#define IS_RTC_HOUR24(HOUR)   ((HOUR) <= 23)
 
#define IS_RTC_MINUTES(MINUTES)   ((MINUTES) <= 59)
 
#define IS_RTC_SECONDS(SECONDS)   ((SECONDS) <= 59)
 
#define RTC_H12_AM   ((uint8_t)0x00)
 
#define RTC_H12_PM   ((uint8_t)0x01)
 
#define IS_RTC_H12(PM)   (((PM) == RTC_H12_AM) || ((PM) == RTC_H12_PM))
 
#define IS_RTC_YEAR(YEAR)   ((YEAR) <= 99)
 
#define RTC_Month_January   ((uint8_t)0x01)
 
#define RTC_Month_February   ((uint8_t)0x02)
 
#define RTC_Month_March   ((uint8_t)0x03)
 
#define RTC_Month_April   ((uint8_t)0x04)
 
#define RTC_Month_May   ((uint8_t)0x05)
 
#define RTC_Month_June   ((uint8_t)0x06)
 
#define RTC_Month_July   ((uint8_t)0x07)
 
#define RTC_Month_August   ((uint8_t)0x08)
 
#define RTC_Month_September   ((uint8_t)0x09)
 
#define RTC_Month_October   ((uint8_t)0x10)
 
#define RTC_Month_November   ((uint8_t)0x11)
 
#define RTC_Month_December   ((uint8_t)0x12)
 
#define IS_RTC_MONTH(MONTH)   (((MONTH) >= 1) && ((MONTH) <= 12))
 
#define IS_RTC_DATE(DATE)   (((DATE) >= 1) && ((DATE) <= 31))
 
#define IS_RTC_CEN(CEN)   ((CEN) <= 1)
 
#define RTC_Weekday_Monday   ((uint8_t)0x00)
 
#define RTC_Weekday_Tuesday   ((uint8_t)0x01)
 
#define RTC_Weekday_Wednesday   ((uint8_t)0x02)
 
#define RTC_Weekday_Thursday   ((uint8_t)0x03)
 
#define RTC_Weekday_Friday   ((uint8_t)0x04)
 
#define RTC_Weekday_Saturday   ((uint8_t)0x05)
 
#define RTC_Weekday_Sunday   ((uint8_t)0x06)
 
#define IS_RTC_WEEKDAY(WEEKDAY)
 
#define RTC_Format_BIN   ((uint32_t)0x000000000)
 
#define RTC_Format_BCD   ((uint32_t)0x000000001)
 
#define IS_RTC_FORMAT(FORMAT)   (((FORMAT) == RTC_Format_BIN) || ((FORMAT) == RTC_Format_BCD))
 
#define RTC_CLOCK_LSE   (0x00UL << RTC_CLKCR_RTCCKSEL_Pos)
 
#define RTC_CLOCK_LSI   (0x01UL << RTC_CLKCR_RTCCKSEL_Pos)
 
#define RTC_CLOCK_HSE   (0x02UL << RTC_CLKCR_RTCCKSEL_Pos)
 
#define IS_RTC_CLK_SOURCE(CLK)
 
#define IS_RTC_HSE_DIV(DIV)   (((DIV) <= 0x7F))
 
#define RTC_IT_ALR2   ((uint32_t)0x00000020)
 
#define RTC_IT_ALR1   ((uint32_t)0x00000010)
 
#define IS_RTC_CONFIG_IT(IT)   (((IT) != (uint32_t)RESET) && (((IT)&0xFFFFFFCF) == (uint32_t)RESET))
 
#define IS_RTC_GET_IT(IT)   (((IT) == RTC_IT_ALR1) || ((IT) == RTC_IT_ALR1))
 
#define IS_RTC_CLEAR_IT(IT)   (((IT) != (uint32_t)RESET) && (((IT)&0xFFFFFFCF) == (uint32_t)RESET))
 
#define RTC_ALARM_1   0x00U
 
#define RTC_ALARM_2   0x01U
 
#define RTC_CLK_SOURCE_LSE   (0x00000000)
 
#define RTC_CLK_SOURCE_LSI   (0x00010000)
 
#define RTC_CLK_SOURCE_HSEDIV   (0x00020000)
 
#define RTC_ALARM2_CLOSE   ((uint8_t)0x00)
 
#define RTC_ALARM2_1S   ((uint8_t)0x01)
 
#define RTC_ALARM2_1P2S   ((uint8_t)0x02)
 
#define RTC_ALARM2_1P4S   ((uint8_t)0x03)
 
#define RTC_ALARM2_1P8S   ((uint8_t)0x04)
 
#define RTC_ALARM2_1P16S   ((uint8_t)0x05)
 
#define RTC_ALARM2_1P32S   ((uint8_t)0x06)
 
#define RTC_ALARM2_1P64S   ((uint8_t)0x07)
 
#define RTC_ALARM2_1P128S   ((uint8_t)0x08)
 
#define RTC_ALARM2_10S   ((uint8_t)0x09)
 
#define RTC_ALARM2_30S   ((uint8_t)0x0A)
 
#define RTC_ALARM2_1M   ((uint8_t)0x0B)
 
#define RTC_ALARM2_30M   ((uint8_t)0x0C)
 
#define RTC_ALARM2_60M   ((uint8_t)0x0D)
 
#define RTC_ALARM2_12H   ((uint8_t)0x0E)
 
#define RTC_ALARM2_24H   ((uint8_t)0x0F)
 
#define IS_RTC_ALARM_2_PERIOD(PERIOD)
 
#define RTC_FLAG_ALR2F   RTC_ISR_ALM2_F /* Alarm 2 flag */
 
#define RTC_FLAG_ALR1F   RTC_ISR_ALM1_F /* Alarm 1 flag */
 
#define RTC_FLAG_RSF   RTC_ISR_RSF /* Registers Synchronized flag */
 
#define RTC_FLAG_WAITF   RTC_ISR_WAITF /* Initialization mode flag */
 
#define RTC_FLAG_WAIT   RTC_ISR_WAIT /* Shift operation pending flag */
 
#define IS_RTC_GET_FLAG(FLAG)
 
#define RTC_CalibPeriod_60sec   ((uint32_t)0x00000000)
 
#define RTC_CalibPeriod_30sec   ((uint32_t)0x00000100)
 
#define RTC_CalibPeriod_15sec   ((uint32_t)0x00000200)
 
#define RTC_CalibPeriod_6sec   ((uint32_t)0x00000300)
 
#define IS_RTC_CALIB_PERIOD(PERIOD)
 
#define IS_RTC_CALIB_MINUS(VALUE)   ((VALUE) <= 0x0000007F)
 

Functions

ErrorStatus RTC_Init (RTC_InitTypeDef *RTC_InitStruct)
 Initializes the RTC registers according to the specified parameters in RTC_InitStruct. More...
 
void RTC_WriteProtectionCmd (FunctionalState NewState)
 Enables or disables the RTC registers write protection. More...
 
ErrorStatus RTC_EnterInitMode (void)
 Enters the RTC Initialization mode. More...
 
void RTC_ExitInitMode (void)
 Exits the RTC Initialization mode. More...
 
ErrorStatus RTC_WaitForSynchro (void)
 Waits until the RTC Time and Date registers (RTC_TR and RTC_DR) are synchronized with RTC APB clock. More...
 
void RTC_BypassShadowCmd (FunctionalState NewState)
 Enables or Disables the Bypass Shadow feature. More...
 
ErrorStatus RTC_SetTime (uint32_t RTC_Format, RTC_TimeTypeDef *RTC_TimeStruct)
 Set the RTC current time. More...
 
void RTC_TimeStructInit (RTC_TimeTypeDef *RTC_TimeStruct)
 Fills each RTC_TimeStruct member with its default value (Time = 00h:00min:00sec). More...
 
void RTC_GetTime (uint32_t RTC_Format, RTC_TimeTypeDef *RTC_TimeStruct)
 Get the RTC current Time. More...
 
ErrorStatus RTC_SetDate (uint32_t RTC_Format, RTC_DateTypeDef *RTC_DateStruct)
 Set the RTC current date. More...
 
void RTC_DateStructInit (RTC_DateTypeDef *RTC_DateStruct)
 Fills each RTC_DateStruct member with its default value (Monday, January 01 xx00). More...
 
void RTC_GetDate (uint32_t RTC_Format, RTC_DateTypeDef *RTC_DateStruct)
 Get the RTC current date. More...
 
void RTC_SetAlarm1 (uint32_t RTC_Format, RTC_AlarmTypeDef *RTC_AlarmStruct)
 Set the specified RTC Alarm1. More...
 
void RTC_AlarmStructInit (RTC_AlarmTypeDef *RTC_AlarmStruct)
 
void RTC_Alarm1Cmd (FunctionalState NewState)
 Enables or disables the specified RTC Alarm. More...
 
void RTC_GetAlarm1 (uint32_t RTC_Format, RTC_AlarmTypeDef *RTC_AlarmStruct)
 Get the RTC Alarm value and masks. More...
 
ErrorStatus RTC_AlarmCmd (uint32_t RTC_Alarm, FunctionalState NewState)
 
void RTC_SetALARM2Period (uint32_t Period)
 Set the specified RTC Alarm2. More...
 
void RTC_1HZ_Config (FunctionalState NewState)
 Deactive the specified 1HZ out. More...
 
void RTC_CalibConfig (uint32_t RTC_CalibPeriod, uint32_t RTC_CalibMinusPulsesValue)
 Configures the Calibration Settings. More...
 
void RTC_ITConfig (uint32_t RTC_IT, FunctionalState NewState)
 Enables or disables the specified RTC interrupts. More...
 
ITStatus RTC_GetITStatus (uint32_t RTC_IT)
 
void RTC_ClearITPendingBit (uint32_t RTC_IT)
 Clears the RTC's interrupt pending bits. More...
 

Detailed Description

This file contains all the functions prototypes for the RTC firmware library.

Author
megawinTech Application Team
Version
V0.0.5
Date
13-August-2024