test commit, update gitignore
This commit is contained in:
@ -6,8 +6,8 @@
|
||||
* This file provides firmware functions to manage the following
|
||||
* functionalities of the Real-Time Clock (RTC) peripheral:
|
||||
* + Initialization and de-initialization functions
|
||||
* + RTC Calendar (Time and Date) configuration functions
|
||||
* + RTC Alarm (Alarm A) configuration functions
|
||||
* + Calendar (Time and Date) configuration functions
|
||||
* + Alarm (Alarm A) configuration functions
|
||||
* + Peripheral Control functions
|
||||
* + Peripheral State functions
|
||||
*
|
||||
@ -63,7 +63,7 @@
|
||||
|
||||
##### Backup Domain Access #####
|
||||
==================================================================
|
||||
[..] After reset, the backup domain (RTC registers, RTC backup data registers
|
||||
[..] After reset, the backup domain (RTC registers and RTC backup data registers)
|
||||
is protected against possible unwanted write accesses.
|
||||
[..] To enable access to the RTC Domain and RTC registers, proceed as follows:
|
||||
(+) Enable the Power Controller (PWR) APB1 interface clock using the
|
||||
@ -106,8 +106,8 @@
|
||||
==================================================================
|
||||
[..] The MCU can be woken up from a low power mode by an RTC alternate
|
||||
function.
|
||||
[..] The RTC alternate functions are the RTC alarm (Alarm A), RTC wakeup,
|
||||
RTC tamper event detection and RTC timestamp event detection.
|
||||
[..] The RTC alternate functions are the RTC alarm (Alarm A),
|
||||
RTC wakeup, RTC tamper event detection and RTC timestamp event detection.
|
||||
These RTC alternate functions can wake up the system from the Stop and
|
||||
Standby low power modes.
|
||||
[..] The system can also wake up from low power modes without depending
|
||||
@ -121,6 +121,12 @@
|
||||
*** Callback registration ***
|
||||
=============================================
|
||||
[..]
|
||||
When the compilation define USE_HAL_RTC_REGISTER_CALLBACKS is set to 0 or
|
||||
not defined, the callback registration feature is not available and all
|
||||
callbacks are set to the corresponding weak functions.
|
||||
This is the recommended configuration in order to optimize memory/code
|
||||
consumption footprint/performances.
|
||||
[..]
|
||||
The compilation define USE_HAL_RTC_REGISTER_CALLBACKS when set to 1
|
||||
allows the user to configure dynamically the driver callbacks.
|
||||
Use Function HAL_RTC_RegisterCallback() to register an interrupt callback.
|
||||
@ -128,12 +134,14 @@
|
||||
Function HAL_RTC_RegisterCallback() allows to register following callbacks:
|
||||
(+) AlarmAEventCallback : RTC Alarm A Event callback.
|
||||
(+) TimeStampEventCallback : RTC Timestamp Event callback.
|
||||
(+) WakeUpTimerEventCallback : RTC WakeUpTimer Event callback.
|
||||
(+) WakeUpTimerEventCallback : RTC WakeUpTimer Event callback. (*)
|
||||
(+) Tamper1EventCallback : RTC Tamper 1 Event callback.
|
||||
(+) Tamper2EventCallback : RTC Tamper 2 Event callback.
|
||||
(+) Tamper3EventCallback : RTC Tamper 3 Event callback.
|
||||
(+) Tamper3EventCallback : RTC Tamper 3 Event callback. (*)
|
||||
(+) MspInitCallback : RTC MspInit callback.
|
||||
(+) MspDeInitCallback : RTC MspDeInit callback.
|
||||
|
||||
(*) value not applicable to all devices.
|
||||
[..]
|
||||
This function takes as parameters the HAL peripheral handle, the Callback ID
|
||||
and a pointer to the user callback function.
|
||||
@ -145,34 +153,32 @@
|
||||
This function allows to reset following callbacks:
|
||||
(+) AlarmAEventCallback : RTC Alarm A Event callback.
|
||||
(+) TimeStampEventCallback : RTC Timestamp Event callback.
|
||||
(+) WakeUpTimerEventCallback : RTC WakeUpTimer Event callback.
|
||||
(+) WakeUpTimerEventCallback : RTC WakeUpTimer Event callback. (*)
|
||||
(+) Tamper1EventCallback : RTC Tamper 1 Event callback.
|
||||
(+) Tamper2EventCallback : RTC Tamper 2 Event callback.
|
||||
(+) Tamper3EventCallback : RTC Tamper 3 Event callback.
|
||||
(+) Tamper3EventCallback : RTC Tamper 3 Event callback. (*)
|
||||
(+) MspInitCallback : RTC MspInit callback.
|
||||
(+) MspDeInitCallback : RTC MspDeInit callback.
|
||||
|
||||
(*) value not applicable to all devices.
|
||||
[..]
|
||||
By default, after the HAL_RTC_Init() and when the state is HAL_RTC_STATE_RESET,
|
||||
all callbacks are set to the corresponding weak functions:
|
||||
examples AlarmAEventCallback(), WakeUpTimerEventCallback().
|
||||
examples AlarmAEventCallback(), TimeStampEventCallback().
|
||||
Exception done for MspInit() and MspDeInit() callbacks that are reset to the
|
||||
legacy weak function in the HAL_RTC_Init()/HAL_RTC_DeInit() only
|
||||
when these callbacks are null (not registered beforehand).
|
||||
legacy weak function in the HAL_RTC_Init()/HAL_RTC_DeInit() only when these
|
||||
callbacks are null (not registered beforehand).
|
||||
If not, MspInit() or MspDeInit() are not null, HAL_RTC_Init()/HAL_RTC_DeInit()
|
||||
keep and use the user MspInit()/MspDeInit() callbacks (registered beforehand).
|
||||
[..]
|
||||
Callbacks can be registered/unregistered in HAL_RTC_STATE_READY state only.
|
||||
Exception done MspInit()/MspDeInit() that can be registered/unregistered
|
||||
Exception done for MspInit() and MspDeInit() that can be registered/unregistered
|
||||
in HAL_RTC_STATE_READY or HAL_RTC_STATE_RESET state.
|
||||
Thus registered (user) MspInit()/MspDeInit() callbacks can be used during the
|
||||
Init/DeInit.
|
||||
In that case first register the MspInit()/MspDeInit() user callbacks
|
||||
using HAL_RTC_RegisterCallback() before calling HAL_RTC_DeInit()
|
||||
or HAL_RTC_Init() functions.
|
||||
[..]
|
||||
When The compilation define USE_HAL_RTC_REGISTER_CALLBACKS is set to 0 or
|
||||
not defined, the callback registration feature is not available and all
|
||||
callbacks are set to the corresponding weak functions.
|
||||
In that case first register the MspInit()/MspDeInit() user callbacks using
|
||||
HAL_RTC_RegisterCallback() before calling HAL_RTC_DeInit() or HAL_RTC_Init()
|
||||
functions.
|
||||
|
||||
@endverbatim
|
||||
******************************************************************************
|
||||
@ -434,13 +440,14 @@ HAL_StatusTypeDef HAL_RTC_DeInit(RTC_HandleTypeDef *hrtc)
|
||||
* This parameter can be one of the following values:
|
||||
* @arg @ref HAL_RTC_ALARM_A_EVENT_CB_ID Alarm A Event Callback ID
|
||||
* @arg @ref HAL_RTC_TIMESTAMP_EVENT_CB_ID Timestamp Event Callback ID
|
||||
* @arg @ref HAL_RTC_WAKEUPTIMER_EVENT_CB_ID Wakeup Timer Event Callback ID
|
||||
* @arg @ref HAL_RTC_TAMPER1_EVENT_CB_ID Tamper 1 Callback ID
|
||||
* @arg @ref HAL_RTC_TAMPER2_EVENT_CB_ID Tamper 2 Callback ID
|
||||
* @arg @ref HAL_RTC_TAMPER3_EVENT_CB_ID Tamper 3 Callback ID
|
||||
* @arg @ref HAL_RTC_MSPINIT_CB_ID Msp Init callback ID
|
||||
* @arg @ref HAL_RTC_MSPDEINIT_CB_ID Msp DeInit callback ID
|
||||
* @note HAL_RTC_TAMPER3_EVENT_CB_ID is not applicable to all devices.
|
||||
* @arg @ref HAL_RTC_WAKEUPTIMER_EVENT_CB_ID Wakeup Timer Event Callback ID (*)
|
||||
* @arg @ref HAL_RTC_TAMPER1_EVENT_CB_ID Tamper 1 Event Callback ID
|
||||
* @arg @ref HAL_RTC_TAMPER2_EVENT_CB_ID Tamper 2 Event Callback ID
|
||||
* @arg @ref HAL_RTC_TAMPER3_EVENT_CB_ID Tamper 3 Event Callback ID (*)
|
||||
* @arg @ref HAL_RTC_MSPINIT_CB_ID MSP Init callback ID
|
||||
* @arg @ref HAL_RTC_MSPDEINIT_CB_ID MSP DeInit callback ID
|
||||
*
|
||||
* (*) value not applicable to all devices.
|
||||
* @param pCallback pointer to the Callback function
|
||||
* @retval HAL status
|
||||
*/
|
||||
@ -541,13 +548,14 @@ HAL_StatusTypeDef HAL_RTC_RegisterCallback(RTC_HandleTypeDef *hrtc, HAL_RTC_Call
|
||||
* This parameter can be one of the following values:
|
||||
* @arg @ref HAL_RTC_ALARM_A_EVENT_CB_ID Alarm A Event Callback ID
|
||||
* @arg @ref HAL_RTC_TIMESTAMP_EVENT_CB_ID Timestamp Event Callback ID
|
||||
* @arg @ref HAL_RTC_WAKEUPTIMER_EVENT_CB_ID Wakeup Timer Event Callback ID
|
||||
* @arg @ref HAL_RTC_TAMPER1_EVENT_CB_ID Tamper 1 Callback ID
|
||||
* @arg @ref HAL_RTC_TAMPER2_EVENT_CB_ID Tamper 2 Callback ID
|
||||
* @arg @ref HAL_RTC_TAMPER3_EVENT_CB_ID Tamper 3 Callback ID
|
||||
* @arg @ref HAL_RTC_MSPINIT_CB_ID Msp Init callback ID
|
||||
* @arg @ref HAL_RTC_MSPDEINIT_CB_ID Msp DeInit callback ID
|
||||
* @note HAL_RTC_TAMPER3_EVENT_CB_ID is not applicable to all devices.
|
||||
* @arg @ref HAL_RTC_WAKEUPTIMER_EVENT_CB_ID Wakeup Timer Event Callback ID (*)
|
||||
* @arg @ref HAL_RTC_TAMPER1_EVENT_CB_ID Tamper 1 Event Callback ID
|
||||
* @arg @ref HAL_RTC_TAMPER2_EVENT_CB_ID Tamper 2 Event Callback ID
|
||||
* @arg @ref HAL_RTC_TAMPER3_EVENT_CB_ID Tamper 3 Event Callback ID (*)
|
||||
* @arg @ref HAL_RTC_MSPINIT_CB_ID MSP Init callback ID
|
||||
* @arg @ref HAL_RTC_MSPDEINIT_CB_ID MSP DeInit callback ID
|
||||
*
|
||||
* (*) value not applicable to all devices.
|
||||
* @retval HAL status
|
||||
*/
|
||||
HAL_StatusTypeDef HAL_RTC_UnRegisterCallback(RTC_HandleTypeDef *hrtc, HAL_RTC_CallbackIDTypeDef CallbackID)
|
||||
@ -1052,7 +1060,7 @@ HAL_StatusTypeDef HAL_RTC_SetAlarm(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sA
|
||||
tmpreg = (((uint32_t)RTC_ByteToBcd2(sAlarm->AlarmTime.Hours) << RTC_ALRMAR_HU_Pos) | \
|
||||
((uint32_t)RTC_ByteToBcd2(sAlarm->AlarmTime.Minutes) << RTC_ALRMAR_MNU_Pos) | \
|
||||
((uint32_t)RTC_ByteToBcd2(sAlarm->AlarmTime.Seconds)) | \
|
||||
((uint32_t)(sAlarm->AlarmTime.TimeFormat) << RTC_TR_PM_Pos) | \
|
||||
((uint32_t)(sAlarm->AlarmTime.TimeFormat) << RTC_ALRMAR_PM_Pos) | \
|
||||
((uint32_t)RTC_ByteToBcd2(sAlarm->AlarmDateWeekDay) << RTC_ALRMAR_DU_Pos) | \
|
||||
((uint32_t)sAlarm->AlarmDateWeekDaySel) | \
|
||||
((uint32_t)sAlarm->AlarmMask));
|
||||
@ -1085,7 +1093,7 @@ HAL_StatusTypeDef HAL_RTC_SetAlarm(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sA
|
||||
tmpreg = (((uint32_t)(sAlarm->AlarmTime.Hours) << RTC_ALRMAR_HU_Pos) | \
|
||||
((uint32_t)(sAlarm->AlarmTime.Minutes) << RTC_ALRMAR_MNU_Pos) | \
|
||||
((uint32_t) sAlarm->AlarmTime.Seconds) | \
|
||||
((uint32_t)(sAlarm->AlarmTime.TimeFormat) << RTC_TR_PM_Pos) | \
|
||||
((uint32_t)(sAlarm->AlarmTime.TimeFormat) << RTC_ALRMAR_PM_Pos) | \
|
||||
((uint32_t)(sAlarm->AlarmDateWeekDay) << RTC_ALRMAR_DU_Pos) | \
|
||||
((uint32_t) sAlarm->AlarmDateWeekDaySel) | \
|
||||
((uint32_t) sAlarm->AlarmMask));
|
||||
@ -1098,13 +1106,13 @@ HAL_StatusTypeDef HAL_RTC_SetAlarm(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sA
|
||||
/* Disable the write protection for RTC registers */
|
||||
__HAL_RTC_WRITEPROTECTION_DISABLE(hrtc);
|
||||
|
||||
/* Disable the Alarm A */
|
||||
/* Disable Alarm A */
|
||||
__HAL_RTC_ALARMA_DISABLE(hrtc);
|
||||
|
||||
/* In case interrupt mode is used, the interrupt source must be disabled */
|
||||
__HAL_RTC_ALARM_DISABLE_IT(hrtc, RTC_IT_ALRA);
|
||||
|
||||
/* Clear the Alarm flag */
|
||||
/* Clear Alarm A flag */
|
||||
__HAL_RTC_ALARM_CLEAR_FLAG(hrtc, RTC_FLAG_ALRAF);
|
||||
|
||||
/* Get tick */
|
||||
@ -1127,10 +1135,11 @@ HAL_StatusTypeDef HAL_RTC_SetAlarm(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sA
|
||||
}
|
||||
}
|
||||
|
||||
/* Configure Alarm A register */
|
||||
hrtc->Instance->ALRMAR = (uint32_t)tmpreg;
|
||||
/* Configure the Alarm A Subseconds register */
|
||||
/* Configure Alarm A Subseconds register */
|
||||
hrtc->Instance->ALRMASSR = subsecondtmpreg;
|
||||
/* Configure the Alarm state: Enable Alarm */
|
||||
/* Enable Alarm A */
|
||||
__HAL_RTC_ALARMA_ENABLE(hrtc);
|
||||
|
||||
/* Enable the write protection for RTC registers */
|
||||
@ -1208,7 +1217,7 @@ HAL_StatusTypeDef HAL_RTC_SetAlarm_IT(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef
|
||||
tmpreg = (((uint32_t)RTC_ByteToBcd2(sAlarm->AlarmTime.Hours) << RTC_ALRMAR_HU_Pos) | \
|
||||
((uint32_t)RTC_ByteToBcd2(sAlarm->AlarmTime.Minutes) << RTC_ALRMAR_MNU_Pos) | \
|
||||
((uint32_t)RTC_ByteToBcd2(sAlarm->AlarmTime.Seconds)) | \
|
||||
((uint32_t)(sAlarm->AlarmTime.TimeFormat) << RTC_TR_PM_Pos) | \
|
||||
((uint32_t)(sAlarm->AlarmTime.TimeFormat) << RTC_ALRMAR_PM_Pos) | \
|
||||
((uint32_t)RTC_ByteToBcd2(sAlarm->AlarmDateWeekDay) << RTC_ALRMAR_DU_Pos) | \
|
||||
((uint32_t)sAlarm->AlarmDateWeekDaySel) | \
|
||||
((uint32_t)sAlarm->AlarmMask));
|
||||
@ -1241,7 +1250,7 @@ HAL_StatusTypeDef HAL_RTC_SetAlarm_IT(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef
|
||||
tmpreg = (((uint32_t)(sAlarm->AlarmTime.Hours) << RTC_ALRMAR_HU_Pos) | \
|
||||
((uint32_t)(sAlarm->AlarmTime.Minutes) << RTC_ALRMAR_MNU_Pos) | \
|
||||
((uint32_t) sAlarm->AlarmTime.Seconds) | \
|
||||
((uint32_t)(sAlarm->AlarmTime.TimeFormat) << RTC_TR_PM_Pos) | \
|
||||
((uint32_t)(sAlarm->AlarmTime.TimeFormat) << RTC_ALRMAR_PM_Pos) | \
|
||||
((uint32_t)(sAlarm->AlarmDateWeekDay) << RTC_ALRMAR_DU_Pos) | \
|
||||
((uint32_t) sAlarm->AlarmDateWeekDaySel) | \
|
||||
((uint32_t) sAlarm->AlarmMask));
|
||||
@ -1254,10 +1263,10 @@ HAL_StatusTypeDef HAL_RTC_SetAlarm_IT(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef
|
||||
/* Disable the write protection for RTC registers */
|
||||
__HAL_RTC_WRITEPROTECTION_DISABLE(hrtc);
|
||||
|
||||
/* Disable the Alarm A */
|
||||
/* Disable Alarm A */
|
||||
__HAL_RTC_ALARMA_DISABLE(hrtc);
|
||||
|
||||
/* Clear the Alarm flag */
|
||||
/* Clear Alarm A flag */
|
||||
__HAL_RTC_ALARM_CLEAR_FLAG(hrtc, RTC_FLAG_ALRAF);
|
||||
|
||||
/* Wait till RTC ALRAWF flag is set and if timeout is reached exit */
|
||||
@ -1278,15 +1287,16 @@ HAL_StatusTypeDef HAL_RTC_SetAlarm_IT(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef
|
||||
}
|
||||
} while (__HAL_RTC_ALARM_GET_FLAG(hrtc, RTC_FLAG_ALRAWF) == 0U);
|
||||
|
||||
/* Configure Alarm A register */
|
||||
hrtc->Instance->ALRMAR = (uint32_t)tmpreg;
|
||||
/* Configure the Alarm A Subseconds register */
|
||||
/* Configure Alarm A Subseconds register */
|
||||
hrtc->Instance->ALRMASSR = subsecondtmpreg;
|
||||
/* Configure the Alarm state: Enable Alarm */
|
||||
/* Enable Alarm A */
|
||||
__HAL_RTC_ALARMA_ENABLE(hrtc);
|
||||
/* Configure the Alarm interrupt */
|
||||
/* Enable Alarm A interrupt */
|
||||
__HAL_RTC_ALARM_ENABLE_IT(hrtc, RTC_IT_ALRA);
|
||||
|
||||
/* RTC Alarm Interrupt Configuration: EXTI configuration */
|
||||
/* Enable and configure the EXTI line associated to the RTC Alarm interrupt */
|
||||
__HAL_RTC_ALARM_EXTI_ENABLE_IT();
|
||||
__HAL_RTC_ALARM_EXTI_ENABLE_RISING_EDGE();
|
||||
|
||||
@ -1335,7 +1345,7 @@ HAL_StatusTypeDef HAL_RTC_DeactivateAlarm(RTC_HandleTypeDef *hrtc, uint32_t Alar
|
||||
/* Get tick */
|
||||
tickstart = HAL_GetTick();
|
||||
|
||||
/* Wait till RTC ALRxWF flag is set and if timeout is reached exit */
|
||||
/* Wait till RTC ALRAWF flag is set and if timeout is reached exit */
|
||||
while (__HAL_RTC_ALARM_GET_FLAG(hrtc, RTC_FLAG_ALRAWF) == 0U)
|
||||
{
|
||||
if ((HAL_GetTick() - tickstart) > RTC_TIMEOUT_VALUE)
|
||||
@ -1420,7 +1430,7 @@ HAL_StatusTypeDef HAL_RTC_GetAlarm(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sA
|
||||
*/
|
||||
void HAL_RTC_AlarmIRQHandler(RTC_HandleTypeDef *hrtc)
|
||||
{
|
||||
/* Clear the EXTI's line Flag for RTC Alarm */
|
||||
/* Clear the EXTI flag associated to the RTC Alarm interrupt */
|
||||
__HAL_RTC_ALARM_EXTI_CLEAR_FLAG();
|
||||
|
||||
/* Get the Alarm A interrupt source enable status */
|
||||
|
||||
Reference in New Issue
Block a user