bf0_hal_rtc.h
Defines
-
RC10K_FREQ
-
RC32K_FREQ
-
LXT_FREQ
-
RC10K_SUB_SEC_DIVB
RTC DIVB default setting
-
RTC_CENTURY_BIT
-
RTC_CBK_ALARM
-
RTC_CBK_WAKEUP
-
RTC_HOURFORMAT_24
-
RTC_HOURFORMAT_12
-
RTC_HOURFORMAT12_AM
-
RTC_HOURFORMAT12_PM
-
RTC_DAYLIGHTSAVING_SUB1H
-
RTC_DAYLIGHTSAVING_ADD1H
-
RTC_DAYLIGHTSAVING_NONE
-
RTC_STOREOPERATION_RESET
-
RTC_STOREOPERATION_SET
-
RTC_FORMAT_BIN
-
RTC_FORMAT_BCD
-
RTC_MONTH_JANUARY
-
RTC_MONTH_FEBRUARY
-
RTC_MONTH_MARCH
-
RTC_MONTH_APRIL
-
RTC_MONTH_MAY
-
RTC_MONTH_JUNE
-
RTC_MONTH_JULY
-
RTC_MONTH_AUGUST
-
RTC_MONTH_SEPTEMBER
-
RTC_MONTH_OCTOBER
-
RTC_MONTH_NOVEMBER
-
RTC_MONTH_DECEMBER
-
RTC_WEEKDAY_MONDAY
-
RTC_WEEKDAY_TUESDAY
-
RTC_WEEKDAY_WEDNESDAY
-
RTC_WEEKDAY_THURSDAY
-
RTC_WEEKDAY_FRIDAY
-
RTC_WEEKDAY_SATURDAY
-
RTC_WEEKDAY_SUNDAY
-
RTC_ALARMDATEWEEKDAYSEL_DATE
-
RTC_ALARMDATEWEEKDAYSEL_WEEKDAY
-
RTC_ALARMMASK_NONE
-
RTC_ALARMMASK_DATEWEEKDAY
-
RTC_ALARMMASK_MONTH
-
RTC_ALARMMASK_DAY
-
RTC_ALARMMASK_SECONDS
-
RTC_ALARMMASK_HOURS
-
RTC_ALARMMASK_MINUTES
-
RTC_ALARMMASK_ALL
-
RTC_ALARMSUBSECONDMASK_ALL
All Alarm SS fields are masked. There is no comparison on sub seconds for Alarm
-
RTC_ALARMSUBSECONDMASK_SS14_1
SS[14:1] are don’t care in Alarm comparison. Only SS[0] is compared.
-
RTC_ALARMSUBSECONDMASK_SS14_2
SS[14:2] are don’t care in Alarm comparison. Only SS[1:0] are compared
-
RTC_ALARMSUBSECONDMASK_SS14_3
SS[14:3] are don’t care in Alarm comparison. Only SS[2:0] are compared
-
RTC_ALARMSUBSECONDMASK_SS14_4
SS[14:4] are don’t care in Alarm comparison. Only SS[3:0] are compared
-
RTC_ALARMSUBSECONDMASK_SS14_5
SS[14:5] are don’t care in Alarm comparison. Only SS[4:0] are compared
-
RTC_ALARMSUBSECONDMASK_SS14_6
SS[14:6] are don’t care in Alarm comparison. Only SS[5:0] are compared
-
RTC_ALARMSUBSECONDMASK_SS14_7
SS[14:7] are don’t care in Alarm comparison. Only SS[6:0] are compared
-
RTC_ALARMSUBSECONDMASK_SS14_8
SS[14:8] are don’t care in Alarm comparison. Only SS[7:0] are compared
-
RTC_ALARMSUBSECONDMASK_SS14_9
SS[14:9] are don’t care in Alarm comparison. Only SS[8:0] are compared
-
RTC_ALARMSUBSECONDMASK_SS14_10
SS[14:10] are don’t care in Alarm comparison. Only SS[9:0] are compared
-
RTC_ALARMSUBSECONDMASK_SS14_11
SS[14:11] are don’t care in Alarm comparison. Only SS[10:0] are compared
-
RTC_ALARMSUBSECONDMASK_SS14_12
SS[14:12] are don’t care in Alarm comparison.Only SS[11:0] are compared
-
RTC_ALARMSUBSECONDMASK_SS14_13
SS[14:13] are don’t care in Alarm comparison. Only SS[12:0] are compared
-
RTC_ALARMSUBSECONDMASK_SS14
SS[14] is don’t care in Alarm comparison.Only SS[13:0] are compared
-
RTC_ALARMSUBSECONDMASK_NONE
SS[14:0] are compared and must match to activate alarm.
-
RTC_IT_TS
-
RTC_IT_WUT
-
RTC_IT_ALRB
-
RTC_IT_ALRA
-
RTC_IT_TAMP
-
RTC_IT_TAMP1
-
RTC_IT_TAMP2
-
RTC_FLAG_RECALPF
-
RTC_FLAG_TAMP2F
-
RTC_FLAG_TAMP1F
-
RTC_FLAG_TSOVF
-
RTC_FLAG_TSF
-
RTC_FLAG_WUTF
-
RTC_FLAG_ALRBF
-
RTC_FLAG_ALRAF
-
RTC_FLAG_INITF
-
RTC_FLAG_RSF
-
RTC_FLAG_INITS
-
RTC_FLAG_SHPF
-
RTC_FLAG_WUTWF
-
RTC_FLAG_ALRBWF
-
RTC_FLAG_ALRAWF
-
RTC_WAKEUP_SEC
-
RTC_WAKEUP_SUBSEC
-
__HAL_RTC_RESET_HANDLE_STATE(__HANDLE__)
Reset RTC handle state.
- Parameters:
__HANDLE__ – specifies the RTC handle.
- Return values:
None –
-
__HAL_RTC_ALARM_ENABLE(__HANDLE__)
Enable the RTC ALARM peripheral.
- Parameters:
__HANDLE__ – specifies the RTC handle.
- Return values:
None –
-
__HAL_RTC_ALARM_DISABLE(__HANDLE__)
Disable the RTC ALARM peripheral.
- Parameters:
__HANDLE__ – specifies the RTC handle.
- Return values:
None –
-
__HAL_RTC_ALARM_ENABLE_IT(__HANDLE__)
Enable the RTC Alarm interrupt.
- Parameters:
__HANDLE__ – specifies the RTC handle.
- Return values:
None –
-
__HAL_RTC_ALARM_DISABLE_IT(__HANDLE__)
Disable the RTC Alarm interrupt.
- Parameters:
__HANDLE__ – specifies the RTC handle.
- Return values:
None –
-
__HAL_RTC_ALARM_GET_IT(__HANDLE__)
Check whether the specified RTC Alarm interrupt has occurred or not.
- Parameters:
__HANDLE__ – specifies the RTC handle.
- Return values:
None –
-
__HAL_RTC_ALARM_GET_FLAG(__HANDLE__, __FLAG__)
Get the selected RTC Alarm’s flag status.
- Parameters:
__HANDLE__ – specifies the RTC handle.
__FLAG__ – specifies the RTC Alarm Flag to check. This parameter can be:
RTC_ISR_ALRMF
RTC_ISR_ALRMWF
- Return values:
None –
-
__HAL_RTC_ALARM_CLEAR_FLAG(__HANDLE__, __FLAG__)
Clear the RTC Alarm’s pending flags.
- Parameters:
__HANDLE__ – specifies the RTC handle.
__FLAG__ – specifies the RTC Alarm Flag sources to be enabled or disabled. This parameter can be:
RTC_FLAG_ALRAF
RTC_FLAG_ALRBF
- Return values:
None –
-
__HAL_RTC_ALARM_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__)
Check whether the specified RTC Alarm interrupt has been enabled or not.
- Parameters:
__HANDLE__ – specifies the RTC handle.
__INTERRUPT__ – specifies the RTC Alarm interrupt sources to check. This parameter can be:
RTC_IT_ALRA: Alarm A interrupt
RTC_IT_ALRB: Alarm B interrupt
- Return values:
None –
-
__HAL_RTC_ALARM_EXTI_ENABLE_IT()
Enable interrupt on the RTC Alarm associated Exti line.
- Return values:
None –
-
__HAL_RTC_ALARM_EXTI_DISABLE_IT()
Disable interrupt on the RTC Alarm associated Exti line.
- Return values:
None –
-
__HAL_RTC_ALARM_EXTI_ENABLE_EVENT()
Enable event on the RTC Alarm associated Exti line.
- Return values:
None. –
-
__HAL_RTC_ALARM_EXTI_DISABLE_EVENT()
Disable event on the RTC Alarm associated Exti line.
- Return values:
None. –
-
__HAL_RTC_ALARM_EXTI_ENABLE_FALLING_EDGE()
Enable falling edge trigger on the RTC Alarm associated Exti line.
- Return values:
None. –
-
__HAL_RTC_ALARM_EXTI_DISABLE_FALLING_EDGE()
Disable falling edge trigger on the RTC Alarm associated Exti line.
- Return values:
None. –
-
__HAL_RTC_ALARM_EXTI_ENABLE_RISING_EDGE()
Enable rising edge trigger on the RTC Alarm associated Exti line.
- Return values:
None. –
-
__HAL_RTC_ALARM_EXTI_DISABLE_RISING_EDGE()
Disable rising edge trigger on the RTC Alarm associated Exti line.
- Return values:
None. –
-
__HAL_RTC_ALARM_EXTI_ENABLE_RISING_FALLING_EDGE()
Enable rising & falling edge trigger on the RTC Alarm associated Exti line.
- Return values:
None. –
-
__HAL_RTC_ALARM_EXTI_DISABLE_RISING_FALLING_EDGE()
Disable rising & falling edge trigger on the RTC Alarm associated Exti line.
- Return values:
None. –
-
__HAL_RTC_ALARM_EXTI_GET_FLAG()
Check whether the RTC Alarm associated Exti line interrupt flag is set or not.
- Return values:
Line – Status.
-
__HAL_RTC_ALARM_EXTI_CLEAR_FLAG()
Clear the RTC Alarm associated Exti line flag.
- Return values:
None. –
-
__HAL_RTC_ALARM_EXTI_GENERATE_SWIT()
Generate a Software interrupt on RTC Alarm associated Exti line.
- Return values:
None. –
-
__HAL_RTC_WAKEUPTIMER_GET_FLAG(__HANDLE__, __FLAG__)
Get the selected RTC WakeUpTimer’s flag status.
- Parameters:
__HANDLE__ – specifies the RTC handle.
__FLAG__ – specifies the RTC WakeUpTimer Flag to check. This parameter can be:
RTC_FLAG_WUTF
RTC_FLAG_WUTWF
- Return values:
None –
-
__HAL_RTC_WAKEUPTIMER_ENABLE(__HANDLE__)
Enable the RTC WakeUp Timer peripheral.
- Parameters:
__HANDLE__ – specifies the RTC handle.
- Return values:
None –
-
__HAL_RTC_WAKEUPTIMER_DISABLE(__HANDLE__)
Disable the RTC Wake-up Timer peripheral.
- Parameters:
__HANDLE__ – specifies the RTC handle.
- Return values:
None –
-
__HAL_RTC_WAKEUPTIMER_ENABLE_IT(__HANDLE__)
Enable the RTC WakeUpTimer interrupt.
- Parameters:
__HANDLE__ – specifies the RTC handle.
- Return values:
None –
-
__HAL_RTC_WAKEUPTIMER_DISABLE_IT(__HANDLE__)
Disable the RTC Alarm interrupt.
- Parameters:
__HANDLE__ – specifies the RTC handle.
- Return values:
None –
-
__HAL_RTC_WAKEUPTIMER_GET_IT(__HANDLE__)
Check whether the specified RTC WakeUpTimer interrupt has occurred or not.
- Parameters:
__HANDLE__ – specifies the RTC handle.
- Return values:
None –
-
__HAL_RTC_WAKEUPTIMER_CLEAR_FLAG(__HANDLE__, __FLAG__)
Clear the RTC Wake Up timer’s pending flags.
- Parameters:
__HANDLE__ – specifies the RTC handle.
__FLAG__ – specifies the RTC Tamper Flag sources to be enabled or disabled. This parameter can be:
RTC_FLAG_WUTF
- Return values:
None –
-
HAL_RTC_LXT_ENABLED()
-
HAL_RTC_ENABLE_LXT()
-
RTC_INIT_NORMAL
-
RTC_INIT_SKIP
-
RTC_INIT_REINIT
-
HAL_PBR0_FORCE1_ENABLE()
-
HAL_PBR0_FORCE1_DISABLE()
-
RTC_TR_RESERVED_MASK
-
RTC_DR_RESERVED_MASK
-
RTC_INIT_MASK
-
RTC_RSF_MASK
-
RTC_FLAGS_MASK
-
RTC_TIMEOUT_VALUE
-
RTC_EXTI_LINE_ALARM_EVENT
External interrupt line 17 Connected to the RTC Alarm event
-
IS_RTC_HOUR_FORMAT(FORMAT)
-
IS_RTC_OUTPUT(OUTPUT)
-
IS_RTC_OUTPUT_POL(POL)
-
IS_RTC_OUTPUT_TYPE(TYPE)
-
IS_RTC_HOUR12(HOUR)
-
IS_RTC_HOUR24(HOUR)
-
IS_RTC_ASYNCH_PREDIV(PREDIV)
-
IS_RTC_SYNCH_PREDIV(PREDIV)
-
IS_RTC_MINUTES(MINUTES)
-
IS_RTC_SECONDS(SECONDS)
-
IS_RTC_HOURFORMAT12(PM)
-
IS_RTC_DAYLIGHT_SAVING(SAVE)
-
IS_RTC_STORE_OPERATION(OPERATION)
-
IS_RTC_FORMAT(FORMAT)
-
IS_RTC_YEAR(YEAR)
-
IS_RTC_MONTH(MONTH)
-
IS_RTC_DATE(DATE)
-
IS_RTC_WEEKDAY(WEEKDAY)
-
IS_RTC_ALARM_DATE_WEEKDAY_DATE(DATE)
-
IS_RTC_ALARM_DATE_WEEKDAY_WEEKDAY(WEEKDAY)
-
IS_RTC_ALARM_DATE_WEEKDAY_SEL(SEL)
-
IS_RTC_ALARM_MASK(MASK)
-
IS_RTC_ALARM(ALARM)
-
IS_RTC_ALARM_SUB_SECOND_VALUE(VALUE)
-
IS_RTC_ALARM_SUB_SECOND_MASK(MASK)
Typedefs
-
typedef void (*RTC_cb)(int reason)
Call back definition of RTC module.
- Param reason:
[in] Callback reason, should be RTC_CBK_XXX, -1 if unknown reason.
Enums
-
enum HAL_RTCStateTypeDef
HAL State structures definition.
Values:
-
enumerator HAL_RTC_STATE_RESET
RTC not yet initialized or disabled
-
enumerator HAL_RTC_STATE_READY
RTC initialized and ready for use
-
enumerator HAL_RTC_STATE_BUSY
RTC process is ongoing
-
enumerator HAL_RTC_STATE_TIMEOUT
RTC timeout state
-
enumerator HAL_RTC_STATE_ERROR
RTC error state
-
enumerator HAL_RTC_STATE_RESET
Functions
-
HAL_StatusTypeDef HAL_RTC_Init(RTC_HandleTypeDef *hrtc, uint32_t wakesrc)
Initializes the RTC peripheral.
- Parameters:
hrtc – pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC.
wakesrc – wakeup source, see RTC_INIT_XXX
- Return values:
HAL – status
-
HAL_StatusTypeDef HAL_RTC_DeInit(RTC_HandleTypeDef *hrtc)
DeInitializes the RTC peripheral.
Note
This function doesn’t reset the RTC Backup Data registers.
- Parameters:
hrtc – pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC.
- Return values:
HAL – status
-
void HAL_RTC_MspInit(RTC_HandleTypeDef *hrtc)
Initializes the RTC MSP.
- Parameters:
hrtc – pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC.
- Return values:
None –
-
void HAL_RTC_MspDeInit(RTC_HandleTypeDef *hrtc)
DeInitializes the RTC MSP.
- Parameters:
hrtc – pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC.
- Return values:
None –
-
HAL_StatusTypeDef HAL_RTC_SetTime(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTime, uint32_t Format)
Sets RTC current time.
- Parameters:
hrtc – pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC.
sTime – Pointer to Time structure
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
- Return values:
HAL – status
-
HAL_StatusTypeDef HAL_RTC_GetTime(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTime, uint32_t Format)
Gets RTC current time.
Note
You can use SubSeconds and SecondFraction (sTime structure fields returned) to convert SubSeconds value in second fraction ratio with time unit following generic formula: Second fraction ratio * time_unit= [(SecondFraction-SubSeconds)/(SecondFraction+1)] * time_unit This conversion can be performed only if no shift operation is pending (ie. SHFP=0) when PREDIV_S >= SS
Note
You must call HAL_RTC_GetDate() after HAL_RTC_GetTime() to unlock the values in the higher-order calendar shadow registers to ensure consistency between the time and date values. Reading RTC current time locks the values in calendar shadow registers until current date is read.
- Parameters:
hrtc – pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC.
sTime – Pointer to Time structure
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
- Return values:
HAL – status
-
HAL_StatusTypeDef HAL_RTC_SetDate(RTC_HandleTypeDef *hrtc, RTC_DateTypeDef *sDate, uint32_t Format)
Sets RTC current date.
- Parameters:
hrtc – pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC.
sDate – Pointer to date structure
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
- Return values:
HAL – status
-
HAL_StatusTypeDef HAL_RTC_GetDate(RTC_HandleTypeDef *hrtc, RTC_DateTypeDef *sDate, uint32_t Format)
Gets RTC current date.
Note
You must call HAL_RTC_GetDate() after HAL_RTC_GetTime() to unlock the values in the higher-order calendar shadow registers to ensure consistency between the time and date values. Reading RTC current time locks the values in calendar shadow registers until Current date is read.
- Parameters:
hrtc – pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC.
sDate – Pointer to Date structure
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
- Return values:
HAL – status
-
HAL_StatusTypeDef HAL_RTC_IncOneSecond(RTC_HandleTypeDef *hrtc, int32_t increase)
Increase/Decrease RTC by 1 second..
- Parameters:
hrtc – pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC.
increase – >0: increase, <0:decrease, 0 no change
- Return values:
HAL – status
-
HAL_StatusTypeDef HAL_RTC_SetAlarm(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Format)
Sets the specified RTC Alarm.
- Parameters:
hrtc – pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC.
sAlarm – Pointer to Alarm structure
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
- Return values:
HAL – status
-
HAL_StatusTypeDef HAL_RTC_SetAlarm_IT(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Format)
Sets the specified RTC Alarm.
- Parameters:
hrtc – pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC.
sAlarm – Pointer to Alarm structure
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
- Return values:
HAL – status
-
HAL_StatusTypeDef HAL_RTC_DeactivateAlarm(RTC_HandleTypeDef *hrtc)
Deactivate the specified RTC Alarm.
- Parameters:
hrtc – pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC.
- Return values:
HAL – status
-
HAL_StatusTypeDef HAL_RTC_GetAlarm(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Format)
Gets the RTC Alarm value and masks.
- Parameters:
hrtc – pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC.
sAlarm – Pointer to Date structure
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
- Return values:
HAL – status
-
void HAL_RTC_AlarmIRQHandler(RTC_HandleTypeDef *hrtc)
-
HAL_StatusTypeDef HAL_RTC_PollForAlarmAEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout)
This function handles AlarmA Polling request.
- Parameters:
hrtc – pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC.
Timeout – Timeout duration
- Return values:
HAL – status
-
void HAL_RTC_AlarmAEventCallback(RTC_HandleTypeDef *hrtc)
Alarm A callback.
- Parameters:
hrtc – pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC.
- Return values:
None –
-
HAL_StatusTypeDef HAL_RTC_SetWakeUpTimer(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock)
Sets wake up timer with interrupt.
- Parameters:
hrtc – pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC.
WakeUpCounter – Wake up counter
WakeUpClock – Wake up clock, see RTC wakeup clock selection
- Return values:
HAL – status
-
uint32_t HAL_RTC_DeactivateWakeUpTimer(RTC_HandleTypeDef *hrtc)
Deactivates wake up timer counter.
- Parameters:
hrtc – pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC.
- Return values:
HAL – status
-
uint32_t HAL_RTC_GetWakeUpTimer(RTC_HandleTypeDef *hrtc)
Gets wake up timer counter.
- Parameters:
hrtc – pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC.
- Return values:
Counter – value
-
void HAL_RTC_WakeupTimerEventCallback(RTC_HandleTypeDef *hrtc)
Wakeup Timer callback.
- Parameters:
hrtc – pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC.
- Return values:
None –
-
void HAL_RTC_IRQHandler(RTC_HandleTypeDef *hrtc)
This function handles Alarm interrupt request.
- Parameters:
hrtc – pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC.
- Return values:
None –
-
HAL_StatusTypeDef HAL_RTC_WaitForSynchro(RTC_HandleTypeDef *hrtc)
Waits until the RTC Time and Date registers (RTC_TR and RTC_DR) are synchronized with RTC APB clock.
Note
To read the calendar through the shadow registers after Calendar initialization, calendar update or after wake-up from low power modes the software must first clear the RSF flag. The software must then wait until it is set again before reading the calendar, which means that the calendar registers have been correctly copied into the RTC_TR and RTC_DR shadow registers.
- Parameters:
hrtc – pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC.
- Return values:
HAL – status
-
HAL_RTCStateTypeDef HAL_RTC_GetState(RTC_HandleTypeDef *hrtc)
Returns the RTC state.
- Parameters:
hrtc – pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC.
- Return values:
HAL – state
-
void HAL_RTC_set_backup(RTC_HandleTypeDef *hrtc, uint8_t idx, uint32_t value)
Set the RTC backup register.
- Parameters:
hrtc – pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC.
idx – index of backup register
value – value to set into backup register
- Return values:
None –
-
uint32_t HAL_RTC_get_backup(RTC_HandleTypeDef *hrtc, uint8_t idx)
get the RTC backup register value.
- Parameters:
hrtc – pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC.
idx – index of backup register
- Return values:
value – saved in the backup register
-
void HAL_RTC_RegCallback(RTC_HandleTypeDef *hrtc, RTC_cb cbk)
Register call back functions for RTC module.
- Parameters:
hrtc – pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC.
cbk – callback function to be registered.
- Return values:
None –
-
HAL_StatusTypeDef HAL_PBR_ConfigMode(uint8_t pin, bool output_en)
config PBR pin mode
- Parameters:
pin – [in] PBR pin index, starting from 0
output_en – [in] true: output mode, false: input mode
- Return values:
HAL – status
-
int8_t HAL_PBR_ReadPin(uint8_t pin)
Read PBR pin state.
- Parameters:
pin – [in] PBR pin index, starting from 0
- Return values:
0 – and 1 are valid value, if less than 0, some error happens, e.g. pin is invalid
-
HAL_StatusTypeDef HAL_PBR_WritePin(uint8_t pin, uint8_t state)
Set PBR pin state.
- Parameters:
pin – [in] PBR pin index, starting from 0
state – [in] pin state, 0 and 1 are valid vallue
- Return values:
HAL – status
-
HAL_StatusTypeDef HAL_PBR_GetMode(uint8_t pin, bool *output_en)
Get PBR pin mode.
- Parameters:
pin – [in] PBR pin index, starting from 0
output_en – [inout] pointer to pin mode, true: output mode, false: input mode
- Return values:
HAL – status
-
HAL_StatusTypeDef RTC_EnterInitMode(RTC_HandleTypeDef *hrtc)
Enters the RTC Initialization mode.
Note
The RTC Initialization mode is write protected, use the __HAL_RTC_WRITEPROTECTION_DISABLE() before calling this function.
- Parameters:
hrtc – pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC.
- Return values:
HAL – status
-
uint8_t RTC_ByteToBcd2(uint8_t Value)
Converts a 2 digit decimal to BCD format.
- Parameters:
Value – Byte to be converted
- Return values:
Converted – byte
-
uint8_t RTC_Bcd2ToByte(uint8_t Value)
Converts from 2 digit BCD to Binary.
- Parameters:
Value – BCD value to be converted
- Return values:
Converted – word
-
struct RTC_InitTypeDef
- #include <bf0_hal_rtc.h>
RTC Configuration Structure definition.
Public Members
-
uint32_t HourFormat
Specifies the RTC Hour Format. This parameter can be a value of RTC Hour Formats
-
uint32_t DivAInt
Specifies the RTC Divider A integrate value. This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x80
-
uint32_t DivAFrac
Specifies the RTC Divider A fraction value.
-
uint32_t DivB
Specifies the RTC Divider B value. This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x100U
-
uint32_t HourFormat
-
struct RTC_TimeTypeDef
- #include <bf0_hal_rtc.h>
RTC Time structure definition.
Public Members
-
uint8_t Hours
Specifies the RTC Time Hour. This parameter must be a number between Min_Data = 0 and Max_Data = 12 if the RTC_HourFormat_12 is selected. This parameter must be a number between Min_Data = 0 and Max_Data = 23 if the RTC_HourFormat_24 is selected
-
uint8_t Minutes
Specifies the RTC Time Minutes. This parameter must be a number between Min_Data = 0 and Max_Data = 59
-
uint8_t Seconds
Specifies the RTC Time Seconds. This parameter must be a number between Min_Data = 0 and Max_Data = 59
-
uint8_t TimeFormat
Specifies the RTC AM/PM Time. This parameter can be a value of RTC AM PM Definitions
-
uint32_t SubSeconds
Specifies the RTC_SSR RTC Sub Second register content. This parameter corresponds to a time unit range between [0-1] Second with [1 Sec / SecondFraction] granularity
-
uint32_t SecondFractionInt
Specifies the range or granularity of Sub Second register content corresponding to Synchronous DivA integrade factor value This parameter corresponds to SecondFraction integrade part. SecondFraction is calcualted by [Fclk << 2^14 / (SecondFractionInt << 2^14) + SecondFractionFrac]. This field will be used only by HAL_RTC_GetTime function
-
uint32_t SecondFractionFrac
Specifies the range or granularity of Sub Second register content corresponding to Synchronous DivA fraction factor value This parameter corresponds to SecondFraction fraction part. SecondFraction is calcualted by [Fclk << 2^14 / (SecondFractionInt << 2^14) + SecondFractionFrac]. This field will be used only by HAL_RTC_GetTime function
-
uint32_t DayLightSaving
Specifies DayLight Save Operation. This parameter can be a value of RTC DayLight Saving Definitions
-
uint32_t StoreOperation
Specifies RTC_StoreOperation value to be written in the BCK bit in CR register to store the operation. This parameter can be a value of RTC Store Operation Definitions
-
uint8_t Hours
-
struct RTC_DateTypeDef
- #include <bf0_hal_rtc.h>
RTC Date structure definition.
Public Members
-
uint8_t WeekDay
Specifies the RTC Date WeekDay. This parameter can be a value of RTC WeekDay Definitions
-
uint8_t Month
Specifies the RTC Date Month (in BCD format). This parameter can be a value of RTC Month Date Definitions
-
uint8_t Date
Specifies the RTC Date. This parameter must be a number between Min_Data = 1 and Max_Data = 31
-
uint8_t Year
Specifies the RTC Date Year as offset of 1900. This parameter must be a number between Min_Data = 0 and Max_Data = 199 if Year<70, The year will be 2000+Year, RTC_CENTURY_BIT will be set Other wise, The year will be 1900+Year, RTC_CENTURY_BIT will be clear
-
uint8_t WeekDay
-
struct RTC_AlarmTypeDef
- #include <bf0_hal_rtc.h>
RTC Alarm structure definition.
Public Members
-
RTC_TimeTypeDef AlarmTime
Specifies the RTC Alarm Time members
-
RTC_DateTypeDef AlarmDate
Specifies the RTC Alarm date members
-
uint32_t AlarmMask
Specifies the RTC Alarm Masks. This parameter can be a value of RTC Alarm Mask Definitions
-
uint32_t AlarmSubSecondMask
Specifies the RTC Alarm SubSeconds Masks. This parameter can be a value of RTC Alarm Sub Seconds Masks Definitions
-
uint32_t AlarmDateWeekDaySel
Specifies the RTC Alarm is on Date or WeekDay. This parameter can be a value of RTC Alarm Date WeekDay Definitions
-
uint8_t AlarmDateWeekDay
Specifies the RTC Alarm Date/WeekDay. If the Alarm Date is selected, this parameter must be set to a value in the 1-31 range. If the Alarm WeekDay is selected, this parameter can be a value of RTC WeekDay Definitions
-
RTC_TimeTypeDef AlarmTime
-
struct RTC_HandleTypeDef
- #include <bf0_hal_rtc.h>
RTC Handle Structure definition.
Public Members
-
RTC_TypeDef *Instance
Register base address
-
RTC_InitTypeDef Init
RTC required parameters
-
HAL_LockTypeDef Lock
RTC locking object
-
HAL_RTCStateTypeDef State
Time communication state
-
RTC_TypeDef *Instance