NXShield  v1.07
NXShield Library Reference by OpenElectrons.com
 All Classes Files Functions Variables Enumerations Enumerator Macros Pages
RTC.h
1 
2 // RTC.h
3 // This is a class for reading from Real-time Clock, made by Mindsensors.
4 // See http://www.mindsensors.com/index.php?module=pagemaster&PAGE_user_op=view_page&PAGE_id=101
5 
6 // Initial version: 2010-06-10 by Andrew Sylvester
7 // Large parts of the code is ported from the NXC library for the device,
8 // written by Deepak Patil.
9 
10 /*
11  This library is free software; you can redistribute it and/or
12  modify it under the terms of the GNU Lesser General Public
13  License as published by the Free Software Foundation; either
14  version 2.1 of the License, or (at your option) any later version.
15 
16  This library is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  Lesser General Public License for more details.
20 
21  You should have received a copy of the GNU Lesser General Public
22  License along with this library; if not, write to the Free Software
23  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 */
25 
26 
27 #ifndef RTC_H
28 #define RTC_H
29 
30 #define RTC_Seconds 0x00
31 #define RTC_Minutes 0x01
32 #define RTC_Hours 0x02
33 #define RTC_Day_of_Week 0x03
34 #define RTC_Day_of_Month 0x04
35 #define RTC_Month 0x05
36 #define RTC_Year 0x06
37 
38 #include "NXShieldI2C.h"
39 
43 class RTC : public NXShieldI2C
44 {
45 public:
47  RTC(uint8_t i2c_address = 0xD0);
48 
50  uint8_t getSeconds();
51 
53  uint8_t getMinutes();
54 
56  uint8_t getHours();
57 
59  uint8_t getDayWeek();
60 
62  uint8_t getDayMonth();
63 
65  uint8_t getMonth();
66 
68  uint8_t getYear();
69 
70 private:
71  uint8_t BCDToInteger(uint8_t b);
72 
73 };
74 
75 #endif /* RTC_H_ */
This class implements I2C interfaces used by NXShield.
Definition: NXShieldI2C.h:32
uint8_t getYear()
Definition: RTC.cpp:73
This class interfaces with RTC attached to NXShield.
Definition: RTC.h:43
uint8_t getDayWeek()
Definition: RTC.cpp:58
uint8_t getSeconds()
Definition: RTC.cpp:43
uint8_t getMinutes()
Definition: RTC.cpp:48
RTC(uint8_t i2c_address=0xD0)
Definition: RTC.cpp:31
uint8_t getDayMonth()
Definition: RTC.cpp:63
uint8_t getHours()
Definition: RTC.cpp:53
uint8_t getMonth()
Definition: RTC.cpp:68