Core
Loading...
Searching...
No Matches
rtc.c File Reference

Core RTC library. More...

#include <stdint.h>
#include <stdbool.h>
#include <time.h>
#include "rtc.h"
#include "clock.h"
#include "core_config.h"
#include <stm32g4xx_hal.h>

Functions

bool core_RTC_init ()
 Initialize the RTC module.
 
void core_RTC_get_time (struct tm *tm)
 Get the current RTC time as a tm struct (as defined in time.h)
 
void core_RTC_set_time (struct tm *tm)
 Set the current RTC time from a tm struct (as defined in time.h)
 
uint32_t core_RTC_get_usec ()
 Get the microsecond value associated with the most recent core_RTC_get_time() call.
 

Detailed Description

Core RTC library.

The core library component is used to set and get the current time using the internal RTC module.

Function Documentation

◆ core_RTC_get_time()

void core_RTC_get_time ( struct tm * tm)

Get the current RTC time as a tm struct (as defined in time.h)

When this function is called, the microsecond value is calculated but is not stored in the struct. This value can be retrieved with a subsequent call to core_RTC_get_usec().

Parameters
tmPointer to a tm struct

◆ core_RTC_get_usec()

uint32_t core_RTC_get_usec ( )

Get the microsecond value associated with the most recent core_RTC_get_time() call.

Returns
The microsecond value

◆ core_RTC_init()

bool core_RTC_init ( )

Initialize the RTC module.

Return values
1if the initialization is successful
0otherwise

◆ core_RTC_set_time()

void core_RTC_set_time ( struct tm * tm)

Set the current RTC time from a tm struct (as defined in time.h)

Parameters
tmPointer to a tm struct