mbed library sources modified for open wear
Dependents: openwear-lifelogger-example
Fork of mbed-src by
Diff: targets/cmsis/TARGET_STM/TARGET_NUCLEO_F401RE/stm32f4xx_hal_rtc_ex.c
- Revision:
- 226:b062af740e40
- Parent:
- 106:ced8cbb51063
diff -r 2af4c5d0160c -r b062af740e40 targets/cmsis/TARGET_STM/TARGET_NUCLEO_F401RE/stm32f4xx_hal_rtc_ex.c --- a/targets/cmsis/TARGET_STM/TARGET_NUCLEO_F401RE/stm32f4xx_hal_rtc_ex.c Wed Jun 11 09:30:07 2014 +0100 +++ b/targets/cmsis/TARGET_STM/TARGET_NUCLEO_F401RE/stm32f4xx_hal_rtc_ex.c Wed Jun 11 09:45:09 2014 +0100 @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f4xx_hal_rtc_ex.c * @author MCD Application Team - * @version V1.0.0 - * @date 18-February-2014 + * @version V1.1.0RC2 + * @date 14-May-2014 * @brief RTC HAL module driver. * This file provides firmware functions to manage the following * functionalities of the Real Time Clock (RTC) Extension peripheral: @@ -26,7 +26,7 @@ ================================ [..] (+) To configure the RTC Wakeup Clock source and Counter use the HAL_RTC_SetWakeUpTimer() - function. You can also configure the RTC Wakeup timer with interrupt mode + function. You can also configure the RTC Wakeup timer in interrupt mode using the HAL_RTC_SetWakeUpTimer_IT() function. (+) To read the RTC WakeUp Counter register, use the HAL_RTC_GetWakeUpTimer() function. @@ -34,7 +34,7 @@ *** TimeStamp configuration *** =============================== [..] - (+) Configure the RTC_AFx trigger and enables the RTC TimeStamp using the + (+) Configure the RTC_AFx trigger and enable the RTC TimeStamp using the HAL_RTC_SetTimeStamp() function. You can also configure the RTC TimeStamp with interrupt mode using the HAL_RTC_SetTimeStamp_IT() function. (+) To read the RTC TimeStamp Time and Date register, use the HAL_RTC_GetTimeStamp() @@ -47,10 +47,10 @@ *** Tamper configuration *** ============================ [..] - (+) Enable the RTC Tamper and Configure the Tamper filter count, trigger Edge + (+) Enable the RTC Tamper and configure the Tamper filter count, trigger Edge or Level according to the Tamper filter (if equal to 0 Edge else Level) value, sampling frequency, precharge or discharge and Pull-UP using the - HAL_RTC_SetTamper() function. You can configure RTC Tamper with interrupt + HAL_RTC_SetTamper() function. You can configure RTC Tamper in interrupt mode using HAL_RTC_SetTamper_IT() function. (+) The TAMPER1 alternate function can be mapped either to RTC_AF1 (PC13) or RTC_AF2 (PI8) depending on the value of TAMP1INSEL bit in @@ -130,7 +130,7 @@ ##### RTC TimeStamp and Tamper functions ##### =============================================================================== - [..] This section provide functions allowing to configure TimeStamp feature + [..] This section provides functions allowing to configure TimeStamp feature @endverbatim * @{ @@ -139,13 +139,14 @@ /** * @brief Sets TimeStamp. * @note This API must be called before enabling the TimeStamp feature. - * @param hrtc: RTC handle + * @param hrtc: pointer to a RTC_HandleTypeDef structure that contains + * the configuration information for RTC. * @param TimeStampEdge: Specifies the pin edge on which the TimeStamp is * activated. - * This parameter can be one of the following: - * @arg TimeStampEdge_Rising: the Time stamp event occurs on the + * This parameter can be one of the following values: + * @arg RTC_TIMESTAMPEDGE_RISING: the Time stamp event occurs on the * rising edge of the related pin. - * @arg TimeStampEdge_Falling: the Time stamp event occurs on the + * @arg RTC_TIMESTAMPEDGE_FALLING: the Time stamp event occurs on the * falling edge of the related pin. * @param RTC_TimeStampPin: specifies the RTC TimeStamp Pin. * This parameter can be one of the following values: @@ -196,14 +197,15 @@ /** * @brief Sets TimeStamp with Interrupt. - * @param hrtc: RTC handle + * @param hrtc: pointer to a RTC_HandleTypeDef structure that contains + * the configuration information for RTC. * @note This API must be called before enabling the TimeStamp feature. * @param TimeStampEdge: Specifies the pin edge on which the TimeStamp is * activated. - * This parameter can be one of the following: - * @arg TimeStampEdge_Rising: the Time stamp event occurs on the + * This parameter can be one of the following values: + * @arg RTC_TIMESTAMPEDGE_RISING: the Time stamp event occurs on the * rising edge of the related pin. - * @arg TimeStampEdge_Falling: the Time stamp event occurs on the + * @arg RTC_TIMESTAMPEDGE_FALLING: the Time stamp event occurs on the * falling edge of the related pin. * @param RTC_TimeStampPin: Specifies the RTC TimeStamp Pin. * This parameter can be one of the following values: @@ -261,7 +263,8 @@ /** * @brief Deactivates TimeStamp. - * @param hrtc: RTC handle + * @param hrtc: pointer to a RTC_HandleTypeDef structure that contains + * the configuration information for RTC. * @retval HAL status */ HAL_StatusTypeDef HAL_RTCEx_DeactivateTimeStamp(RTC_HandleTypeDef *hrtc) @@ -298,13 +301,14 @@ /** * @brief Gets the RTC TimeStamp value. - * @param hrtc: RTC handle + * @param hrtc: pointer to a RTC_HandleTypeDef structure that contains + * the configuration information for RTC. * @param sTimeStamp: Pointer to Time structure * @param sTimeStampDate: Pointer to Date structure * @param Format: specifies the format of the entered parameters. * This parameter can be one of the following values: - * @arg Format_BIN: Binary data format - * @arg Format_BCD: BCD data format + * FORMAT_BIN: Binary data format + * FORMAT_BCD: BCD data format * @retval HAL status */ HAL_StatusTypeDef HAL_RTCEx_GetTimeStamp(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef* sTimeStamp, RTC_DateTypeDef* sTimeStampDate, uint32_t Format) @@ -354,7 +358,8 @@ /** * @brief Sets Tamper * @note By calling this API we disable the tamper interrupt for all tampers. - * @param hrtc: RTC handle + * @param hrtc: pointer to a RTC_HandleTypeDef structure that contains + * the configuration information for RTC. * @param sTamper: Pointer to Tamper Structure. * @retval HAL status */ @@ -403,7 +408,8 @@ /** * @brief Sets Tamper with interrupt. * @note By calling this API we force the tamper interrupt for all tampers. - * @param hrtc: RTC handle + * @param hrtc: pointer to a RTC_HandleTypeDef structure that contains + * the configuration information for RTC. * @param sTamper: Pointer to RTC Tamper. * @retval HAL status */ @@ -427,11 +433,7 @@ hrtc->State = HAL_RTC_STATE_BUSY; /* Configure the tamper trigger */ - if((sTamper->Trigger == RTC_TAMPERTRIGGER_RISINGEDGE) || (sTamper->Trigger == RTC_TAMPERTRIGGER_LOWLEVEL)) - { - sTamper->Trigger = RTC_TAMPERTRIGGER_RISINGEDGE; - } - else + if(sTamper->Trigger != RTC_TAMPERTRIGGER_RISINGEDGE) { sTamper->Trigger = (uint32_t)(sTamper->Tamper << 1); } @@ -464,7 +466,8 @@ /** * @brief Deactivates Tamper. - * @param hrtc: RTC handle + * @param hrtc: pointer to a RTC_HandleTypeDef structure that contains + * the configuration information for RTC. * @param Tamper: Selected tamper pin. * This parameter can be RTC_Tamper_1 and/or RTC_TAMPER_2. * @retval HAL status @@ -491,7 +494,8 @@ /** * @brief This function handles TimeStamp interrupt request. - * @param hrtc: RTC handle + * @param hrtc: pointer to a RTC_HandleTypeDef structure that contains + * the configuration information for RTC. * @retval None */ void HAL_RTCEx_TamperTimeStampIRQHandler(RTC_HandleTypeDef *hrtc) @@ -545,7 +549,8 @@ /** * @brief TimeStamp callback. - * @param hrtc: RTC handle + * @param hrtc: pointer to a RTC_HandleTypeDef structure that contains + * the configuration information for RTC. * @retval None */ __weak void HAL_RTCEx_TimeStampEventCallback(RTC_HandleTypeDef *hrtc) @@ -557,7 +562,8 @@ /** * @brief Tamper 1 callback. - * @param hrtc: RTC handle + * @param hrtc: pointer to a RTC_HandleTypeDef structure that contains + * the configuration information for RTC. * @retval None */ __weak void HAL_RTCEx_Tamper1EventCallback(RTC_HandleTypeDef *hrtc) @@ -569,7 +575,8 @@ /** * @brief Tamper 2 callback. - * @param hrtc: RTC handle + * @param hrtc: pointer to a RTC_HandleTypeDef structure that contains + * the configuration information for RTC. * @retval None */ __weak void HAL_RTCEx_Tamper2EventCallback(RTC_HandleTypeDef *hrtc) @@ -581,7 +588,8 @@ /** * @brief This function handles TimeStamp polling request. - * @param hrtc: RTC handle + * @param hrtc: pointer to a RTC_HandleTypeDef structure that contains + * the configuration information for RTC. * @param Timeout: Timeout duration * @retval HAL status */ @@ -623,7 +631,8 @@ /** * @brief This function handles Tamper1 Polling. - * @param hrtc: RTC handle + * @param hrtc: pointer to a RTC_HandleTypeDef structure that contains + * the configuration information for RTC. * @param Timeout: Timeout duration * @retval HAL status */ @@ -658,7 +667,8 @@ /** * @brief This function handles Tamper2 Polling. - * @param hrtc: RTC handle + * @param hrtc: pointer to a RTC_HandleTypeDef structure that contains + * the configuration information for RTC. * @param Timeout: Timeout duration * @retval HAL status */ @@ -703,7 +713,7 @@ ##### RTC Wake-up functions ##### =============================================================================== - [..] This section provide functions allowing to configure Wake-up feature + [..] This section provides functions allowing to configure Wake-up feature @endverbatim * @{ @@ -711,7 +721,8 @@ /** * @brief Sets wake up timer. - * @param hrtc: RTC handle + * @param hrtc: pointer to a RTC_HandleTypeDef structure that contains + * the configuration information for RTC. * @param WakeUpCounter: Wake up counter * @param WakeUpClock: Wake up clock * @retval HAL status @@ -778,9 +789,10 @@ /** * @brief Sets wake up timer with interrupt - * @param hrtc: RTC handle - * @param WakeUpCounter: wake up counter - * @param WakeUpClock: wake up clock + * @param hrtc: pointer to a RTC_HandleTypeDef structure that contains + * the configuration information for RTC. + * @param WakeUpCounter: Wake up counter + * @param WakeUpClock: Wake up clock * @retval HAL status */ HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer_IT(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock) @@ -853,7 +865,8 @@ /** * @brief Deactivates wake up timer counter. - * @param hrtc: RTC handle + * @param hrtc: pointer to a RTC_HandleTypeDef structure that contains + * the configuration information for RTC. * @retval HAL status */ uint32_t HAL_RTCEx_DeactivateWakeUpTimer(RTC_HandleTypeDef *hrtc) @@ -905,7 +918,8 @@ /** * @brief Gets wake up timer counter. - * @param hrtc: RTC handle + * @param hrtc: pointer to a RTC_HandleTypeDef structure that contains + * the configuration information for RTC. * @retval Counter value */ uint32_t HAL_RTCEx_GetWakeUpTimer(RTC_HandleTypeDef *hrtc) @@ -916,7 +930,8 @@ /** * @brief This function handles Wake Up Timer interrupt request. - * @param hrtc: RTC handle + * @param hrtc: pointer to a RTC_HandleTypeDef structure that contains + * the configuration information for RTC. * @retval None */ void HAL_RTCEx_WakeUpTimerIRQHandler(RTC_HandleTypeDef *hrtc) @@ -943,7 +958,8 @@ /** * @brief Wake Up Timer callback. - * @param hrtc: RTC handle + * @param hrtc: pointer to a RTC_HandleTypeDef structure that contains + * the configuration information for RTC. * @retval None */ __weak void HAL_RTCEx_WakeUpTimerEventCallback(RTC_HandleTypeDef *hrtc) @@ -955,7 +971,8 @@ /** * @brief This function handles Wake Up Timer Polling. - * @param hrtc: RTC handle + * @param hrtc: pointer to a RTC_HandleTypeDef structure that contains + * the configuration information for RTC. * @param Timeout: Timeout duration * @retval HAL status */ @@ -1002,18 +1019,18 @@ =============================================================================== [..] This subsection provides functions allowing to - (+) Writes a data in a specified RTC Backup data register + (+) Write a data in a specified RTC Backup data register (+) Read a data in a specified RTC Backup data register - (+) Sets the Coarse calibration parameters. - (+) Deactivates the Coarse calibration parameters - (+) Sets the Smooth calibration parameters. - (+) Configures the Synchronization Shift Control Settings. - (+) Configures the Calibration Pinout (RTC_CALIB) Selection (1Hz or 512Hz). - (+) Deactivates the Calibration Pinout (RTC_CALIB) Selection (1Hz or 512Hz). - (+) Enables the RTC reference clock detection. + (+) Set the Coarse calibration parameters. + (+) Deactivate the Coarse calibration parameters + (+) Set the Smooth calibration parameters. + (+) Configure the Synchronization Shift Control Settings. + (+) Configure the Calibration Pinout (RTC_CALIB) Selection (1Hz or 512Hz). + (+) Deactivate the Calibration Pinout (RTC_CALIB) Selection (1Hz or 512Hz). + (+) Enable the RTC reference clock detection. (+) Disable the RTC reference clock detection. - (+) Enables the Bypass Shadow feature. - (+) Disables the Bypass Shadow feature. + (+) Enable the Bypass Shadow feature. + (+) Disable the Bypass Shadow feature. @endverbatim * @{ @@ -1021,7 +1038,8 @@ /** * @brief Writes a data in a specified RTC Backup data register. - * @param hrtc: RTC handle + * @param hrtc: pointer to a RTC_HandleTypeDef structure that contains + * the configuration information for RTC. * @param BackupRegister: RTC Backup data Register number. * This parameter can be: RTC_BKP_DRx where x can be from 0 to 19 to * specify the register. @@ -1044,7 +1062,8 @@ /** * @brief Reads data from the specified RTC Backup data Register. - * @param hrtc: RTC handle + * @param hrtc: pointer to a RTC_HandleTypeDef structure that contains + * the configuration information for RTC. * @param BackupRegister: RTC Backup data Register number. * This parameter can be: RTC_BKP_DRx where x can be from 0 to 19 to * specify the register. @@ -1066,7 +1085,8 @@ /** * @brief Sets the Coarse calibration parameters. - * @param hrtc: RTC handle + * @param hrtc: pointer to a RTC_HandleTypeDef structure that contains + * the configuration information for RTC. * @param CalibSign: Specifies the sign of the coarse calibration value. * This parameter can be one of the following values : * @arg RTC_CALIBSIGN_POSITIVE: The value sign is positive @@ -1134,7 +1154,8 @@ /** * @brief Deactivates the Coarse calibration parameters. - * @param hrtc: RTC handle + * @param hrtc: pointer to a RTC_HandleTypeDef structure that contains + * the configuration information for RTC. * @retval HAL status */ HAL_StatusTypeDef HAL_RTCEx_DeactivateCoarseCalib(RTC_HandleTypeDef* hrtc) @@ -1184,7 +1205,8 @@ /** * @brief Sets the Smooth calibration parameters. - * @param hrtc: RTC handle + * @param hrtc: pointer to a RTC_HandleTypeDef structure that contains + * the configuration information for RTC. * @param SmoothCalibPeriod: Select the Smooth Calibration Period. * This parameter can be can be one of the following values : * @arg RTC_SMOOTHCALIB_PERIOD_32SEC: The smooth calibration periode is 32s. @@ -1198,7 +1220,7 @@ * This parameter can be one any value from 0 to 0x000001FF. * @note To deactivate the smooth calibration, the field SmoothCalibPlusPulses * must be equal to SMOOTHCALIB_PLUSPULSES_RESET and the field - * SmouthCalibMinusPulsesValue mut be equal to 0. + * SmouthCalibMinusPulsesValue must be equal to 0. * @retval HAL status */ HAL_StatusTypeDef HAL_RTCEx_SetSmoothCalib(RTC_HandleTypeDef* hrtc, uint32_t SmoothCalibPeriod, uint32_t SmoothCalibPlusPulses, uint32_t SmouthCalibMinusPulsesValue) @@ -1260,7 +1282,8 @@ /** * @brief Configures the Synchronization Shift Control Settings. * @note When REFCKON is set, firmware must not write to Shift control register. - * @param hrtc: RTC handle + * @param hrtc: pointer to a RTC_HandleTypeDef structure that contains + * the configuration information for RTC. * @param ShiftAdd1S: Select to add or not 1 second to the time calendar. * This parameter can be one of the following values : * @arg RTC_SHIFTADD1S_SET: Add one second to the clock calendar. @@ -1355,8 +1378,9 @@ /** * @brief Configures the Calibration Pinout (RTC_CALIB) Selection (1Hz or 512Hz). - * @param hrtc: RTC handle - * @param CalibOutput : Select the Calibration output Selection . + * @param hrtc: pointer to a RTC_HandleTypeDef structure that contains + * the configuration information for RTC. + * @param CalibOutput: Select the Calibration output Selection . * This parameter can be one of the following values: * @arg RTC_CALIBOUTPUT_512HZ: A signal has a regular waveform at 512Hz. * @arg RTC_CALIBOUTPUT_1HZ: A signal has a regular waveform at 1Hz. @@ -1397,7 +1421,8 @@ /** * @brief Deactivates the Calibration Pinout (RTC_CALIB) Selection (1Hz or 512Hz). - * @param hrtc: RTC handle + * @param hrtc: pointer to a RTC_HandleTypeDef structure that contains + * the configuration information for RTC. * @retval HAL status */ HAL_StatusTypeDef HAL_RTCEx_DeactivateCalibrationOutPut(RTC_HandleTypeDef* hrtc) @@ -1426,7 +1451,8 @@ /** * @brief Enables the RTC reference clock detection. - * @param hrtc: RTC handle + * @param hrtc: pointer to a RTC_HandleTypeDef structure that contains + * the configuration information for RTC. * @retval HAL status */ HAL_StatusTypeDef HAL_RTCEx_SetRefClock(RTC_HandleTypeDef* hrtc) @@ -1475,7 +1501,8 @@ /** * @brief Disable the RTC reference clock detection. - * @param hrtc: RTC handle + * @param hrtc: pointer to a RTC_HandleTypeDef structure that contains + * the configuration information for RTC. * @retval HAL status */ HAL_StatusTypeDef HAL_RTCEx_DeactivateRefClock(RTC_HandleTypeDef* hrtc) @@ -1524,7 +1551,8 @@ /** * @brief Enables the Bypass Shadow feature. - * @param hrtc: RTC handle + * @param hrtc: pointer to a RTC_HandleTypeDef structure that contains + * the configuration information for RTC. * @note When the Bypass Shadow is enabled the calendar value are taken * directly from the Calendar counter. * @retval HAL status @@ -1556,7 +1584,8 @@ /** * @brief Disables the Bypass Shadow feature. - * @param hrtc: RTC handle + * @param hrtc: pointer to a RTC_HandleTypeDef structure that contains + * the configuration information for RTC. * @note When the Bypass Shadow is enabled the calendar value are taken * directly from the Calendar counter. * @retval HAL status @@ -1607,7 +1636,8 @@ /** * @brief Alarm B callback. - * @param hrtc: RTC handle + * @param hrtc: pointer to a RTC_HandleTypeDef structure that contains + * the configuration information for RTC. * @retval None */ __weak void HAL_RTCEx_AlarmBEventCallback(RTC_HandleTypeDef *hrtc) @@ -1619,7 +1649,8 @@ /** * @brief This function handles AlarmB Polling request. - * @param hrtc: RTC handle + * @param hrtc: pointer to a RTC_HandleTypeDef structure that contains + * the configuration information for RTC. * @param Timeout: Timeout duration * @retval HAL status */