source: rtos_arduino/trunk/arduino_lib/hardware/arduino/samd/libraries/RTC/src/RTCInt.h@ 259

Last change on this file since 259 was 259, checked in by ertl-honda, 8 years ago

1.7.11に対応.

File size: 2.9 KB
Line 
1/*
2 RTC library for Arduino Zero.
3 Copyright (c) 2015 Arduino LLC. All right reserved.
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8 This library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 Lesser General Public License for more details.
12 You should have received a copy of the GNU Lesser General Public
13 License along with this library; if not, write to the Free Software
14 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
15*/
16
17#ifndef RTCInt_H
18#define RTCInt_H
19
20#define TIME_H24 1
21#define TIME_H12 0
22
23#define OFF RTC_MODE2_MASK_SEL_OFF
24#define SEC RTC_MODE2_MASK_SEL_SS
25#define MMSS RTC_MODE2_MASK_SEL_MMSS
26#define HHMMSS RTC_MODE2_MASK_SEL_HHMMSS
27#define DDHHMMSS RTC_MODE2_MASK_SEL_DDHHMMSS
28#define MMDDHHMMSS RTC_MODE2_MASK_SEL_MMDDHHMMSS
29#define YYMMDDHHMMSS RTC_MODE2_MASK_SEL_YYMMDDHHMMSS
30
31#define ALARM_POLLED 0
32#define ALARM_INTERRUPT 1
33
34#define ANTI_MERIDIAN 0
35#define POST_MERIDIAN 1
36
37//Parameter for oscillatorType - M0 only
38#define HIGH_PRECISION 0
39#define LOW_POWER 1
40
41#include "Arduino.h"
42
43typedef struct {
44 unsigned int hour;
45 unsigned int minute;
46 unsigned int second;
47 unsigned char Tmode;
48}TIME;
49
50typedef struct {
51 unsigned int day;
52 unsigned int month;
53 unsigned int year;
54}DATE;
55
56static voidFuncPtr _callback = NULL;
57
58class RTCInt {
59public:
60
61 RTCInt() {};
62
63 TIME time;
64 DATE date;
65
66 void begin(bool timeMode, int oscillatorType);
67 void begin(bool timeMode);
68
69 /* Get Time Functions */
70
71 unsigned int getHour(void);
72 unsigned int getMinute(void);
73 unsigned int getSecond(void);
74 void getTime(void);
75 unsigned char getMeridian(void);
76
77 /* Get Date Functions */
78 unsigned int getDay(void);
79 unsigned int getMonth(void);
80 unsigned int getYear(void);
81 void getDate(void);
82
83 /* Set Time Functions */
84
85 void setHour(unsigned int hour, unsigned char meridian);
86 void setMinute(unsigned int minute);
87 void setSecond(unsigned int second);
88 void setTime(unsigned int hour, unsigned char meridian, unsigned int minute, unsigned int second);
89 void setTime(void);
90
91 /* Set Date Functions */
92 void setDay(unsigned int day);
93 void setMonth(unsigned int month);
94 void setYear(unsigned int year);
95 void setDate(unsigned int day, unsigned int month, unsigned int year);
96 void setDate(void);
97
98 /* Alarm Functions */
99 void enableAlarm(unsigned int mode, unsigned int type, voidFuncPtr callback);
100 void setAlarm(void);
101 bool alarmMatch(void);
102 void alarmClearFlag(void);
103
104
105private:
106 unsigned int Alarm_Mode=0;
107 bool RTCSync(void);
108 void RTCdisable(void);
109 void RTCenable(void);
110 void RTCreset(void);
111 void RTCresetRemove(void);
112};
113
114
115#endif
Note: See TracBrowser for help on using the repository browser.