Dependencies:   DigitDisplay PCF8563 mbed

main.cpp

Committer:
ladner
Date:
2016-04-01
Revision:
0:aa44e81944cc

File content as of revision 0:aa44e81944cc:

#include "mbed.h"
#include "PCF8563.h"
#include "DigitDisplay.h"

DigitDisplay display(p7, p8);
Serial pc(USBTX, USBRX);

PCF8563 rtc;

uint8_t hour, minute, sec;

int main() {
    while(1) 
    {
        hour = rtc.read(HOURS);
        minute = rtc.read(MINUTES);
        sec = rtc.read(SECONDS);
        /*
        pc.printf("%x%x:%x%x:%x%x(%x)\n\r",
                  ((hour >> 4) & 0x03), (hour & 0x0F),
                  (minute >> 4)- 8, (minute & 0x0F),
                  (sec >> 4)- 8, (sec & 0x0F),sec );
        */
        display.write(0, (minute >> 4)- 8);
        display.write(1, (minute & 0x0F));
        //display.setColon(1);
        display.write(2, (sec >> 4)- 8);
        display.write(3, (sec & 0x0F));

    }
}