2016-11-02 21:06:41 +00:00
|
|
|
#ifndef GUARD_RTC_H
|
|
|
|
#define GUARD_RTC_H
|
|
|
|
|
|
|
|
#include "gba/gba.h"
|
|
|
|
|
|
|
|
#define SIIRTCINFO_INTFE 0x01 // frequency interrupt enable
|
|
|
|
#define SIIRTCINFO_INTME 0x02 // per-minute interrupt enable
|
|
|
|
#define SIIRTCINFO_INTAE 0x04 // alarm interrupt enable
|
|
|
|
#define SIIRTCINFO_24HOUR 0x40 // 0: 12-hour mode, 1: 24-hour mode
|
|
|
|
#define SIIRTCINFO_POWER 0x80 // power on or power failure occurred
|
|
|
|
|
2023-09-20 22:04:50 +00:00
|
|
|
#define HOURS_PER_DAY 24
|
|
|
|
#define MINUTES_PER_HOUR 60
|
|
|
|
#define SECONDS_PER_MINUTE 60
|
2023-09-17 16:45:06 +00:00
|
|
|
|
2016-11-02 21:06:41 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
MONTH_JAN = 1,
|
|
|
|
MONTH_FEB,
|
|
|
|
MONTH_MAR,
|
|
|
|
MONTH_APR,
|
|
|
|
MONTH_MAY,
|
|
|
|
MONTH_JUN,
|
|
|
|
MONTH_JUL,
|
|
|
|
MONTH_AUG,
|
|
|
|
MONTH_SEP,
|
|
|
|
MONTH_OCT,
|
|
|
|
MONTH_NOV,
|
2023-09-17 16:45:06 +00:00
|
|
|
MONTH_DEC,
|
|
|
|
MONTH_COUNT = MONTH_DEC
|
2016-11-02 21:06:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct SiiRtcInfo
|
|
|
|
{
|
|
|
|
u8 year;
|
|
|
|
u8 month;
|
|
|
|
u8 day;
|
|
|
|
u8 dayOfWeek;
|
|
|
|
u8 hour;
|
|
|
|
u8 minute;
|
|
|
|
u8 second;
|
|
|
|
u8 status;
|
|
|
|
u8 alarmHour;
|
|
|
|
u8 alarmMinute;
|
|
|
|
};
|
|
|
|
|
2019-03-03 08:14:08 +00:00
|
|
|
void SiiRtcUnprotect(void);
|
|
|
|
void SiiRtcProtect(void);
|
|
|
|
u8 SiiRtcProbe(void);
|
|
|
|
bool8 SiiRtcReset(void);
|
2016-11-02 21:06:41 +00:00
|
|
|
bool8 SiiRtcGetStatus(struct SiiRtcInfo *rtc);
|
|
|
|
bool8 SiiRtcSetStatus(struct SiiRtcInfo *rtc);
|
|
|
|
bool8 SiiRtcGetDateTime(struct SiiRtcInfo *rtc);
|
|
|
|
bool8 SiiRtcSetDateTime(struct SiiRtcInfo *rtc);
|
|
|
|
bool8 SiiRtcGetTime(struct SiiRtcInfo *rtc);
|
|
|
|
bool8 SiiRtcSetTime(struct SiiRtcInfo *rtc);
|
|
|
|
bool8 SiiRtcSetAlarm(struct SiiRtcInfo *rtc);
|
|
|
|
|
|
|
|
#endif // GUARD_RTC_H
|