majicdesigns / md_ds3231 Goto Github PK
View Code? Open in Web Editor NEWDS3231 Real Time Clock Library
License: GNU Lesser General Public License v2.1
DS3231 Real Time Clock Library
License: GNU Lesser General Public License v2.1
I downloaded the MD_DS3231 library to try with my new DS3231 RTC.
I tried the sketches in the example folder only to find the library failed to compile when using my DUE board but ok when I tried on my UNO board.
Following is the the output from the compiler when using my DUE.
Any help in solving this issue would be appreciated.. Milton
Arduino: 1.8.12 (Windows 7), Board: "Arduino Due (Programming Port)"
In file included from C:\Users\Milton\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.8\system/CMSIS/Device/ATMEL/sam3xa/include/sam3xa.h:44:0,
from C:\Users\Milton\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.8\system/CMSIS/Device/ATMEL/sam3.h:59,
from C:\Users\Milton\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.8\system/CMSIS/Device/ATMEL/sam.h:198,
from C:\Users\Milton\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.8\system/libsam/chip.h:25,
from C:\Users\Milton\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.8\cores\arduino/Arduino.h:42,
from sketch\MD_DS3231_LCD_Time.ino.cpp:1:
C:\Users\Milton\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.8\system/CMSIS/Device/ATMEL/sam3xa/include/sam3x8e.h:502:29: error: expected ')' before '*' token
#define RTC ((Rtc *)0x400E1A60U) /**< \brief (RTC ) Base Address */
^
C:\Users\Milton\Documents\Arduino\libraries\MD_DS3231\src/MD_DS3231.h:763:18: note: in expansion of macro 'RTC'
extern MD_DS3231 RTC; ///< Library created instance of the RTC class
^
C:\Users\Milton\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.8\system/CMSIS/Device/ATMEL/sam3xa/include/sam3x8e.h:502:29: error: expected ')' before '*' token
#define RTC ((Rtc *)0x400E1A60U) /**< \brief (RTC ) Base Address */
^
C:\Users\Milton\Documents\Arduino\libraries\MD_DS3231\src/MD_DS3231.h:763:18: note: in expansion of macro 'RTC'
extern MD_DS3231 RTC; ///< Library created instance of the RTC class
^
C:\Users\Milton\Documents\Arduino\libraries\MD_DS3231\examples\MD_DS3231_LCD_Time\MD_DS3231_LCD_Time.ino: In function 'void printTime()':
MD_DS3231_LCD_Time:45:28: error: request for member 'dow' in '1074666080u', which is of pointer type 'Rtc*' (maybe you meant to use '->' ?)
lcd.print(dow2String(RTC.dow));
^
MD_DS3231_LCD_Time:47:17: error: request for member 'yyyy' in '1074666080u', which is of pointer type 'Rtc*' (maybe you meant to use '->' ?)
lcd.print(RTC.yyyy);
^
MD_DS3231_LCD_Time:49:13: error: request for member 'mm' in '1074666080u', which is of pointer type 'Rtc*' (maybe you meant to use '->' ?)
p2dig(RTC.mm);
^
MD_DS3231_LCD_Time:51:13: error: request for member 'dd' in '1074666080u', which is of pointer type 'Rtc*' (maybe you meant to use '->' ?)
p2dig(RTC.dd);
^
MD_DS3231_LCD_Time:54:13: error: request for member 'h' in '1074666080u', which is of pointer type 'Rtc*' (maybe you meant to use '->' ?)
p2dig(RTC.h);
^
MD_DS3231_LCD_Time:56:13: error: request for member 'm' in '1074666080u', which is of pointer type 'Rtc*' (maybe you meant to use '->' ?)
p2dig(RTC.m);
^
MD_DS3231_LCD_Time:58:13: error: request for member 's' in '1074666080u', which is of pointer type 'Rtc*' (maybe you meant to use '->' ?)
p2dig(RTC.s);
^
MD_DS3231_LCD_Time:59:11: error: request for member 'status' in '1074666080u', which is of pointer type 'Rtc*' (maybe you meant to use '->' ?)
if (RTC.status(DS3231_12H) == DS3231_ON)
^
MD_DS3231_LCD_Time:60:19: error: request for member 'pm' in '1074666080u', which is of pointer type 'Rtc*' (maybe you meant to use '->' ?)
lcd.print(RTC.pm ? " pm" : " am");
^
C:\Users\Milton\Documents\Arduino\libraries\MD_DS3231\examples\MD_DS3231_LCD_Time\MD_DS3231_LCD_Time.ino: In function 'void displayUpdate()':
MD_DS3231_LCD_Time:66:7: error: request for member 'readTime' in '1074666080u', which is of pointer type 'Rtc*' (maybe you meant to use '->' ?)
RTC.readTime();
^
C:\Users\Milton\Documents\Arduino\libraries\MD_DS3231\examples\MD_DS3231_LCD_Time\MD_DS3231_LCD_Time.ino: In function 'void setup()':
MD_DS3231_LCD_Time:90:7: error: request for member 'setAlarm1Callback' in '1074666080u', which is of pointer type 'Rtc*' (maybe you meant to use '->' ?)
RTC.setAlarm1Callback(alarmICB);
^
MD_DS3231_LCD_Time:105:7: error: request for member 'setAlarm1Type' in '1074666080u', which is of pointer type 'Rtc*' (maybe you meant to use '->' ?)
RTC.setAlarm1Type(DS3231_ALM_SEC);
^
C:\Users\Milton\Documents\Arduino\libraries\MD_DS3231\examples\MD_DS3231_LCD_Time\MD_DS3231_LCD_Time.ino: In function 'void loop()':
MD_DS3231_LCD_Time:114:7: error: request for member 'checkAlarm1' in '1074666080u', which is of pointer type 'Rtc*' (maybe you meant to use '->' ?)
RTC.checkAlarm1();
^
Multiple libraries were found for "MD_DS3231.h"
Used: C:\Users\Milton\Documents\Arduino\libraries\MD_DS3231
Not used: C:\Users\Milton\Documents\Arduino\libraries\arduino_128441
exit status 1
request for member 'dow' in '1074666080u', which is of pointer type 'Rtc*' (maybe you meant to use '->' ?)
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
While i think this is covered in the documentation the methods and the function, if you can provide an example for the same in the example section would be great...
Apologies, as I am just beginning to delve into SBC. I am more into the software side.
I just can't find any reference to pin assignments except the I2C. Does that mean the lib is HARDWIRED to the default pins of the I2C of respective boards? We can't assign any different pins for SDA and SCL instead?
Thank you!
Hi, playing around with the library I noticed that the temperature is returned as a float (as in other DS3231 libraries). If the method is used, this pulls in floating point code that would otherwise be unneeded.
The datasheet lists the temperature accuracy as +/-3° Celsius @ 3.3V, yet the temperature is internally represented in units of 0.25°. Given that, wouldn't it make sense to integer divide by 4/round and return an int8_t? In a small example, this resulted in upwards of 800 bytes less flash memory. The tradeoff is that tiny trends would only be detectable after a change of 0.5°, and that the interface would not totally show the internal status of the chip.
Not a big deal, given that the temperature method will probably not be widely used, just my 2 cents.
Edit: Such a version could be provided by means of an additional configuration switch ENABLE_*.
Hi,
Thanks for this perfect library. This is the best among the libraries I examined. All the capabilities of DS3231 is included. Examples are very easy with your detailed explanations.
The line 216 of example "MD_DS3231_Test" , in the function "printTime()":
PRINT("", dow2String(RTC.dow)); needs to be changed as:
PRINT("", dow2String(RTC.dow + 1));
Thank you again,
Yavuz Darendelioğlu
hi,
thanks for the great documentation it is really helpful.
I was looking for a way to initialize the RTC .for example if it lost power ,but i could not find any thing about it in the doc or the examples .
could you help me about it?
thanks in advance.
Hi discovered an issue with SAMD boards as they use the term RTC for their internal RTC. Solution could be to replace RTC with for example RTC_DS3231
The line "while (!Wire.available()) ; // wait
" after the Wire.requestFrom() in the file "MD_DS3231/src/MD_DS3231.cpp" may be removed. There is nothing to wait for.
When the Wire.requestFrom() returns, the I2C transaction has completely finished and the received data is waiting in a buffer in the Wire library.
Hello,
Is there a way built in to this library to check if the DS3231 module is connected? I looked through the documentation but couldn't find anything. I noticed that the outputted time stays the same when it gets disconnected so that's a way to check, but wanted to see if there was anything built in to get a simple bool answer.
By the way, I greatly appreciate that this library doesn't block when the module gets disconnected as another library I was using did.
Thanks
Logical not is only applied to the left hand side of comparison. Comparison of constant with Boolean expression is always false.
line 389 is : if (!writeDevice(ADDR_ALM1, bufRTC, 4) == 4)
line 389 s/b: if (writeDevice(ADDR_ALM1, bufRTC, 4) != 4)
line 397 is : if (!writeDevice(ADDR_ALM2, &bufRTC[1], 3) == 3)
line 397 s/b: if (writeDevice(ADDR_ALM2, &bufRTC[1], 3) != 3)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.