[hal] Notifier: simplify ack API (#8457)

Adding an ack parameter to both set and cancel is cleaner than adding
all the set alarm parameters to the ack function. It also provides an
ack-and-cancel method.
This commit is contained in:
Peter Johnson
2025-12-09 20:28:15 -07:00
committed by GitHub
parent 936be71a7d
commit 06a9a055b3
12 changed files with 111 additions and 177 deletions

View File

@@ -75,18 +75,12 @@ void Watchdog::Impl::UpdateAlarm(bool acknowledge) {
return;
}
if (m_watchdogs.empty()) {
HAL_CancelNotifierAlarm(notifier, &status);
} else if (acknowledge) {
HAL_AcknowledgeNotifierAlarm(
notifier, true,
static_cast<uint64_t>(m_watchdogs.top()->m_expirationTime.value() *
1e6),
0, true, &status);
HAL_CancelNotifierAlarm(notifier, acknowledge, &status);
} else {
HAL_SetNotifierAlarm(notifier,
static_cast<uint64_t>(
m_watchdogs.top()->m_expirationTime.value() * 1e6),
0, true, &status);
0, true, acknowledge, &status);
}
WPILIB_CheckErrorStatus(status, "updating watchdog notifier alarm");
}