Developer World
Spresense Arduino Library v1.4.2-7e8b4bd
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 
45 class RtcClass
46 {
47 public:
51  RtcClass() : _fd(-1), _pid(-1) {}
52 
58  void begin();
59 
63  void end();
64 
69  void setTime(RtcTime &rtc);
70 
75  RtcTime getTime();
76 
77 #ifndef SUBCORE
78 
82  void setAlarm(RtcTime &rtc);
83 
88  void setAlarmSeconds(uint32_t seconds);
89 
93  void cancelAlarm();
94 
99  void attachAlarm(void (*isr)(void));
100 
104  void detachAlarm();
105 
106 #endif /* !SUBCORE */
107 
108 private:
109  int _fd;
110  int16_t _pid;
111 
112 };
113 
114 extern RtcClass RTC;
115 
118 #endif // __RTC_H__
void cancelAlarm()
Cancel RTC alarm time.
This is the interface to the RTC Hardware.
Definition: RTC.h:45
void setAlarm(RtcTime &rtc)
Set RTC alarm time.
void detachAlarm()
Detach the alarm handler.
void begin()
Initialize the RTC library.
void end()
Finalize the RTC library.
void attachAlarm(void(*isr)(void))
Attach the alarm handler.
RtcTime getTime()
Get RTC time.
void setAlarmSeconds(uint32_t seconds)
Set RTC alarm time after the specified seconds.
RTC time definitions.
Definition: RtcTime.h:34
RtcClass()
Create RtcClass object.
Definition: RTC.h:51
void setTime(RtcTime &rtc)
Set RTC time.