Jump to content
elpaso

[Energia Library] RTClib (external: DS1388, PCF8563 etc.)

Recommended Posts

Another trivial port... this is the RTCLib I've been using for a couple of AVR projects, it runs with really minor modifications (just stripped out PROGMEM related stuff).

 

I've already pulled a request to the main repo (I've been contributing DS1388 to this lib in the past).

 

While the pull gets in, here is the library on my fork:

 

https://github.com/elpaso/rtclib

 

I've tested the library on my LP 1.5 with a DS1388 (3.3V version) and it's working fine.

 

Example

#include <Wire.h>
#include <RTClib.h>
RTC_DS1388 RTC;
DateTime now;

// Ugly globals...
uint8_t timeH;
uint8_t timeM;
volatile uint8_t timeS;
uint8_t dateD;
uint8_t dateM;
uint16_t dateY;
uint8_t dateW;



void setup() {
    Wire.begin();
    RTC.begin();
    if (!RTC.isrunning()) {
        // following line sets the RTC to the date & time this sketch was compiled
        RTC.adjust(DateTime(__DATE__, __TIME__));
    }

}

void loop() {
    // Read clock
    now = RTC.now();
    timeH = now.hour();
    timeM = now.minute();
    timeS = now.second();
    dateD = now.day();
    dateM = now.month();
    dateY = now.year();
    // Do something with those figures...
}

Share this post


Link to post
Share on other sites

I've tested the library on my LP 1.5 with a pcf8563  and can not compile ok.Thanks! :mellow:

 

rty change in sketch

#include <RTClib.h>

to

#include "RTClib.h"

 

and check files

<PATH TO ENERGIA>\hardware\msp430\libraries\RTClib\rtclib.cpp

<PATH TO ENERGIA>\hardware\msp430\libraries\RTClib\rtclib.h

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×