diff --git a/ds3231/ds3231 b/ds3231/ds3231 index 2768009..54b8917 160000 --- a/ds3231/ds3231 +++ b/ds3231/ds3231 @@ -1 +1 @@ -Subproject commit 27680097203f1482ba61a9cceef689305d7eadc4 +Subproject commit 54b8917705125bdea47f74e4c911650da5bb025f diff --git a/ds3231/ds3231.cppproj b/ds3231/ds3231.cppproj index 9715776..26e8f21 100644 --- a/ds3231/ds3231.cppproj +++ b/ds3231/ds3231.cppproj @@ -218,6 +218,15 @@ compile + + compile + + + compile + + + compile + compile diff --git a/ds3231/main.cpp b/ds3231/main.cpp index 7301d90..774d247 100644 --- a/ds3231/main.cpp +++ b/ds3231/main.cpp @@ -7,6 +7,7 @@ #include +#include "ds3231/ds3231.hpp" #include "uart/uart.hpp" #include "systime.h" @@ -133,12 +134,31 @@ void setAlarm() int main() { uart_t cSerial; + rtc::DS3231>> ds3231; + ds3231.init(); cSerial.init(); sei(); setup(); + while (true) { + const auto date = ds3231.getDateTime(); + cSerial.txNumber(date.year); + cSerial << '-'; + cSerial.txNumber(date.month); + cSerial << '-'; + cSerial.txNumber(date.day); + cSerial << ' '; + cSerial.txNumber(date.hour); + cSerial << ':'; + cSerial.txNumber(date.minute); + cSerial << ':'; + cSerial.txNumber(date.second); + cSerial << F("\r\n"); + _delay_ms(1000); + } + constexpr auto BUFFER_SIZE = 32; char szBuffer[BUFFER_SIZE];