From fd6a145825f10037b727a3eb6e26770adc7f6f91 Mon Sep 17 00:00:00 2001 From: kirbylife Date: Wed, 26 Apr 2023 22:24:34 -0600 Subject: [PATCH] fix set_day method The method receives in decimal the value to be set as the day of the month, but the ds3231 module expects it in bcd format. Using the 'write_register_decimal' method, can be written in the correct format. --- src/ds323x/datetime.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ds323x/datetime.rs b/src/ds323x/datetime.rs index c5f4871..ba148e1 100644 --- a/src/ds323x/datetime.rs +++ b/src/ds323x/datetime.rs @@ -160,7 +160,7 @@ where if !(1..=31).contains(&day) { return Err(Error::InvalidInputData); } - self.iface.write_register(Register::DOM, day) + self.write_register_decimal(Register::DOM, day) } fn set_month(&mut self, month: u8) -> Result<(), Self::Error> {