Developer World
Spresense Arduino Library v3.2.0-77d75a4
RTC.h
Go to the documentation of this file.
1/*
2 * RTC.h - Spresense Arduino RTC library
3 * Copyright 2018 Sony Semiconductor Solutions Corporation
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20#ifndef __RTC_H__
21#define __RTC_H__
22
38#include "RtcTime.h"
39
46{
47public:
51 RtcClass() : _fd(-1), _pid(-1) {}
52
58 void begin();
59
63 void end();
64
69 void setTime(RtcTime &rtc);
70
76
77#ifndef SUBCORE
82 void setAlarm(RtcTime &rtc);
83
88 void setAlarmSeconds(uint32_t seconds);
89
94
99 void attachAlarm(void (*isr)(void));
100
105
106#endif /* !SUBCORE */
107
108private:
109 int _fd;
110 pthread_t _pid;
111
112};
113
114extern RtcClass RTC;
115
118#endif // __RTC_H__
This is the interface to the RTC Hardware.
Definition: RTC.h:46
RtcTime getTime()
Get RTC time.
void begin()
Initialize the RTC library.
void attachAlarm(void(*isr)(void))
Attach the alarm handler.
void cancelAlarm()
Cancel RTC alarm time.
RtcClass()
Create RtcClass object.
Definition: RTC.h:51
void end()
Finalize the RTC library.
void setTime(RtcTime &rtc)
Set RTC time.
void setAlarm(RtcTime &rtc)
Set RTC alarm time.
void detachAlarm()
Detach the alarm handler.
void setAlarmSeconds(uint32_t seconds)
Set RTC alarm time after the specified seconds.
RTC time definitions.
Definition: RtcTime.h:35