Skip to content

Commit

Permalink
Add isWatchdogFired for Watchdog TimerA on PCF8523
Browse files Browse the repository at this point in the history
  • Loading branch information
aurelihein committed Jun 8, 2024
1 parent 5c40554 commit 001f729
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/RTC_PCF8523.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,19 @@ void RTC_PCF8523::enableAlarm() {
read_register(PCF8523_CONTROL_1) | (1 << 1)); // Enable AIE
}

/**************************************************************************/
/*!
@brief Check Watchdog TimerA fired, isWatchdogFired must be read at the
very beginning, because flag is read-only and cleared by reading
register Control_2
@return 1 if a Watchdog TimerA fired
*/
/**************************************************************************/

bool RTC_PCF8523::isWatchdogFired(void) {
return (read_register(PCF8523_CONTROL_2) & (1 << 7)); // Check WTAF
}

/**************************************************************************/
/*!
@brief Check Alarm fired
Expand Down
1 change: 1 addition & 0 deletions src/RTClib.h
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ class RTC_PCF8523 : RTC_I2C {
void adjust(const DateTime &dt);
bool lostPower(void);
bool initialized(void);
bool isWatchdogFired(void);
bool isAlarmFired(void);
bool isAnyAlarmSetup(void);
DateTime now();
Expand Down

0 comments on commit 001f729

Please sign in to comment.