Loading...
Searching...
No Matches
rtc.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2014 Thomas Eichinger <thomas.eichinger@fu-berlin.de>
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
43
44#include <stdbool.h>
45#include <stdint.h>
46#include <time.h>
47#include "rtc_utils.h"
48#include "periph_conf.h"
49
50#ifdef __cplusplus
51extern "C" {
52#endif
53
62#if !defined(RIOT_EPOCH)
63# define RIOT_EPOCH (2020)
64#endif
65
71typedef void(*rtc_alarm_cb_t)(void *arg);
72
76void rtc_init(void);
77
86int rtc_set_time(struct tm *time);
87
96int rtc_get_time(struct tm *time);
97
109int rtc_get_time_ms(struct tm *time, uint16_t *ms);
110
129int rtc_set_alarm(struct tm *time, rtc_alarm_cb_t cb, void *arg);
130
139int rtc_get_alarm(struct tm *time);
140
145
149void rtc_poweron(void);
150
154void rtc_poweroff(void);
155
156#ifdef __cplusplus
157}
158#endif
159
void(* rtc_alarm_cb_t)(void *arg)
Signature for alarm Callback.
Definition rtc.h:71
int rtc_set_alarm(struct tm *time, rtc_alarm_cb_t cb, void *arg)
Set an alarm for the RTC to the specified value.
int rtc_get_alarm(struct tm *time)
Gets the current alarm setting.
void rtc_poweroff(void)
Turns the RTC hardware module off.
int rtc_set_time(struct tm *time)
Set the RTC to a given time.
void rtc_clear_alarm(void)
Clear any set alarm, do nothing if nothing is set.
int rtc_get_time(struct tm *time)
Get the current RTC time.
void rtc_init(void)
Initialize the RTC module.
void rtc_poweron(void)
Turns the RTC hardware module on.
int rtc_get_time_ms(struct tm *time, uint16_t *ms)
Get the current RTC time with a sub-second component.