257 #define RTC_TR_RESERVED_MASK ((uint32_t)0x007F7F7F) 258 #define RTC_DR_RESERVED_MASK ((uint32_t)0x00FFFF3F) 259 #define RTC_INIT_MASK ((uint32_t)0xFFFFFFFF) 260 #define RTC_RSF_MASK ((uint32_t)0xFFFFFF5F) 261 #define RTC_FLAGS_MASK ((uint32_t)(RTC_FLAG_TSOVF | RTC_FLAG_TSF | RTC_FLAG_WUTF | \ 262 RTC_FLAG_ALRBF | RTC_FLAG_ALRAF | RTC_FLAG_INITF | \ 263 RTC_FLAG_RSF | RTC_FLAG_INITS | RTC_FLAG_WUTWF | \ 264 RTC_FLAG_ALRBWF | RTC_FLAG_ALRAWF | RTC_FLAG_TAMP1F | \ 265 RTC_FLAG_TAMP2F | RTC_FLAG_TAMP3F | RTC_FLAG_RECALPF | \ 268 #define INITMODE_TIMEOUT ((uint32_t) 0x00002000) 269 #define SYNCHRO_TIMEOUT ((uint32_t) 0x00008000) 270 #define RECALPF_TIMEOUT ((uint32_t) 0x00001000) 271 #define SHPF_TIMEOUT ((uint32_t) 0x00002000) 330 __IO uint32_t wutcounter = 0x00;
331 uint32_t wutwfstatus = 0x00;
346 RTC->TR = (uint32_t)0x00000000;
347 RTC->DR = (uint32_t)0x00002101;
350 RTC->CR &= (uint32_t)0x00000007;
366 RTC->CR &= (uint32_t)0x00000000;
367 RTC->WUTR = (uint32_t)0x0000FFFF;
368 RTC->PRER = (uint32_t)0x007F00FF;
369 RTC->ALRMAR = (uint32_t)0x00000000;
370 RTC->ALRMBR = (uint32_t)0x00000000;
371 RTC->SHIFTR = (uint32_t)0x00000000;
372 RTC->CALR = (uint32_t)0x00000000;
373 RTC->ALRMASSR = (uint32_t)0x00000000;
374 RTC->ALRMBSSR = (uint32_t)0x00000000;
377 RTC->ISR = (uint32_t)0x00000000;
380 RTC->TAFCR = 0x00000000;
508 __IO uint32_t initcounter = 0x00;
510 uint32_t initstatus = 0x00;
575 __IO uint32_t synchrocounter = 0;
577 uint32_t synchrostatus = 0x00;
598 }
while((synchrocounter !=
SYNCHRO_TIMEOUT) && (synchrostatus == 0x00));
743 RTC_TimeStruct->
RTC_H12 = 0x00;
759 RTC_TimeStruct->
RTC_H12 = 0x00;
769 tmpreg = (((uint32_t)(RTC_TimeStruct->
RTC_Hours) << 16) | \
772 ((uint32_t)(RTC_TimeStruct->
RTC_H12) << 16));
779 (((uint32_t)RTC_TimeStruct->
RTC_H12) << 16));
887 tmpreg = (uint32_t)(
RTC->SSR);
938 tmpreg = ((((uint32_t)RTC_DateStruct->
RTC_Year) << 16) | \
939 (((uint32_t)RTC_DateStruct->
RTC_Month) << 8) | \
940 ((uint32_t)RTC_DateStruct->
RTC_Date) | \
1019 uint32_t tmpreg = 0;
1079 uint32_t tmpreg = 0;
1169 RTC->ALRMAR = (uint32_t)tmpreg;
1173 RTC->ALRMBR = (uint32_t)tmpreg;
1220 uint32_t tmpreg = 0;
1229 tmpreg = (uint32_t)(
RTC->ALRMAR);
1233 tmpreg = (uint32_t)(
RTC->ALRMBR);
1251 RTC_AlarmTime.RTC_Hours);
1253 RTC_AlarmTime.RTC_Minutes);
1255 RTC_AlarmTime.RTC_Seconds);
1274 __IO uint32_t alarmcounter = 0x00;
1275 uint32_t alarmstatus = 0x00;
1289 RTC->CR |= (uint32_t)RTC_Alarm;
1296 RTC->CR &= (uint32_t)~RTC_Alarm;
1301 alarmstatus =
RTC->ISR & (RTC_Alarm >> 8);
1305 if ((
RTC->ISR & (RTC_Alarm >> 8)) ==
RESET)
1368 uint32_t tmpreg = 0;
1380 tmpreg = (uint32_t) (uint32_t)(RTC_AlarmSubSecondValue) | (uint32_t)(RTC_AlarmSubSecondMask);
1385 RTC->ALRMASSR = tmpreg;
1390 RTC->ALRMBSSR = tmpreg;
1409 uint32_t tmpreg = 0;
1468 RTC->CR |= (uint32_t)RTC_WakeUpClock;
1492 RTC->WUTR = (uint32_t)RTC_WakeUpCounter;
1517 __IO uint32_t wutcounter = 0x00;
1518 uint32_t wutwfstatus = 0x00;
1605 RTC->CR |= (uint32_t)(RTC_DayLightSaving | RTC_StoreOperation);
1670 RTC->CR |= (uint32_t)(RTC_Output | RTC_OutputPolarity);
1744 RTC->CR |= (uint32_t)RTC_CalibOutput;
1768 uint32_t RTC_SmoothCalibPlusPulses,
1769 uint32_t RTC_SmouthCalibMinusPulsesValue)
1772 uint32_t recalpfcount = 0;
1797 RTC->CALR = (uint32_t)((uint32_t)RTC_SmoothCalibPeriod | (uint32_t)RTC_SmoothCalibPlusPulses | (uint32_t)RTC_SmouthCalibMinusPulsesValue);
1845 uint32_t tmpreg = 0;
1857 tmpreg |= (uint32_t)(RTC_TimeStampEdge |
RTC_CR_TSE);
1861 tmpreg |= (uint32_t)(RTC_TimeStampEdge);
1869 RTC->CR = (uint32_t)tmpreg;
1890 uint32_t tmptime = 0, tmpdate = 0;
1934 return (uint32_t)(
RTC->TSSSR);
1979 RTC->TAFCR &= (uint32_t)((uint32_t)~(RTC_Tamper << 1));
1984 RTC->TAFCR |= (uint32_t)(RTC_Tamper << 1);
2008 RTC->TAFCR |= (uint32_t)RTC_Tamper;
2013 RTC->TAFCR &= (uint32_t)~RTC_Tamper;
2039 RTC->TAFCR |= (uint32_t)RTC_TamperFilter;
2073 RTC->TAFCR |= (uint32_t)RTC_TamperSamplingFreq;
2096 RTC->TAFCR |= (uint32_t)RTC_TamperPrechargeDuration;
2173 __IO uint32_t tmp = 0;
2179 tmp += (RTC_BKP_DR * 4);
2182 *(
__IO uint32_t *)tmp = (uint32_t)Data;
2194 __IO uint32_t tmp = 0;
2200 tmp += (RTC_BKP_DR * 4);
2203 return (*(
__IO uint32_t *)tmp);
2238 RTC->TAFCR |= (uint32_t)(RTC_OutputType);
2273 uint32_t shpfcount = 0;
2300 RTC->SHIFTR = (uint32_t)(uint32_t)(RTC_ShiftSubFS) | (uint32_t)(RTC_ShiftAdd1S);
2439 uint32_t tmpreg = 0;
2448 if ((tmpreg & RTC_FLAG) != (uint32_t)
RESET)
2499 uint32_t tmpreg = 0, enablestatus = 0;
2508 enablestatus = (uint32_t)((
RTC->CR & RTC_IT) | (tmpreg & ((RTC_IT >> (RTC_IT >> 18)) >> 15)));
2511 tmpreg = (uint32_t)((
RTC->ISR & (uint32_t)(RTC_IT >> 4)));
2514 if ((enablestatus != (uint32_t)
RESET) && ((tmpreg & 0x0000FFFF) != (uint32_t)
RESET))
2540 uint32_t tmpreg = 0;
2546 tmpreg = (uint32_t)(RTC_IT >> 4);
2563 uint8_t bcdhigh = 0;
2571 return ((uint8_t)(bcdhigh << 4) | Value);
2582 tmp = ((uint8_t)(Value & (uint8_t)0xF0) >> (uint8_t)0x4) * 10;
2583 return (tmp + (Value & (uint8_t)0x0F));
ErrorStatus RTC_Init(RTC_InitTypeDef *RTC_InitStruct)
Initializes the RTC registers according to the specified parameters in RTC_InitStruct.
ErrorStatus RTC_SetTime(uint32_t RTC_Format, RTC_TimeTypeDef *RTC_TimeStruct)
Set the RTC current time.
#define IS_RTC_TAMPER_TRIGGER(TRIGGER)
#define IS_RTC_CONFIG_IT(IT)
#define IS_RTC_WAKEUP_COUNTER(COUNTER)
ErrorStatus RTC_RefClockCmd(FunctionalState NewState)
Enables or disables the RTC reference clock detection.
#define IS_RTC_CLEAR_IT(IT)
#define IS_RTC_SYNCH_PREDIV(PREDIV)
#define IS_RTC_GET_FLAG(FLAG)
ErrorStatus RTC_WakeUpCmd(FunctionalState NewState)
Enables or Disables the RTC WakeUp timer.
#define IS_RTC_SHIFT_SUBFS(FS)
ErrorStatus RTC_WaitForSynchro(void)
Waits until the RTC Time and Date registers (RTC_TR and RTC_DR) are synchronized with RTC APB clock...
#define IS_RTC_TAMPER(TAMPER)
void RTC_TimeStructInit(RTC_TimeTypeDef *RTC_TimeStruct)
Fills each RTC_TimeStruct member with its default value (Time = 00h:00min:00sec). ...
void RTC_TimeStampCmd(uint32_t RTC_TimeStampEdge, FunctionalState NewState)
Enables or Disables the RTC TimeStamp functionality with the specified time stamp pin stimulating edg...
#define IS_RTC_DATE(DATE)
ErrorStatus RTC_SmoothCalibConfig(uint32_t RTC_SmoothCalibPeriod, uint32_t RTC_SmoothCalibPlusPulses, uint32_t RTC_SmouthCalibMinusPulsesValue)
Configures the Smooth Calibration Settings.
#define RTC_TAFCR_TAMPPRCH
void RTC_CalibOutputCmd(FunctionalState NewState)
Enables or disables the RTC clock to be output through the relative pin.
void RTC_TamperCmd(uint32_t RTC_Tamper, FunctionalState NewState)
Enables or Disables the Tamper detection.
#define IS_RTC_YEAR(YEAR)
uint8_t RTC_AlarmDateWeekDay
static uint8_t RTC_ByteToBcd2(uint8_t Value)
Converts a 2 digit decimal to BCD format.
void RTC_ITConfig(uint32_t RTC_IT, FunctionalState NewState)
Enables or disables the specified RTC interrupts.
uint32_t RTC_AlarmDateWeekDaySel
RTC Init structures definition.
ITStatus RTC_GetITStatus(uint32_t RTC_IT)
Checks whether the specified RTC interrupt has occurred or not.
#define IS_RTC_SMOOTH_CALIB_PLUS(PLUS)
#define RTC_TamperTrigger_RisingEdge
ErrorStatus RTC_SetDate(uint32_t RTC_Format, RTC_DateTypeDef *RTC_DateStruct)
Set the RTC current date.
#define IS_RTC_ALARM_SUB_SECOND_MASK(MASK)
void RTC_GetTimeStamp(uint32_t RTC_Format, RTC_TimeTypeDef *RTC_StampTimeStruct, RTC_DateTypeDef *RTC_StampDateStruct)
Gets the RTC TimeStamp value and masks.
#define IS_RTC_GET_IT(IT)
#define IS_RTC_SMOOTH_CALIB_MINUS(VALUE)
#define IS_RTC_OUTPUT_POL(POL)
void assert_param(int val)
static uint8_t RTC_Bcd2ToByte(uint8_t Value)
Convert from 2 digit BCD to Binary.
void RTC_ClearITPendingBit(uint32_t RTC_IT)
Clears the RTC's interrupt pending bits.
ErrorStatus RTC_AlarmCmd(uint32_t RTC_Alarm, FunctionalState NewState)
Enables or disables the specified RTC Alarm.
#define IS_FUNCTIONAL_STATE(STATE)
#define IS_RTC_CLEAR_FLAG(FLAG)
ErrorStatus RTC_EnterInitMode(void)
Enters the RTC Initialization mode.
ErrorStatus RTC_SynchroShiftConfig(uint32_t RTC_ShiftAdd1S, uint32_t RTC_ShiftSubFS)
Configures the Synchronization Shift Control Settings.
static volatile uint8_t * status
#define RTC_Month_January
RTC_TimeTypeDef RTC_AlarmTime
#define IS_RTC_OUTPUT(OUTPUT)
void RTC_TamperFilterConfig(uint32_t RTC_TamperFilter)
Configures the Tampers Filter.
void RTC_CalibOutputConfig(uint32_t RTC_CalibOutput)
Configures the Calibration Pinout (RTC_CALIB) Selection (1Hz or 512Hz).
uint32_t RTC_GetWakeUpCounter(void)
Returns the RTC WakeUp timer counter value.
This file contains all the functions prototypes for the RCC firmware library.
uint32_t RTC_GetSubSecond(void)
Gets the RTC current Calendar Subseconds value.
RTC Date structure definition.
#define RTC_TAFCR_TAMPFLT
void RTC_DateStructInit(RTC_DateTypeDef *RTC_DateStruct)
Fills each RTC_DateStruct member with its default value (Monday, January 01 xx00).
#define IS_RTC_HOUR24(HOUR)
This file contains all the functions prototypes for the RTC firmware library.
void RTC_GetAlarm(uint32_t RTC_Format, uint32_t RTC_Alarm, RTC_AlarmTypeDef *RTC_AlarmStruct)
Get the RTC Alarm value and masks.
void RTC_TamperTriggerConfig(uint32_t RTC_Tamper, uint32_t RTC_TamperTrigger)
Configures the select Tamper pin edge.
#define IS_RTC_SMOOTH_CALIB_PERIOD(PERIOD)
#define RTC_AlarmDateWeekDaySel_Date
uint32_t RTC_ReadBackupRegister(uint32_t RTC_BKP_DR)
Reads data from the specified RTC Backup data Register.
uint32_t RTC_GetStoreOperation(void)
Returns the RTC Day Light Saving stored operation.
#define IS_RTC_ALARM(ALARM)
#define IS_RTC_CALIB_OUTPUT(OUTPUT)
#define IS_RTC_OUTPUT_TYPE(TYPE)
void RTC_StructInit(RTC_InitTypeDef *RTC_InitStruct)
Fills each RTC_InitStruct member with its default value.
#define IS_RTC_ASYNCH_PREDIV(PREDIV)
uint32_t RTC_AsynchPrediv
void RTC_ExitInitMode(void)
Exits the RTC Initialization mode.
#define IS_RTC_TAMPER_SAMPLING_FREQ(FREQ)
#define RTC_DR_RESERVED_MASK
uint32_t RTC_GetTimeStampSubSecond(void)
Gets the RTC timestamp Subseconds value.
#define IS_RTC_TIMESTAMP_EDGE(EDGE)
void RTC_TamperPinsPrechargeDuration(uint32_t RTC_TamperPrechargeDuration)
Configures the Tampers Pins input Precharge Duration.
void RTC_ClearFlag(uint32_t RTC_FLAG)
Clears the RTC's pending flags.
#define IS_RTC_SECONDS(SECONDS)
void RTC_OutputTypeConfig(uint32_t RTC_OutputType)
Configures the RTC Output Pin mode.
#define RTC_AlarmMask_All
#define IS_ALARM_MASK(MASK)
void RTC_WakeUpClockConfig(uint32_t RTC_WakeUpClock)
Configures the RTC Wakeup clock source.
void RTC_TamperSamplingFreqConfig(uint32_t RTC_TamperSamplingFreq)
Configures the Tampers Sampling Frequency.
void RTC_OutputConfig(uint32_t RTC_Output, uint32_t RTC_OutputPolarity)
Configures the RTC output source (AFO_ALARM).
#define IS_RTC_WEEKDAY(WEEKDAY)
#define RTC_TR_RESERVED_MASK
#define IS_RTC_MINUTES(MINUTES)
#define RTC_TAFCR_TAMPFREQ
#define IS_RTC_TAMPER_PRECHARGE_DURATION(DURATION)
#define IS_RTC_ALARM_DATE_WEEKDAY_DATE(DATE)
FlagStatus RTC_GetFlagStatus(uint32_t RTC_FLAG)
Checks whether the specified RTC flag is set or not.
void RTC_GetTime(uint32_t RTC_Format, RTC_TimeTypeDef *RTC_TimeStruct)
Get the RTC current Time.
uint32_t RTC_GetAlarmSubSecond(uint32_t RTC_Alarm)
Gets the RTC Alarm Subseconds value.
#define IS_RTC_TAMPER_FILTER(FILTER)
#define IS_RTC_ALARM_DATE_WEEKDAY_WEEKDAY(WEEKDAY)
#define IS_RTC_ALARM_DATE_WEEKDAY_SEL(SEL)
RTC Time structure definition.
void RTC_BypassShadowCmd(FunctionalState NewState)
Enables or Disables the Bypass Shadow feature.
#define IS_RTC_SHIFT_ADD1S(SEL)
#define IS_RTC_STORE_OPERATION(OPERATION)
void RTC_SetWakeUpCounter(uint32_t RTC_WakeUpCounter)
Configures the RTC Wakeup counter.
void RTC_WriteBackupRegister(uint32_t RTC_BKP_DR, uint32_t Data)
Writes a data in a specified RTC Backup data register.
#define IS_RTC_CMD_ALARM(ALARM)
void RTC_AlarmSubSecondConfig(uint32_t RTC_Alarm, uint32_t RTC_AlarmSubSecondValue, uint32_t RTC_AlarmSubSecondMask)
Configures the RTC AlarmA/B Subseconds value and mask.
#define RTC_TAFCR_TAMPPUDIS
void RTC_TamperPullUpCmd(FunctionalState NewState)
Enables or Disables the Precharge of Tamper pin.
#define RTC_TAFCR_ALARMOUTTYPE
#define IS_RTC_MONTH(MONTH)
void RTC_SetAlarm(uint32_t RTC_Format, uint32_t RTC_Alarm, RTC_AlarmTypeDef *RTC_AlarmStruct)
Set the specified RTC Alarm.
ErrorStatus RTC_DeInit(void)
Deinitializes the RTC registers to their default reset values.
void RTC_AlarmStructInit(RTC_AlarmTypeDef *RTC_AlarmStruct)
Fills each RTC_AlarmStruct member with its default value (Time = 00h:00mn:00sec / Date = 1st day of t...
#define RTC_Weekday_Monday
void RTC_GetDate(uint32_t RTC_Format, RTC_DateTypeDef *RTC_DateStruct)
Get the RTC current date.
#define IS_RTC_ALARM_SUB_SECOND_VALUE(VALUE)
#define IS_RTC_DAYLIGHT_SAVING(SAVE)
RTC Alarm structure definition.
void RTC_DayLightSavingConfig(uint32_t RTC_DayLightSaving, uint32_t RTC_StoreOperation)
Adds or substract one hour from the current time.
#define IS_RTC_HOUR12(HOUR)
#define RTC_AlarmMask_None
#define IS_RTC_WAKEUP_CLOCK(CLOCK)
void RTC_TimeStampOnTamperDetectionCmd(FunctionalState NewState)
Enables or Disables the TimeStamp on Tamper Detection Event.
void RTC_WriteProtectionCmd(FunctionalState NewState)
Enables or disables the RTC registers write protection.