mcu_ab568x/app/platform/libs/api_rtc.h
2025-05-30 18:03:10 +08:00

40 lines
877 B
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef _API_RTC_H
#define _API_RTC_H
//RTC tm time互转。有效年份2020~2120
typedef struct tm_t_ {
u16 year;
u8 mon;
u8 day;
u8 weekday;
u8 hour;
u8 min;
u8 sec;
} tm_t;
tm_t time_to_tm(u32 time);
u32 tm_to_time(tm_t tm);
u8 get_month_days(u16 year, u8 mon);
u8 get_weekday(u16 year, u8 mon, u8 day);
//RTC 寄存器相关
void irtc_sfr_write(u32 cmd, u8 dat);
u8 irtc_sfr_read(u32 cmd);
u32 irtc_time_read(u32 cmd);
void irtc_time_write(u32 cmd, u32 dat);
void rtcram_write(u8 *buf, u8 addr, u8 cnt);
void rtcram_read(u8 *buf, u8 addr, u8 cnt);
void rtc_sleep_process(void);
void rtc_sleep_enter(void);
void rtc_sleep_exit(void);
void rtc_calibration_write(u8 addr);
void rtc_calibration_read(u8 addr);
bool rtc_clock_calc_by_rc(u32 exit_flag);
void sniff_rc_init(void);
#endif // _API_RTC_H