diff --git a/src/core/watch/rtc.cpp b/src/core/watch/rtc.cpp index de95e05..a0c82d3 100644 --- a/src/core/watch/rtc.cpp +++ b/src/core/watch/rtc.cpp @@ -1,7 +1,15 @@ +/** + * @file + * @author Igor Usenko (github: igors48) + * @brief RTC API implementation +*/ #include "rtc.hpp" #include "ttgo.hpp" -static Date rtcGetDate() +/** + * @copydoc RtcApi.getDate + */ +static Date getDate() { RTC_Date rtcDate = watch->rtc->getDateTime(); @@ -25,7 +33,10 @@ static Date rtcGetDate() }; } -static void rtcSetDate(Date date) +/** + * @copydoc RtcApi.setDate + */ +static void setDate(Date date) { RTC_Date rtcDate = RTC_Date( date.year, @@ -41,7 +52,7 @@ static void rtcSetDate(Date date) RtcApi watchRtcApi() { return { - .getDate = rtcGetDate, - .setDate = rtcSetDate, + .getDate = getDate, + .setDate = setDate, }; } \ No newline at end of file diff --git a/src/core/watch/rtc.hpp b/src/core/watch/rtc.hpp index d61bd68..8a8c389 100644 --- a/src/core/watch/rtc.hpp +++ b/src/core/watch/rtc.hpp @@ -1,5 +1,13 @@ +/** + * @file + * @author Igor Usenko (github: igors48) + * @brief RTC API definition +*/ #pragma once +/** + * @brief definition of Date + */ typedef struct { unsigned short year; @@ -11,13 +19,26 @@ typedef struct unsigned int dayOfWeek; } Date; -typedef Date (*DateFunc)(); // todo rename to GetDate #110 -typedef void (*SetDate)(Date date); - typedef struct { - DateFunc getDate; - SetDate setDate; + /** + * @brief returns the date from RTC + * + * @return date value + */ + Date (*getDate)(); + + /** + * @brief writes the date to RTC + * + * @param date date value + */ + void (*setDate)(Date date); } RtcApi; +/** + * @brief factory for RTC API + * + * @return RtcApi RTC API instance + */ RtcApi watchRtcApi(); \ No newline at end of file