RTC driver.
More...
#include <stdbool.h>
#include <stdint.h>
|
|
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.
|
RTC driver.
- Author
- Tecnologix, 2019
◆ time_fmt_t
Time format for hours.
| Enumerator |
|---|
| TIME_FMT_12H | AM/PM format.
|
| TIME_FMT_24H | 24 hours format.
|
◆ rtc_get_datetime()
Returns the current date and time.
- Parameters
-
| datetime | pointer 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()
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
-
| year | year. |
| month | month. January is 1. |
| dom | day 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
-
| year | year. |
| month | month. January is 1. |
| dom | day of month. |
| hour | hour. |
| minutes | month. |
| sec | seconds. |
| format | time 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
-
| hour | hour. |
| minutes | month. |
| sec | seconds. |
| format | time format (e.g. 12 or 24 hours). |