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

This file contains all the function prototypes for the rtc.c file. More...

#include "main.h"
Include dependency graph for rtc.h:
This graph shows which files directly or indirectly include this file:

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().
HAL_StatusTypeDef RTC_SetWakeupTimer_10Minutes (void)
 Configure the RTC periodic wakeup timer.

Variables

RTC_HandleTypeDef hrtc

Detailed Description

This file contains all the function prototypes for the rtc.c file.

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.h.

Function Documentation

◆ 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 the RTC periodic wakeup timer.

Uses RTC_WAKEUPCLOCK_CK_SPRE_16BITS (1 Hz ck_spre derived from the RTC prescalers) so that the counter value directly represents seconds minus 1. The wakeup interrupt wakes the CPU from STOP / standby mode and triggers the next sensor measurement cycle.

Note
The actual wakeup period is determined by the counter value set in the implementation (currently ~60 s; original design was 600 s = 10 min). The function name is kept for backward compatibility.
Returns
HAL_OK on success, HAL_ERROR if the timer could not be configured.

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