bf0_hal_rtc.h

HAL State structures definition.

Author

Sifli software development team

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.

参数:
  • __HANDLE__ – specifies the RTC handle.

返回值:

None

__HAL_RTC_ALARM_ENABLE(__HANDLE__)

Enable the RTC ALARM peripheral.

参数:
  • __HANDLE__ – specifies the RTC handle.

返回值:

None

__HAL_RTC_ALARM_DISABLE(__HANDLE__)

Disable the RTC ALARM peripheral.

参数:
  • __HANDLE__ – specifies the RTC handle.

返回值:

None

__HAL_RTC_ALARM_ENABLE_IT(__HANDLE__)

Enable the RTC Alarm interrupt.

参数:
  • __HANDLE__ – specifies the RTC handle.

返回值:

None

__HAL_RTC_ALARM_DISABLE_IT(__HANDLE__)

Disable the RTC Alarm interrupt.

参数:
  • __HANDLE__ – specifies the RTC handle.

返回值:

None

__HAL_RTC_ALARM_GET_IT(__HANDLE__)

Check whether the specified RTC Alarm interrupt has occurred or not.

参数:
  • __HANDLE__ – specifies the RTC handle.

返回值:

None

__HAL_RTC_ALARM_GET_FLAG(__HANDLE__, __FLAG__)

Get the selected RTC Alarm’s flag status.

参数:
  • __HANDLE__ – specifies the RTC handle.

  • __FLAG__ – specifies the RTC Alarm Flag to check. This parameter can be:

    • RTC_ISR_ALRMF

    • RTC_ISR_ALRMWF

返回值:

None

__HAL_RTC_ALARM_CLEAR_FLAG(__HANDLE__, __FLAG__)

Clear the RTC Alarm’s pending flags.

参数:
  • __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

返回值:

None

__HAL_RTC_ALARM_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__)

Check whether the specified RTC Alarm interrupt has been enabled or not.

参数:
  • __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

返回值:

None

__HAL_RTC_ALARM_EXTI_ENABLE_IT()

Enable interrupt on the RTC Alarm associated Exti line.

返回值:

None

__HAL_RTC_ALARM_EXTI_DISABLE_IT()

Disable interrupt on the RTC Alarm associated Exti line.

返回值:

None

__HAL_RTC_ALARM_EXTI_ENABLE_EVENT()

Enable event on the RTC Alarm associated Exti line.

返回值:

None.

__HAL_RTC_ALARM_EXTI_DISABLE_EVENT()

Disable event on the RTC Alarm associated Exti line.

返回值:

None.

__HAL_RTC_ALARM_EXTI_ENABLE_FALLING_EDGE()

Enable falling edge trigger on the RTC Alarm associated Exti line.

返回值:

None.

__HAL_RTC_ALARM_EXTI_DISABLE_FALLING_EDGE()

Disable falling edge trigger on the RTC Alarm associated Exti line.

返回值:

None.

__HAL_RTC_ALARM_EXTI_ENABLE_RISING_EDGE()

Enable rising edge trigger on the RTC Alarm associated Exti line.

返回值:

None.

__HAL_RTC_ALARM_EXTI_DISABLE_RISING_EDGE()

Disable rising edge trigger on the RTC Alarm associated Exti line.

返回值:

None.

__HAL_RTC_ALARM_EXTI_ENABLE_RISING_FALLING_EDGE()

Enable rising & falling edge trigger on the RTC Alarm associated Exti line.

返回值:

None.

__HAL_RTC_ALARM_EXTI_DISABLE_RISING_FALLING_EDGE()

Disable rising & falling edge trigger on the RTC Alarm associated Exti line.

返回值:

None.

__HAL_RTC_ALARM_EXTI_GET_FLAG()

Check whether the RTC Alarm associated Exti line interrupt flag is set or not.

返回值:

Line – Status.

__HAL_RTC_ALARM_EXTI_CLEAR_FLAG()

Clear the RTC Alarm associated Exti line flag.

返回值:

None.

__HAL_RTC_ALARM_EXTI_GENERATE_SWIT()

Generate a Software interrupt on RTC Alarm associated Exti line.

返回值:

None.

__HAL_RTC_WAKEUPTIMER_GET_FLAG(__HANDLE__, __FLAG__)

Get the selected RTC WakeUpTimer’s flag status.

参数:
  • __HANDLE__ – specifies the RTC handle.

  • __FLAG__ – specifies the RTC WakeUpTimer Flag to check. This parameter can be:

    • RTC_FLAG_WUTF

    • RTC_FLAG_WUTWF

返回值:

None

__HAL_RTC_WAKEUPTIMER_ENABLE(__HANDLE__)

Enable the RTC WakeUp Timer peripheral.

参数:
  • __HANDLE__ – specifies the RTC handle.

返回值:

None

__HAL_RTC_WAKEUPTIMER_DISABLE(__HANDLE__)

Disable the RTC Wake-up Timer peripheral.

参数:
  • __HANDLE__ – specifies the RTC handle.

返回值:

None

__HAL_RTC_WAKEUPTIMER_ENABLE_IT(__HANDLE__)

Enable the RTC WakeUpTimer interrupt.

参数:
  • __HANDLE__ – specifies the RTC handle.

返回值:

None

__HAL_RTC_WAKEUPTIMER_DISABLE_IT(__HANDLE__)

Disable the RTC Alarm interrupt.

参数:
  • __HANDLE__ – specifies the RTC handle.

返回值:

None

__HAL_RTC_WAKEUPTIMER_GET_IT(__HANDLE__)

Check whether the specified RTC WakeUpTimer interrupt has occurred or not.

参数:
  • __HANDLE__ – specifies the RTC handle.

返回值:

None

__HAL_RTC_WAKEUPTIMER_CLEAR_FLAG(__HANDLE__, __FLAG__)

Clear the RTC Wake Up timer’s pending flags.

参数:
  • __HANDLE__ – specifies the RTC handle.

  • __FLAG__ – specifies the RTC Tamper Flag sources to be enabled or disabled. This parameter can be:

    • RTC_FLAG_WUTF

返回值:

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

Functions

HAL_StatusTypeDef HAL_RTC_Init(RTC_HandleTypeDef *hrtc, uint32_t wakesrc)

Initializes the RTC peripheral.

参数:
  • hrtc – pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC.

  • wakesrc – wakeup source, see RTC_INIT_XXX

返回值:

HAL – status

HAL_StatusTypeDef HAL_RTC_DeInit(RTC_HandleTypeDef *hrtc)

DeInitializes the RTC peripheral.

备注

This function doesn’t reset the RTC Backup Data registers.

参数:
  • hrtc – pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC.

返回值:

HAL – status

void HAL_RTC_MspInit(RTC_HandleTypeDef *hrtc)

Initializes the RTC MSP.

参数:
  • hrtc – pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC.

返回值:

None

void HAL_RTC_MspDeInit(RTC_HandleTypeDef *hrtc)

DeInitializes the RTC MSP.

参数:
  • hrtc – pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC.

返回值:

None

HAL_StatusTypeDef HAL_RTC_SetTime(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTime, uint32_t Format)

Sets RTC current time.

参数:
  • 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

返回值:

HAL – status

HAL_StatusTypeDef HAL_RTC_GetTime(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTime, uint32_t Format)

Gets RTC current time.

备注

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

备注

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.

参数:
  • 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

返回值:

HAL – status

HAL_StatusTypeDef HAL_RTC_SetDate(RTC_HandleTypeDef *hrtc, RTC_DateTypeDef *sDate, uint32_t Format)

Sets RTC current date.

参数:
  • 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

返回值:

HAL – status

HAL_StatusTypeDef HAL_RTC_GetDate(RTC_HandleTypeDef *hrtc, RTC_DateTypeDef *sDate, uint32_t Format)

Gets RTC current date.

备注

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.

参数:
  • 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

返回值:

HAL – status

HAL_StatusTypeDef HAL_RTC_IncOneSecond(RTC_HandleTypeDef *hrtc, int32_t increase)

Increase/Decrease RTC by 1 second..

参数:
  • hrtc – pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC.

  • increase – >0: increase, <0:decrease, 0 no change

返回值:

HAL – status

HAL_StatusTypeDef HAL_RTC_SetAlarm(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Format)

Sets the specified RTC Alarm.

参数:
  • 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

返回值:

HAL – status

HAL_StatusTypeDef HAL_RTC_SetAlarm_IT(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Format)

Sets the specified RTC Alarm.

参数:
  • 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

返回值:

HAL – status

HAL_StatusTypeDef HAL_RTC_DeactivateAlarm(RTC_HandleTypeDef *hrtc)

Deactivate the specified RTC Alarm.

参数:
  • hrtc – pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC.

返回值:

HAL – status

HAL_StatusTypeDef HAL_RTC_GetAlarm(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Format)

Gets the RTC Alarm value and masks.

参数:
  • 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

返回值:

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.

参数:
  • hrtc – pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC.

  • Timeout – Timeout duration

返回值:

HAL – status

void HAL_RTC_AlarmAEventCallback(RTC_HandleTypeDef *hrtc)

Alarm A callback.

参数:
  • hrtc – pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC.

返回值:

None

HAL_StatusTypeDef HAL_RTC_SetWakeUpTimer(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock)

Sets wake up timer with interrupt.

参数:
  • 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

返回值:

HAL – status

uint32_t HAL_RTC_DeactivateWakeUpTimer(RTC_HandleTypeDef *hrtc)

Deactivates wake up timer counter.

参数:
  • hrtc – pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC.

返回值:

HAL – status

uint32_t HAL_RTC_GetWakeUpTimer(RTC_HandleTypeDef *hrtc)

Gets wake up timer counter.

参数:
  • hrtc – pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC.

返回值:

Counter – value

void HAL_RTC_WakeupTimerEventCallback(RTC_HandleTypeDef *hrtc)

Wakeup Timer callback.

参数:
  • hrtc – pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC.

返回值:

None

void HAL_RTC_IRQHandler(RTC_HandleTypeDef *hrtc)

This function handles Alarm interrupt request.

参数:
  • hrtc – pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC.

返回值:

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.

备注

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.

参数:
  • hrtc – pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC.

返回值:

HAL – status

HAL_RTCStateTypeDef HAL_RTC_GetState(RTC_HandleTypeDef *hrtc)

Returns the RTC state.

参数:
  • hrtc – pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC.

返回值:

HAL – state

void HAL_RTC_set_backup(RTC_HandleTypeDef *hrtc, uint8_t idx, uint32_t value)

Set the RTC backup register.

参数:
  • 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

返回值:

None

uint32_t HAL_RTC_get_backup(RTC_HandleTypeDef *hrtc, uint8_t idx)

get the RTC backup register value.

参数:
  • hrtc – pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC.

  • idx – index of backup register

返回值:

value – saved in the backup register

void HAL_RTC_RegCallback(RTC_HandleTypeDef *hrtc, RTC_cb cbk)

Register call back functions for RTC module.

参数:
  • hrtc – pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC.

  • cbk – callback function to be registered.

返回值:

None

HAL_StatusTypeDef HAL_PBR_ConfigMode(uint8_t pin, bool output_en)

config PBR pin mode

参数:
  • pin[in] PBR pin index, starting from 0

  • output_en[in] true: output mode, false: input mode

返回值:

HAL – status

int8_t HAL_PBR_ReadPin(uint8_t pin)

Read PBR pin state.

参数:
  • pin[in] PBR pin index, starting from 0

返回值:

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.

参数:
  • pin[in] PBR pin index, starting from 0

  • state[in] pin state, 0 and 1 are valid vallue

返回值:

HAL – status

HAL_StatusTypeDef HAL_PBR_GetMode(uint8_t pin, bool *output_en)

Get PBR pin mode.

参数:
  • pin[in] PBR pin index, starting from 0

  • output_en[inout] pointer to pin mode, true: output mode, false: input mode

返回值:

HAL – status

HAL_StatusTypeDef RTC_EnterInitMode(RTC_HandleTypeDef *hrtc)

Enters the RTC Initialization mode.

备注

The RTC Initialization mode is write protected, use the __HAL_RTC_WRITEPROTECTION_DISABLE() before calling this function.

参数:
  • hrtc – pointer to a RTC_HandleTypeDef structure that contains the configuration information for RTC.

返回值:

HAL – status

uint8_t RTC_ByteToBcd2(uint8_t Value)

Converts a 2 digit decimal to BCD format.

参数:
  • Value – Byte to be converted

返回值:

Converted – byte

uint8_t RTC_Bcd2ToByte(uint8_t Value)

Converts from 2 digit BCD to Binary.

参数:
  • Value – BCD value to be converted

返回值:

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

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

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

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

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_cb callback

RTC callback