RTC on M0 and class design without rtc and target
Quote:
Example for training purposes only!!!
RTC/I2C data for target LPC11U24 Humer M0-Board and no data for others!!!
See RTC WIKI
Time.cpp
- Committer:
- fpucher
- Date:
- 2018-11-15
- Revision:
- 0:397b5462e6d7
File content as of revision 0:397b5462e6d7:
#include "Time.h" uint8_t Time :: GetHours() { uint8_t h = rtc_read(HOURS); return bcdToUint(h&0x3F); } uint8_t Time :: GetMinutes() { uint8_t m = rtc_read(MINUTES); return bcdToUint(m&0x7F); } uint8_t Time :: GetSeconds() { uint8_t s = rtc_read(SECONDS); return bcdToUint(s&0x7F); } uint8_t Time::bcdToUint(uint8_t const nybbles) { uint8_t result; result = (nybbles >> 4) * 10 + (nybbles & 0x0F); return result; }