L14-Click 1.0
STM32WLE5CC LoRaWAN Sensor Platform
Loading...
Searching...
No Matches
rtc.c File Reference

This file provides code for the configuration of the RTC instances. More...

#include "rtc.h"
#include "stm32_hal_legacy.h"
Include dependency graph for rtc.c:

Go to the source code of this file.

Functions

void MX_RTC_Init (void)
 Initialise the RTC peripheral with settings generated by STM32CubeMX. Configures the prescalers, calendar format, and wakeup clock source. Called once from main(); subsequent wakeup timers are set with RTC_SetWakeupTimer_10Minutes().
void HAL_RTC_MspInit (RTC_HandleTypeDef *rtcHandle)
void HAL_RTC_MspDeInit (RTC_HandleTypeDef *rtcHandle)
HAL_StatusTypeDef RTC_SetWakeupTimer_10Minutes (void)
 Configure RTC wakeup timer for 10 minutes.

Variables

RTC_HandleTypeDef hrtc
 RTC handle.

Detailed Description

This file provides code for the configuration of the RTC instances.

Attention

Copyright (c) 2026 STMicroelectronics. All rights reserved.

This software is licensed under terms that can be found in the LICENSE file in the root directory of this software component. If no LICENSE file comes with this software, it is provided AS-IS.

Definition in file rtc.c.

Function Documentation

◆ HAL_RTC_MspDeInit()

void HAL_RTC_MspDeInit ( RTC_HandleTypeDef * rtcHandle)

Definition at line 120 of file rtc.c.

◆ HAL_RTC_MspInit()

void HAL_RTC_MspInit ( RTC_HandleTypeDef * rtcHandle)

Initializes the peripherals clocks

Definition at line 87 of file rtc.c.

References Error_Handler().

Here is the call graph for this function:

◆ MX_RTC_Init()

void MX_RTC_Init ( void )

Initialise the RTC peripheral with settings generated by STM32CubeMX. Configures the prescalers, calendar format, and wakeup clock source. Called once from main(); subsequent wakeup timers are set with RTC_SetWakeupTimer_10Minutes().

Initialize RTC Only

Initialize RTC and set the Time and Date

Enable the Alarm A

Definition at line 30 of file rtc.c.

References Error_Handler(), hrtc, and RTC_PREDIV_A.

Referenced by main(), and TIMER_IF_Init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RTC_SetWakeupTimer_10Minutes()

HAL_StatusTypeDef RTC_SetWakeupTimer_10Minutes ( void )

Configure RTC wakeup timer for 10 minutes.

Configure the RTC periodic wakeup timer.

Calculation for 10 minutes (600 seconds):

  • Using RTC_WAKEUPCLOCK_CK_SPRE_16BITS which provides a 1 Hz clock
  • This clock is derived from the RTC prescalers (ck_spre = 1 Hz)
  • Counter value for 10 minutes: 600 - 1 = 599
  • Maximum counter value is 0xFFFF (65535), which allows up to ~18.2 hours
  • So 10 minutes (600 seconds) is well within limits

Definition at line 152 of file rtc.c.

References hrtc.

Variable Documentation

◆ hrtc