Skip to content

Commit

Permalink
Version 5.0.0:
Browse files Browse the repository at this point in the history
 - Removed EEPROM funcionality; see uEEPROMLib for that.
  • Loading branch information
Naguissa committed Jan 30, 2019
1 parent 5e918aa commit beb224f
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 437 deletions.
Empty file modified LICENSE 100644 → 100755
Empty file.
12 changes: 9 additions & 3 deletions README.md
Expand Up @@ -2,11 +2,11 @@

## What is this repository for? ##

Really tiny library to basic RTC and EEPROM (incorporated) functionality on Arduino, ESP8266, STM32, ESP32 and other microcontrollers.
Really tiny library to basic RTC functionality on Arduino, ESP8266, STM32, ESP32 and other microcontrollers.

DS1307 and DS3231 RTCs are supported

AT24C32 EEPROM supported
EEPROM support has been moved to https://github.com/Naguissa/uEEPROMLib

Also, added support for DS3231 temperature sensor.

Expand Down Expand Up @@ -41,8 +41,14 @@ Included on example folder, available on Arduino IDE.
* https://www.foroelectro.net/librerias-arduino-ide-f29/rtclib-arduino-libreria-simple-y-eficaz-para-rtc-y-t95.html
* https://www.naguissa.com

## Support ##


## Contribute ##

Any code contribution, report or comment are always welcome. Don't hesitate to use GitHub for that.


You can make a donation via PayPal: https://paypal.me/foroelectro


Thanks for your support.
106 changes: 0 additions & 106 deletions examples/uRTCLib_EEPROM_example/uRTCLib_EEPROM_example.ino

This file was deleted.

86 changes: 17 additions & 69 deletions examples/uRTCLib_example/uRTCLib_example.ino
@@ -1,86 +1,41 @@
/**
* DS1307 and DS3231 RTCs basic library
*
* Really tiny library to basic RTC functionality on Arduino.
*
* DS1307 and DS3231 RTCs are supported. See uEEPROMLib for EEPROM support. Also temperature sensor is supported for DS3231.
*
*
* @copyright Naguissa
* @author Naguissa
* @url https://github.com/Naguissa/uRTCLib
* @url https://www.foroelectro.net/librerias-arduino-ide-f29/rtclib-arduino-libreria-simple-y-eficaz-para-rtc-y-t95.html
* @email naguissa.com@gmail.com
* @version 5.0.0
* @created 2015-05-07
*/
#include "Arduino.h"
#include "Wire.h"
#include "uRTCLib.h"


// uRTCLib rtc;
uRTCLib rtc(0x68, 0x57);
uRTCLib rtc(0x68);



unsigned int pos;

void setup() {
delay (2000);
Serial.begin(9600);
Serial.println("Serial OK");
// Max position: 32767

#ifdef ARDUINO_ARCH_ESP8266
Wire.begin(0, 2); // D3 and D4 on ESP8266
#else
Wire.begin();
#endif


#ifdef _VARIANT_ARDUINO_STM32_
Serial.println("Board: STM32");
#else
Serial.println("Board: Other");
#endif
#ifdef ARDUINO_ARCH_AVR
int inttmp = 32123;
#else
// too logng for AVR 16 bits!
int inttmp = 24543557;
#endif
float floattmp = 3.1416;
char chartmp = 'A';

// Testing template
if (!rtc.eeprom_write(0, inttmp)) {
Serial.println("Failed to store INT");
} else {
Serial.println("INT correctly stored");
}
if (!rtc.eeprom_write(4, floattmp)) {
Serial.println("Failed to store FLOAT");
} else {
Serial.println("FLOAT correctly stored");
}
if (!rtc.eeprom_write(8, chartmp)) {
Serial.println("Failed to store CHAR");
} else {
Serial.println("CHAR correctly stored");
}

rtc.set(0, 42, 16, 6, 2, 5, 15);
// RTCLib::set(byte second, byte minute, byte hour, byte dayOfWeek, byte dayOfMonth, byte month, byte year)


inttmp = 0;
floattmp = 0;
chartmp = 0;



Serial.print("int: ");
rtc.eeprom_read(0, &inttmp);
Serial.println(inttmp);
Serial.print("float: ");
rtc.eeprom_read(4, &floattmp);
Serial.println((float) floattmp);
Serial.print("char: ");
rtc.eeprom_read(8, &chartmp);
Serial.println(chartmp);
Serial.println();


for(pos = 9; pos < 1000; pos++) {
rtc.eeprom_write(pos, (unsigned char) (pos % 256));
}

pos = 0;
}

void loop() {
Expand All @@ -107,14 +62,7 @@ void loop() {
Serial.print(" - Temp: ");
Serial.print(rtc.temp());

Serial.print(" ---- ");
Serial.print(pos);
Serial.print(": ");
Serial.print(rtc.eeprom_read(pos));

Serial.println();

pos++;
pos %= 1000;
delay(1000);
}
45 changes: 22 additions & 23 deletions examples/uRTCLib_example_setAddr/uRTCLib_example_setAddr.ino
@@ -1,3 +1,19 @@
/**
* DS1307 and DS3231 RTCs basic library
*
* Really tiny library to basic RTC functionality on Arduino.
*
* DS1307 and DS3231 RTCs are supported. See uEEPROMLib for EEPROM support. Also temperature sensor is supported for DS3231.
*
*
* @copyright Naguissa
* @author Naguissa
* @url https://github.com/Naguissa/uRTCLib
* @url https://www.foroelectro.net/librerias-arduino-ide-f29/rtclib-arduino-libreria-simple-y-eficaz-para-rtc-y-t95.html
* @email naguissa.com@gmail.com
* @version 5.0.0
* @created 2015-05-07
*/
#include "Arduino.h"
#include "Wire.h"
#include "uRTCLib.h"
Expand All @@ -6,34 +22,23 @@
uRTCLib rtc;


unsigned int pos;

void setup() {
delay (2000);
Serial.begin(9600);
Serial.println("Serial OK");
// Max position: 32767

// Wire.begin(0, 2); // D3 and D4 on ESP8266
Wire.begin();

for(pos = 0; pos < 1000; pos++) {
rtc.eeprom_write(pos, (unsigned char) pos % 256);
}
#ifdef ARDUINO_ARCH_ESP8266
Wire.begin(0, 2); // D3 and D4 on ESP8266
#else
Wire.begin();
#endif

// Only used once, then disabled
// rtc.set(0, 42, 16, 6, 2, 5, 15);
// RTCLib::set(byte second, byte minute, byte hour, byte dayOfWeek, byte dayOfMonth, byte month, byte year)

pos = 0;

#ifdef _VARIANT_ARDUINO_STM32_
Serial.println("Board: STM32");
#else
Serial.println("Board: Other");
#endif
rtc.set_rtc_address(0x68);
rtc.set_ee_address(0x57);
}

void loop() {
Expand All @@ -60,13 +65,7 @@ void loop() {
Serial.print(" - Temp: ");
Serial.print(rtc.temp());

Serial.print(" ---- ");
Serial.print(pos);
Serial.print(": ");
Serial.print(rtc.eeprom_read(pos));

Serial.println();
pos++;
pos %= 1000;

delay(1000);
}
4 changes: 2 additions & 2 deletions library.properties
@@ -1,8 +1,8 @@
name=uRTCLib
version=4.3.1
version=5.0.0
author=Naguissa <naguissa@foroelectro.net>
maintainer=Naguissa <naguissa@foroelectro.net>
sentence=Really tiny library to basic RTC functionality on Arduino. DS1307 and DS3231 RTCs are supported. Also temperature sensor is supported for DS3231.
sentence=Really tiny library to basic RTC functionality on Arduino. DS1307 and DS3231 RTCs are supported. See https://github.com/Naguissa/uEEPROMLib for EEPROM support. Also temperature sensor is supported for DS3231.
paragraph=Supports Arduino AVR, STM32, ESP8266, ESP32 and other microcontrollers
category=Device Control
url=https://github.com/Naguissa/uRTCLib
Expand Down

0 comments on commit beb224f

Please sign in to comment.