MG32L003 Standard Peripherals Firmware Library

函数
RTC_Private_Functions
MG32L003_StdPeriph_Driver » RTC

## 函数
ErrorStatus | RTC_Init (RTC_InitTypeDef *RTC_InitStruct)
| Initializes the RTC registers according to the specified parameters in RTC_InitStruct. 更多...
void | RTC_WriteProtectionCmd (FunctionalState NewState)
| Enables or disables the RTC registers write protection. 更多...
ErrorStatus | RTC_EnterInitMode (void)
| Enters the RTC Initialization mode. 更多...
void | RTC_ExitInitMode (void)
| Exits the RTC Initialization mode. 更多...
ErrorStatus | RTC_WaitForSynchro (void)
| Waits until the RTC Time and Date registers (RTC_TR and RTC_DR) are synchronized with RTC APB clock. 更多...
void | RTC_BypassShadowCmd (FunctionalState NewState)
| Enables or Disables the Bypass Shadow feature. 更多...
ErrorStatus | RTC_SetTime (uint32_t RTC_Format, RTC_TimeTypeDef *RTC_TimeStruct)
| Set the RTC current time. 更多...
void | RTC_TimeStructInit (RTC_TimeTypeDef *RTC_TimeStruct)
| Fills each RTC_TimeStruct member with its default value (Time = 00h:00min:00sec). 更多...
void | RTC_GetTime (uint32_t RTC_Format, RTC_TimeTypeDef *RTC_TimeStruct)
| Get the RTC current Time. 更多...
ErrorStatus | RTC_SetDate (uint32_t RTC_Format, RTC_DateTypeDef *RTC_DateStruct)
| Set the RTC current date. 更多...
void | RTC_DateStructInit (RTC_DateTypeDef *RTC_DateStruct)
| Fills each RTC_DateStruct member with its default value (Monday, January 01 xx00). 更多...
void | RTC_GetDate (uint32_t RTC_Format, RTC_DateTypeDef *RTC_DateStruct)
| Get the RTC current date. 更多...
void | RTC_SetAlarm1 (uint32_t RTC_Format, RTC_AlarmTypeDef *RTC_AlarmStruct)
| Set the specified RTC Alarm1. 更多...
void | RTC_Alarm1StructInit (RTC_AlarmTypeDef *RTC_AlarmStruct)
| Fills each RTC_AlarmStruct member with its default value (Time = 00h:00mn:00sec / Date = 1st day of the month/Mask = all fields are masked). 更多...
void | RTC_GetAlarm1 (uint32_t RTC_Format, RTC_AlarmTypeDef *RTC_AlarmStruct)
| Get the RTC Alarm value and masks. 更多...
void | RTC_Alarm1Cmd (FunctionalState NewState)
| Enables or disables the specified RTC Alarm. 更多...
void | RTC_SetALARM2Period (uint32_t Period)
| Set the specified RTC Alarm2. 更多...
void | RTC_1HZ_Config (FunctionalState NewState)
| Deactive the specified 1HZ out 更多...
void | RTC_CalibConfig (uint32_t RTC_CalibPeriod, uint32_t RTC_CalibMinusPulsesValue)
| Configures the Calibration Settings. 更多...
FlagStatus | RTC_GetFlagStatus (uint32_t RTC_FLAG)
| Checks whether the specified RTC flag is set or not. 更多...
void | RTC_ITConfig (uint32_t RTC_IT, FunctionalState NewState)
| Enables or disables the specified RTC interrupts. 更多...
void | RTC_ClearITPendingBit (uint32_t RTC_IT)
| Clears the RTC's interrupt pending bits. 更多...

## 详细描述

## 函数说明

## ◆ RTC_1HZ_Config()

void RTC_1HZ_Config | ( | FunctionalState | NewState | ) |

Deactive the specified 1HZ out

参数

  NewState | the 1HZ out enable or disable. This parameter can be one of the following values: DISABLE ENABLE

返回值

  None |

## ◆ RTC_Alarm1Cmd()

void RTC_Alarm1Cmd | ( | FunctionalState | NewState | ) |

Enables or disables the specified RTC Alarm.

参数

  NewState | new state of the specified alarm. This parameter can be: ENABLE or DISABLE.

返回值

  None |

## ◆ RTC_Alarm1StructInit()

void RTC_Alarm1StructInit | ( | RTC_AlarmTypeDef * | RTC_AlarmStruct | ) |

Fills each RTC_AlarmStruct member with its default value (Time = 00h:00mn:00sec / Date = 1st day of the month/Mask = all fields are masked).

参数

  RTC_AlarmStruct | pointer to a RTC_AlarmTypeDef structure which will be initialized.

返回值

  None |

## ◆ RTC_BypassShadowCmd()

void RTC_BypassShadowCmd | ( | FunctionalState | NewState | ) |

Enables or Disables the Bypass Shadow feature.

注解
  When the Bypass Shadow is enabled the calendar value are taken directly from the Calendar counter.

参数

  NewState | new state of the Bypass Shadow feature. This parameter can be: ENABLE or DISABLE.

返回值

  None |

## ◆ RTC_CalibConfig()

void RTC_CalibConfig | ( | uint32_t | RTC_CalibPeriod,
|  | uint32_t | RTC_CalibMinusPulsesValue
| ) |  |

Configures the Calibration Settings.

参数

  RTC_CalibPeriod | :
  RTC_CalibMinusPulsesValue |

返回值

  An | ErrorStatus enumeration value: SUCCESS: RTC Calib registers are configured. ERROR: RTC Calib registers are not configured.

## ◆ RTC_ClearITPendingBit()

void RTC_ClearITPendingBit | ( | uint32_t | RTC_IT | ) |

Clears the RTC's interrupt pending bits.

参数

  RTC_IT | specifies the RTC interrupt pending bit to clear. This parameter can be any combination of the following values: RTC_IT_ALR2: Alarm 2 interrupt. RTC_IT_ALR1: Alarm 1 interrupt.

返回值

  None |

## ◆ RTC_DateStructInit()

void RTC_DateStructInit | ( | RTC_DateTypeDef * | RTC_DateStruct | ) |

Fills each RTC_DateStruct member with its default value (Monday, January 01 xx00).

参数

  RTC_DateStruct | pointer to a RTC_DateTypeDef structure which will be initialized.

返回值

  None |

## ◆ RTC_EnterInitMode()

ErrorStatus RTC_EnterInitMode | ( | void |  | ) |

Enters the RTC Initialization mode.

注解
  The RTC Initialization mode is write protected, use the RTC_WriteProtectionCmd(DISABLE) before calling this function.

参数

  None |

返回值

  An | ErrorStatus enumeration value: SUCCESS: RTC is in Init mode. ERROR: RTC is not in Init mode.

## ◆ RTC_ExitInitMode()

void RTC_ExitInitMode | ( | void |  | ) |

Exits the RTC Initialization mode.

注解
  When the initialization sequence is complete, the calendar restarts counting after 4 RTCCLK cycles.
  The RTC Initialization mode is write protected, use the RTC_WriteProtectionCmd(DISABLE) before calling this function.

参数

  None |

返回值

  None |

## ◆ RTC_GetAlarm1()

void RTC_GetAlarm1 | ( | uint32_t | RTC_Format,
|  | RTC_AlarmTypeDef * | RTC_AlarmStruct
| ) |  |

Get the RTC Alarm value and masks.

参数

  RTC_Format | specifies the format of the output parameters. This parameter can be one of the following values: RTC_Format_BIN: Binary data format. RTC_Format_BCD: BCD data format.
  RTC_AlarmStruct | pointer to a RTC_AlarmTypeDef structure that will contains the output alarm configuration values.

返回值

  None |

## ◆ RTC_GetDate()

void RTC_GetDate | ( | uint32_t | RTC_Format,
|  | RTC_DateTypeDef * | RTC_DateStruct
| ) |  |

Get the RTC current date.

参数

  RTC_Format | specifies the format of the returned parameters. This parameter can be one of the following values: RTC_Format_BIN: Binary data format. RTC_Format_BCD: BCD data format.
  RTC_DateStruct | pointer to a RTC_DateTypeDef structure that will contain the returned current date configuration.

返回值

  None |

## ◆ RTC_GetFlagStatus()

FlagStatus RTC_GetFlagStatus | ( | uint32_t | RTC_FLAG | ) |

Checks whether the specified RTC flag is set or not.

参数

  RTC_FLAG | specifies the flag to check. This parameter can be one of the following values: RTC_FLAG_ALR2F: Alarm 2 flag. RTC_FLAG_ALR1F: Alarm 1 flag. RTC_FLAG_RSF: Registers Synchronized flag. RTC_FLAG_WAITF: Initialization mode flag. RTC_FLAG_WAIT: Shift operation pending flag.

返回值

  The | new state of RTC_FLAG (SET or RESET).

## ◆ RTC_GetTime()

void RTC_GetTime | ( | uint32_t | RTC_Format,
|  | RTC_TimeTypeDef * | RTC_TimeStruct
| ) |  |

Get the RTC current Time.

参数

  RTC_Format | specifies the format of the returned parameters. This parameter can be one of the following values: RTC_Format_BIN: Binary data format. RTC_Format_BCD: BCD data format.
  RTC_TimeStruct | pointer to a RTC_TimeTypeDef structure that will contain the returned current time configuration.

返回值

  None |

## ◆ RTC_Init()

ErrorStatus RTC_Init | ( | RTC_InitTypeDef * | RTC_InitStruct | ) |

Initializes the RTC registers according to the specified parameters in RTC_InitStruct.

参数

  RTC_InitStruct | pointer to a RTC_InitTypeDef structure that contains the configuration information for the RTC peripheral.

注解
  The RTC Prescaler register is write protected and can be written in initialization mode only.

返回值

  An | ErrorStatus enumeration value: SUCCESS: RTC registers are initialized. ERROR: RTC registers are not initialized.

## ◆ RTC_ITConfig()

void RTC_ITConfig | ( | uint32_t | RTC_IT,
|  | FunctionalState | NewState
| ) |  |

Enables or disables the specified RTC interrupts.

参数

  RTC_IT | specifies the RTC interrupt sources to be enabled or disabled. This parameter can be any combination of the following values: RTC_IT_ALR2: Alarm 2 interrupt. RTC_IT_ALR1: Alarm 1 interrupt.
  NewState | new state of the specified RTC interrupts. This parameter can be: ENABLE or DISABLE.

返回值

  None |

## ◆ RTC_SetAlarm1()

void RTC_SetAlarm1 | ( | uint32_t | RTC_Format,
|  | RTC_AlarmTypeDef * | RTC_AlarmStruct
| ) |  |

Set the specified RTC Alarm1.

注解
  The Alarm1 register can only be written when the corresponding Alarm is disabled (Use the RTC_AlarmCmd(DISABLE)).

参数

  RTC_Format | specifies the format of the returned parameters. This parameter can be one of the following values: RTC_Format_BIN: Binary data format. RTC_Format_BCD: BCD data format.
  RTC_AlarmStruct | pointer to a RTC_AlarmTypeDef structure that contains the alarm configuration parameters.

返回值

  None |

## ◆ RTC_SetALARM2Period()

void RTC_SetALARM2Period | ( | uint32_t | Period | ) |

Set the specified RTC Alarm2.

参数

  Period | the Alarm2 cycle time set. This parameter can be a value of Definitions

返回值

  None |

## ◆ RTC_SetDate()

ErrorStatus RTC_SetDate | ( | uint32_t | RTC_Format,
|  | RTC_DateTypeDef * | RTC_DateStruct
| ) |  |

Set the RTC current date.

参数

  RTC_Format | specifies the format of the entered parameters. This parameter can be one of the following values: RTC_Format_BIN: Binary data format. RTC_Format_BCD: BCD data format.
  RTC_DateStruct | pointer to a RTC_DateTypeDef structure that contains the date configuration information for the RTC.

返回值

  An | ErrorStatus enumeration value: SUCCESS: RTC Date register is configured. ERROR: RTC Date register is not configured.

## ◆ RTC_SetTime()

ErrorStatus RTC_SetTime | ( | uint32_t | RTC_Format,
|  | RTC_TimeTypeDef * | RTC_TimeStruct
| ) |  |

Set the RTC current time.

参数

  RTC_Format | specifies the format of the entered parameters. This parameter can be one of the following values: RTC_Format_BIN: Binary data format. RTC_Format_BCD: BCD data format.
  RTC_TimeStruct | pointer to a RTC_TimeTypeDef structure that contains the time configuration information for the RTC.

返回值

  An | ErrorStatus enumeration value: SUCCESS: RTC Time register is configured. ERROR: RTC Time register is not configured.

## ◆ RTC_TimeStructInit()

void RTC_TimeStructInit | ( | RTC_TimeTypeDef * | RTC_TimeStruct | ) |

Fills each RTC_TimeStruct member with its default value (Time = 00h:00min:00sec).

参数

  RTC_TimeStruct | pointer to a RTC_TimeTypeDef structure which will be initialized.

返回值

  None |

## ◆ RTC_WaitForSynchro()

ErrorStatus RTC_WaitForSynchro | ( | void |  | ) |

Waits until the RTC Time and Date registers (RTC_TR and RTC_DR) are synchronized with RTC APB clock.

注解
  The RTC Resynchronization mode is write protected, use the RTC_WriteProtectionCmd(DISABLE) before calling this function.

参数

  None |

返回值

  An | ErrorStatus enumeration value: SUCCESS: RTC registers are synchronised. ERROR: RTC registers are not synchronised.

## ◆ RTC_WriteProtectionCmd()

void RTC_WriteProtectionCmd | ( | FunctionalState | NewState | ) |

Enables or disables the RTC registers write protection.

注解
  Writing a wrong key reactivates the write protection.
  The protection mechanism is not affected by system reset.

参数

  NewState | new state of the write protection. This parameter can be: ENABLE or DISABLE.

返回值

  None |