Loading...
Searching...
No Matches
rtc.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2014 Thomas Eichinger <thomas.eichinger@fu-berlin.de>
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser General
5 * Public License v2.1. See the file LICENSE in the top level directory for more
6 * details.
7 */
8
37#ifndef PERIPH_RTC_H
38#define PERIPH_RTC_H
39
40#include <stdbool.h>
41#include <stdint.h>
42#include <time.h>
43#include "rtc_utils.h"
44#include "periph_conf.h"
45
46#ifdef __cplusplus
47extern "C" {
48#endif
49
50#if !defined(RIOT_EPOCH) || DOXYGEN
59#define RIOT_EPOCH (2020)
60#endif
61
67typedef void(*rtc_alarm_cb_t)(void *arg);
68
72void rtc_init(void);
73
82int rtc_set_time(struct tm *time);
83
92int rtc_get_time(struct tm *time);
93
105int rtc_get_time_ms(struct tm *time, uint16_t *ms);
106
125int rtc_set_alarm(struct tm *time, rtc_alarm_cb_t cb, void *arg);
126
135int rtc_get_alarm(struct tm *time);
136
141
145void rtc_poweron(void);
146
150void rtc_poweroff(void);
151
152#ifdef __cplusplus
153}
154#endif
155
156#endif /* PERIPH_RTC_H */
void(* rtc_alarm_cb_t)(void *arg)
Signature for alarm Callback.
Definition rtc.h:67
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.