|
@@ -247,24 +247,22 @@ fn EXTI9_5() {
|
|
|
if let Some(ref mut rtc_int) = rtc_int_ref.deref_mut() {
|
|
|
if let Some(ref mut i2c) = i2c_int_ref.deref_mut() {
|
|
|
if let Some(ref mut refresh_timer) = refresh_timer_ref.deref_mut() {
|
|
|
- if rtc_int.check_interrupt() {
|
|
|
- // Read new time from DS3231
|
|
|
- let (second, minute, hour) = ds3231::get_time(DS3231_ADDR, i2c);
|
|
|
- let (weekday, day, month, _, _) = ds3231::get_date(DS3231_ADDR, i2c);
|
|
|
-
|
|
|
- // Calculate new values and account for DST
|
|
|
- let hour = if ds3231::in_dst(weekday, day, month, hour) { (hour + 1) % 12 } else { hour % 12 };
|
|
|
- let hour = if hour == 0 { 12 } else { hour };
|
|
|
-
|
|
|
- // Trigger the processing of a new time value
|
|
|
- clock_ref.deref_mut().rtc_tick(second, minute, hour);
|
|
|
-
|
|
|
- // Start the refresh timer to update the display
|
|
|
- refresh_timer.listen(Event::TimeOut);
|
|
|
-
|
|
|
- // Clear the interrupt flag for the timer
|
|
|
- rtc_int.clear_interrupt_pending_bit();
|
|
|
- }
|
|
|
+ // Read new time from DS3231
|
|
|
+ let (second, minute, hour) = ds3231::get_time(DS3231_ADDR, i2c);
|
|
|
+ let (weekday, day, month, _, _) = ds3231::get_date(DS3231_ADDR, i2c);
|
|
|
+
|
|
|
+ // Calculate new values and account for DST
|
|
|
+ let hour = if ds3231::in_dst(weekday, day, month, hour) { (hour + 1) % 12 } else { hour % 12 };
|
|
|
+ let hour = if hour == 0 { 12 } else { hour };
|
|
|
+
|
|
|
+ // Trigger the processing of a new time value
|
|
|
+ clock_ref.deref_mut().rtc_tick(second, minute, hour);
|
|
|
+
|
|
|
+ // Start the refresh timer to update the display
|
|
|
+ refresh_timer.listen(Event::TimeOut);
|
|
|
+
|
|
|
+ // Clear the interrupt flag for the timer
|
|
|
+ rtc_int.clear_interrupt_pending_bit();
|
|
|
}
|
|
|
}
|
|
|
}
|