65 #if defined(HAS_NZ_RTC)
70 #ifndef __INLINE_FUNCTION__
71 #define __INLINE_FUNCTION__ extern inline __attribute__((always_inline))
74 typedef struct __attribute__((__packed__)) {
84 typedef struct __attribute__((__packed__)) {
90 typedef struct __attribute__((__packed__)) {
121 BYTE rtcUnlock(
void);
130 BYTE nz_rtcGetRegBcd2Bin(BYTE reg);
141 BYTE nz_rtcSetRegBin2Bcd(BYTE reg, BYTE val);
149 BYTE rtcGetReg(BYTE regAdr, BYTE* reg);
159 BYTE rtcSetReg(BYTE regAdr, BYTE val);
172 BYTE __INLINE_FUNCTION__ rtcGetSec(
void) {
173 return nz_rtcGetRegBcd2Bin(0x0);
182 BYTE __INLINE_FUNCTION__ rtcGetMin(
void) {
183 return nz_rtcGetRegBcd2Bin(0x01);
192 BYTE rtcGetHour(
void);
200 BYTE __INLINE_FUNCTION__ rtcGetDay(
void) {
201 return nz_rtcGetRegBcd2Bin(0x03);
210 BYTE __INLINE_FUNCTION__ rtcGetMonth(
void) {
211 return nz_rtcGetRegBcd2Bin(0x04);
221 WORD __INLINE_FUNCTION__ rtcGetYear(
void) {
222 return nz_rtcGetRegBcd2Bin(0x05);
231 WORD __INLINE_FUNCTION__ rtcGetWeekDay(
void) {
232 return nz_rtcGetRegBcd2Bin(0x06);
256 BYTE rtcGetTime(RTC_TIME*
tm, BOOL bcdFormat);
280 BYTE rtcGetDate(RTC_DATE* dt, BOOL bcdFormat);
307 BYTE rtcGetTimeAndDate(RTC_TIME_AND_DATE* td, BOOL bcdFormat);
321 BYTE __INLINE_FUNCTION__ rtcSetSec(BYTE sec) {
322 return nz_rtcSetRegBin2Bcd(0x0, sec);
332 BYTE __INLINE_FUNCTION__ rtcSetMin(BYTE min) {
333 return nz_rtcSetRegBin2Bcd(0x01, min);
344 BYTE rtcSetHour(BYTE hour);
354 BYTE __INLINE_FUNCTION__ rtcSetDay(BYTE day) {
355 return nz_rtcSetRegBin2Bcd(0x03, day);
366 BYTE __INLINE_FUNCTION__ rtcSetMonth(BYTE month) {
367 return nz_rtcSetRegBin2Bcd(0x04, month);
378 BYTE __INLINE_FUNCTION__ rtcSetYear(WORD year) {
379 return nz_rtcSetRegBin2Bcd(0x05, year);
390 BYTE __INLINE_FUNCTION__ rtcSetWeekDay(BYTE wday) {
391 return nz_rtcSetRegBin2Bcd(0x06, wday);
416 BYTE rtcSetTime(RTC_TIME*
tm);
444 BYTE rtcSetTimeAndDate(RTC_TIME_AND_DATE* td);
451 BOOL rtcDidPowerFail();
453 BOOL rtcGetBatteryFlag();
455 void rtcClearBatteryFlag();
457 BOOL rtcGetAlarmFlag();
459 void rtcClearAlarmFlag();
471 BYTE __INLINE_FUNCTION__ rtcGetRAM1(
void) {
473 rtcGetReg(0x12, &val);
482 BYTE __INLINE_FUNCTION__ rtcGetRAM2(
void) {
484 rtcGetReg(0x13, &val);
494 BYTE __INLINE_FUNCTION__ rtcSetRAM1(BYTE val) {
495 return rtcSetReg(0x12, val);
505 BYTE __INLINE_FUNCTION__ rtcSetRAM2(BYTE val) {
506 return rtcSetReg(0x13, val);
509 #endif //#if defined(HAS_NZ_RTC)
510 #endif //#ifndef NZ_RTC_H