private void UpdateState() { if (!alarmEnabled) { return; } var currentValue = (clockMode.Value == ClockMode.BinaryCounter) ? CalculateElapsedSeconds(currentTime) : GetDateTimeAlarmCompareUpper(GetDateTimeAlarmCompareLower()).Bits.AsUInt64(); var compareMask = (compareHigh.Value << 32) | compareLow.Value; var alarmValue = (alarmHigh.Value << 32) | alarmLow.Value; var isAlarmMatched = (currentValue & compareMask) == (alarmValue & compareMask); match.Value = isAlarmMatched; MatchIRQ.Set(match.Value); wakeup.Value |= isAlarmMatched; if (wakeup.Value) { if (wakeReset.Value) { ResetInnerTimer(); } if (!wakeContinue.Value) { ticker.Enabled = false; } if (wakeEnable.Value) { WakeupIRQ.Set(true); } } }
public override void Reset() { base.Reset(); WakeupIRQ.Set(false); MatchIRQ.Set(false); ResetInnerTimer(); ticker.Reset(); }