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
35
36#include <stdbool.h>
37#include <stdint.h>
38#include <time.h>
39#include "rtc_utils.h"
40#include "periph_conf.h"
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
46#if !defined(RIOT_EPOCH) || DOXYGEN
55#define RIOT_EPOCH (2020)
56#endif
57
63typedef void(*rtc_alarm_cb_t)(void *arg);
64
68void rtc_init(void);
69
78int rtc_set_time(struct tm *time);
79
88int rtc_get_time(struct tm *time);
89
101int rtc_get_time_ms(struct tm *time, uint16_t *ms);
102
121int rtc_set_alarm(struct tm *time, rtc_alarm_cb_t cb, void *arg);
122
131int rtc_get_alarm(struct tm *time);
132
137
141void rtc_poweron(void);
142
146void rtc_poweroff(void);
147
148#ifdef __cplusplus
149}
150#endif
151
void(* rtc_alarm_cb_t)(void *arg)
Signature for alarm Callback.
Definition rtc.h:63
int rtc_set_alarm(struct tm *time, rtc_alarm_cb_t cb, void *arg)
Set an alarm for 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 RTC to given time.
void rtc_clear_alarm(void)
Clear any set alarm, do nothing if nothing set.
int rtc_get_time(struct tm *time)
Get current RTC time.
void rtc_init(void)
Initialize RTC module.
void rtc_poweron(void)
Turns the RTC hardware module on.
int rtc_get_time_ms(struct tm *time, uint16_t *ms)
Get current RTC time with sub-second component.