Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: Time.cpp
- Revision:
- 0:397b5462e6d7
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Time.cpp Thu Nov 15 06:55:25 2018 +0000
@@ -0,0 +1,26 @@
+#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;
+}