GaIA BIOS Library
Loading...
Searching...
No Matches
rtc.h File Reference

RTC driver. More...

#include <stdbool.h>
#include <stdint.h>

Data Structures

struct  rtc_datetime_t
 RTC Date and time information. More...

Enumerations

enum  time_fmt_t { TIME_FMT_12H , TIME_FMT_24H }
 Time format for hours. More...

Functions

void rtc_init (void)
 Initializes the RTC peripheral.
bool rtc_is_initialized (void)
 Checks for RTC peripheral initialization state.
void rtc_set_date (uint16_t year, uint8_t month, uint8_t dom)
 Sets the date.
void rtc_set_time (uint16_t hour, uint8_t minutes, uint8_t sec, time_fmt_t format)
 Sets the time.
void rtc_set_datetime (uint16_t year, uint8_t month, uint8_t dom, uint8_t hour, uint8_t minutes, uint8_t sec, time_fmt_t format)
 Sets data and time.
int rtc_is_set (void)
 Returns if the RTC has been already set or not.
void rtc_get_datetime (rtc_datetime_t *datetime)
 Returns the current date and time.

Detailed Description

RTC driver.

Author
Tecnologix, 2019

Enumeration Type Documentation

◆ time_fmt_t

enum time_fmt_t

Time format for hours.

Enumerator
TIME_FMT_12H 

AM/PM format.

TIME_FMT_24H 

24 hours format.

Function Documentation

◆ rtc_get_datetime()

void rtc_get_datetime ( rtc_datetime_t * datetime)

Returns the current date and time.

Parameters
datetimepointer to a structure to be filled with current date and time.

◆ rtc_is_initialized()

bool rtc_is_initialized ( void )

Checks for RTC peripheral initialization state.

Returns
true if RTC date/time are already initialized.

◆ rtc_is_set()

int rtc_is_set ( void )

Returns if the RTC has been already set or not.

Returns
0 if the RTC has not been set yet.

◆ rtc_set_date()

void rtc_set_date ( uint16_t year,
uint8_t month,
uint8_t dom )

Sets the date.

Parameters
yearyear.
monthmonth. January is 1.
domday of month.

◆ rtc_set_datetime()

void rtc_set_datetime ( uint16_t year,
uint8_t month,
uint8_t dom,
uint8_t hour,
uint8_t minutes,
uint8_t sec,
time_fmt_t format )

Sets data and time.

Parameters
yearyear.
monthmonth. January is 1.
domday of month.
hourhour.
minutesmonth.
secseconds.
formattime format (e.g. 12 or 24 hours).

◆ rtc_set_time()

void rtc_set_time ( uint16_t hour,
uint8_t minutes,
uint8_t sec,
time_fmt_t format )

Sets the time.

Parameters
hourhour.
minutesmonth.
secseconds.
formattime format (e.g. 12 or 24 hours).