久久精品国产精品国产一区,少妇扒开毛毛自慰喷水,国产精品无码电影在线观看 ,久久天天躁夜夜躁狠狠85麻豆

思澈科技軟件開發(fā)工具包  2.20
RTC

IFLI chpset 的嵌入式 RTC(實時計數(shù)器)是一個獨立的二進制編碼 - 十進制(BCD)定時器計數(shù)器。 RTC 內(nèi)核由計數(shù)器、預分頻器、時鐘分頻器、鬧鐘數(shù)據(jù)寄存器等組成。與任何標準 RTC 芯片一樣,嵌入式 RTC 可用于提供全功能的基于軟件的日歷以及鬧鐘功能。 當然還需要軟件端而不是硬件端做更多的工作。 當使用 RTC 芯片時,只需要讀取或?qū)懭雴为毜娜掌跁r間寄存器。 在 SiFli 芯片組中,我們需要做的不止這些,因為不存在單獨的日期時間寄存器。
從睡眠/待機模式重置或喚醒MCU不會重新初始化RTC。 如果電池備份(VBAT)引腳有電池備份,它可以更好的保存當前日期和時間。 SiFli芯片組的所有VDD可以關(guān)閉,但是即使整個MCU核心可以完全關(guān)閉,電池備份會使RTC和備份域運行。 因此,在斷電和睡眠模式下,時間不變或丟失。
SIFLI RTC的主要功能如下:

  • 可編程預分頻器。
    ?- 用于長期喚醒的 18 位可編程計數(shù)器。
    ?- 兩個獨立的時鐘源:用于 APB2 接口的 PCLK1 和 RTC 時鐘。
    ?- 程序接口支持日期在 1970-1-1 到 2099-12-31 之間。
    RTC 驅(qū)動的詳細 API,請參考Real timer clock 。

使用RTC

以下代碼將初始化 RTC 寄存器,并在稍后用作時間戳。

{ // Set time to Janurary 7, 2020, 16:02:15
RTC_TimeTypeDef RTC_TimeStruct = {0};
RTC_DateTypeDef RTC_DateStruct = {0};
RTC_TimeStruct.Seconds = 15 ;
RTC_TimeStruct.Minutes = 2 ;
RTC_TimeStruct.Hours = 16;
RTC_DateStruct.Date = 7;
RTC_DateStruct.Month = 1 ;
RTC_DateStruct.Year = 2020;
RTC_DateStruct.WeekDay = 2; //Tuesday.
HAL_RTC_SetTime(&RTC_Handler, &RTC_TimeStruct, RTC_FORMAT_BIN);
HAL_RTC_SetDate(&RTC_Handler, &RTC_DateStruct, RTC_FORMAT_BIN);
}
...
{ // Get current date and time.
RTC_TimeTypeDef RTC_TimeStruct = {0};
RTC_DateTypeDef RTC_DateStruct = {0};
HAL_RTC_GetTime(&RTC_Handler, &RTC_TimeStruct, RTC_FORMAT_BIN);
HAL_RTC_GetDate(&RTC_Handler, &RTC_DateStruct, RTC_FORMAT_BIN);
}

以下代碼將使用 RTC 進行報警服務。

void HAL_RTC_AlarmAEventCallback(RTC_HandleTypeDef *hrtc) // Weak symbol implement the interrupt of Alarm.
{
printf("Alarm interrupt\n");
}
...
// Set alarm at 18:30:00
RTC_AlarmTypeDef sAlarm;
sAlarm.AlarmTime.Hours = 18;
sAlarm.AlarmTime.Minutes = 30;
sAlarm.AlarmTime.Seconds = 0;
HAL_RTC_SetAlarm(&RTC_Handler, &sAlarm, RTC_FORMAT_BIN);
...
// Disable alarm
HAL_RTC_DeactivateAlarm(&RTC_Handler);
RTC_TimeTypeDef::Minutes
uint8_t Minutes
Definition: bf0_hal_rtc.h:120
RTC_TimeTypeDef
RTC Time structure definition.
Definition: bf0_hal_rtc.h:115
RTC_DateTypeDef::Year
uint8_t Year
Definition: bf0_hal_rtc.h:165
HAL_RTC_SetTime
HAL_StatusTypeDef HAL_RTC_SetTime(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTime, uint32_t Format)
Sets RTC current time.
HAL_RTC_GetTime
HAL_StatusTypeDef HAL_RTC_GetTime(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTime, uint32_t Format)
Gets RTC current time.
RTC_TimeTypeDef::Seconds
uint8_t Seconds
Definition: bf0_hal_rtc.h:123
HAL_RTC_AlarmAEventCallback
void HAL_RTC_AlarmAEventCallback(RTC_HandleTypeDef *hrtc)
Alarm A callback.
HAL_RTC_GetDate
HAL_StatusTypeDef HAL_RTC_GetDate(RTC_HandleTypeDef *hrtc, RTC_DateTypeDef *sDate, uint32_t Format)
Gets RTC current date.
RTC_DateTypeDef::Date
uint8_t Date
Definition: bf0_hal_rtc.h:162
RTC_DateTypeDef::WeekDay
uint8_t WeekDay
Definition: bf0_hal_rtc.h:156
HAL_RTC_SetAlarm
HAL_StatusTypeDef HAL_RTC_SetAlarm(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Format)
Sets the specified RTC Alarm.
RTC_HandleTypeDef
RTC Handle Structure definition.
Definition: bf0_hal_rtc.h:212
RTC_TimeTypeDef::Hours
uint8_t Hours
Definition: bf0_hal_rtc.h:116
HAL_RTC_SetDate
HAL_StatusTypeDef HAL_RTC_SetDate(RTC_HandleTypeDef *hrtc, RTC_DateTypeDef *sDate, uint32_t Format)
Sets RTC current date.
RTC_DateTypeDef::Month
uint8_t Month
Definition: bf0_hal_rtc.h:159
RTC_DateTypeDef
RTC Date structure definition.
Definition: bf0_hal_rtc.h:155