From e087909f0b2761ea33a8fc685b3485f51598d099 Mon Sep 17 00:00:00 2001 From: Paul Bender Date: Sun, 5 Oct 2025 06:50:24 -0700 Subject: [PATCH 1/2] Fix century range check. --- src/ds323x/datetime.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ds323x/datetime.rs b/src/ds323x/datetime.rs index 41fd610..3abfc84 100644 --- a/src/ds323x/datetime.rs +++ b/src/ds323x/datetime.rs @@ -36,7 +36,7 @@ where } fn set_datetime(&mut self, datetime: &NaiveDateTime) -> Result<(), Self::Error> { - if datetime.year() < 2000 || datetime.year() > 2100 { + if !(2000..=2199).contains(&datetime.year()) { return Err(Error::InvalidInputData); } let (month, year) = month_year_to_registers(datetime.month() as u8, datetime.year() as u16); @@ -174,7 +174,7 @@ where } fn set_year(&mut self, year: u16) -> Result<(), Self::Error> { - if !(2000..=2100).contains(&year) { + if !(2000..=2199).contains(&year) { return Err(Error::InvalidInputData); } let data = self.iface.read_register(Register::MONTH)?; @@ -197,7 +197,7 @@ where } fn set_date(&mut self, date: &rtcc::NaiveDate) -> Result<(), Self::Error> { - if date.year() < 2000 || date.year() > 2100 { + if !(2000..=2199).contains(&date.year()) { return Err(Error::InvalidInputData); } let (month, year) = month_year_to_registers(date.month() as u8, date.year() as u16); From 70ae9c15ba8e114ade5d3c9eba7614fd72ce789b Mon Sep 17 00:00:00 2001 From: Paul Bender Date: Sun, 5 Oct 2025 07:57:54 -0700 Subject: [PATCH 2/2] Remove DummyOutputPin. It hasn't been used since updating to embedded-hal 1.0, and its causing ci failures. --- tests/common/mod.rs | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/tests/common/mod.rs b/tests/common/mod.rs index a460710..a1ff32c 100644 --- a/tests/common/mod.rs +++ b/tests/common/mod.rs @@ -57,21 +57,6 @@ impl BitFlags { pub const WEEKDAY: u8 = 0b0100_0000; } -pub struct DummyOutputPin; - -impl embedded_hal::digital::OutputPin for DummyOutputPin { - fn set_low(&mut self) -> Result<(), Self::Error> { - Ok(()) - } - fn set_high(&mut self) -> Result<(), Self::Error> { - Ok(()) - } -} - -impl embedded_hal::digital::ErrorType for DummyOutputPin { - type Error = embedded_hal::digital::ErrorKind; -} - pub fn new_ds3231( transactions: &[I2cTrans], ) -> Ds323x, ic::DS3231> {