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
9#pragma once
10
38
39#include <stdbool.h>
40#include <stdint.h>
41#include <time.h>
42#include "rtc_utils.h"
43#include "periph_conf.h"
44
45#ifdef __cplusplus
46extern "C" {
47#endif
48
49#if !defined(RIOT_EPOCH) || DOXYGEN
58#define RIOT_EPOCH (2020)
59#endif
60
66typedef void(*rtc_alarm_cb_t)(void *arg);
67
71void rtc_init(void);
72
81int rtc_set_time(struct tm *time);
82
91int rtc_get_time(struct tm *time);
92
104int rtc_get_time_ms(struct tm *time, uint16_t *ms);
105
124int rtc_set_alarm(struct tm *time, rtc_alarm_cb_t cb, void *arg);
125
134int rtc_get_alarm(struct tm *time);
135
140
144void rtc_poweron(void);
145
149void rtc_poweroff(void);
150
151#ifdef __cplusplus
152}
153#endif
154
void(* rtc_alarm_cb_t)(void *arg)
Signature for alarm Callback.
Definition rtc.h:66
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.