205 static inline u8 bcd2bin(
u8 val) {
return (val & 0x0F) + ((val >> 4) * 10); }
212 static inline u8 bin2bcd(
u8 val) {
return ((val / 10) << 4) + (val % 10); }
238 extern const char*
const meridiem[];
rtc_status_t
RTC Status List.
@ RTC_SKIP
Skip the function.
@ RTC_ERR
Failed to retrieve/write value.
@ RTC_OK
Successful Operation.
@ RTC_USER_ERR
User provide wrong input.
const char *const DayStrings[]
Get string representations for Sunday,Monday ,etc..
rtc_status_t rtc_enableErrorInterrupt(rtc_instance_t *rtc)
Wrapper: Enable RTC error interrupt.
const char *const meridiem[]
Get string representations for meridiem (AM/PM).
u8 convert_hour_register(u8 old_reg_val, u8 to_12h)
Convert hour register between 12-hour and 24-hour format.
const char * get_ordinal(u8 day)
Get ordinal suffix for a given day.
const char *const MonthStrings[]
Get string representations for months.
rtc_status_t rtc_applyConfig(rtc_instance_t *rtc)
Wrapper: Apply I2C + RTC configuration.
const char * Day_ordinal[]
Get ordinal suffix for a given day.
struct rtc_instance rtc_instance_t
Forward declaration of RTC instance.
I2C driver API definitions.
RTC Configuration and Driver Selection.
I2C instance. Holds the software registers and hardware pointer.
rtc_status_t(* getTime)(rtc_instance_t *rtc)
Get time function pointer.
rtc_status_t(* setTime)(rtc_instance_t *rtc)
Set time function pointer.
rtc_status_t(* applyConfig)(rtc_instance_t *rtc)
Apply i2c config , user can call via rtc_applyConfig as well.
rtc_status_t(* setTimeSystem)(rtc_instance_t *rtc, u8 mode)
Set time system function pointer.
rtc_status_t(* enableErrorInterrupt)(rtc_instance_t *rtc)
Enable error interrupt function pointer, user can call via rtc_enableErrorInterrupt as well.
u8 hours
Hours (0-23 or 1-12).
u8 timesystem
Time System (0 = 24-hour, 1 = 12-hour).
u8 days
Day of the month (1-31).
u8 minutes
Minutes (0-59).
u8 seconds
Seconds (0-59).
u8 PM
PM Indicator for 12-hour format (0 = AM, 1 = PM).
u8 weekdays
Day of the week (1-7).
rtc_data_t current_time
Current time data.
const rtc_api_t * drv
Pointer to RTC API structure.
i2c_instance_t * inst
Pointer to I2C instance.