mirror of https://github.com/ARMmbed/mbed-os.git
STM32 RTC: initializes structures
parent
df88a9dcc2
commit
c571d8d6f8
|
@ -57,8 +57,8 @@ static void RTC_IRQHandler(void);
|
||||||
|
|
||||||
void rtc_init(void)
|
void rtc_init(void)
|
||||||
{
|
{
|
||||||
RCC_OscInitTypeDef RCC_OscInitStruct;
|
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
|
||||||
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct;
|
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
|
||||||
|
|
||||||
// Enable access to Backup domain
|
// Enable access to Backup domain
|
||||||
HAL_PWR_EnableBkUpAccess();
|
HAL_PWR_EnableBkUpAccess();
|
||||||
|
@ -162,7 +162,7 @@ void rtc_free(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Disable LSI and LSE clocks
|
// Disable LSI and LSE clocks
|
||||||
RCC_OscInitTypeDef RCC_OscInitStruct;
|
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
|
||||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSI | RCC_OSCILLATORTYPE_LSE;
|
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSI | RCC_OSCILLATORTYPE_LSE;
|
||||||
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
|
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
|
||||||
RCC_OscInitStruct.LSIState = RCC_LSI_OFF;
|
RCC_OscInitStruct.LSIState = RCC_LSI_OFF;
|
||||||
|
@ -217,8 +217,8 @@ It is then not a problem to not use shifts.
|
||||||
|
|
||||||
time_t rtc_read(void)
|
time_t rtc_read(void)
|
||||||
{
|
{
|
||||||
RTC_DateTypeDef dateStruct;
|
RTC_DateTypeDef dateStruct = {0};
|
||||||
RTC_TimeTypeDef timeStruct;
|
RTC_TimeTypeDef timeStruct = {0};
|
||||||
struct tm timeinfo;
|
struct tm timeinfo;
|
||||||
|
|
||||||
RtcHandle.Instance = RTC;
|
RtcHandle.Instance = RTC;
|
||||||
|
@ -247,8 +247,8 @@ time_t rtc_read(void)
|
||||||
|
|
||||||
void rtc_write(time_t t)
|
void rtc_write(time_t t)
|
||||||
{
|
{
|
||||||
RTC_DateTypeDef dateStruct;
|
RTC_DateTypeDef dateStruct = {0};
|
||||||
RTC_TimeTypeDef timeStruct;
|
RTC_TimeTypeDef timeStruct = {0};
|
||||||
|
|
||||||
RtcHandle.Instance = RTC;
|
RtcHandle.Instance = RTC;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue