mirror of https://github.com/eldruin/ds323x-rs
Revert "Merge branch 'remove-dummy-output-pin' into century-error"
This reverts commitpull/15/heada9b15528c2, reversing changes made to70ae9c15ba.
parent
3b00789e56
commit
ac6247da93
|
|
@ -36,7 +36,7 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_datetime(&mut self, datetime: &NaiveDateTime) -> Result<(), Self::Error> {
|
fn set_datetime(&mut self, datetime: &NaiveDateTime) -> Result<(), Self::Error> {
|
||||||
if !(2000..=2199).contains(&datetime.year()) {
|
if datetime.year() < 2000 || datetime.year() > 2100 {
|
||||||
return Err(Error::InvalidInputData);
|
return Err(Error::InvalidInputData);
|
||||||
}
|
}
|
||||||
let (month, year) = month_year_to_registers(datetime.month() as u8, datetime.year() as u16);
|
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> {
|
fn set_year(&mut self, year: u16) -> Result<(), Self::Error> {
|
||||||
if !(2000..=2199).contains(&year) {
|
if !(2000..=2100).contains(&year) {
|
||||||
return Err(Error::InvalidInputData);
|
return Err(Error::InvalidInputData);
|
||||||
}
|
}
|
||||||
let data = self.iface.read_register(Register::MONTH)?;
|
let data = self.iface.read_register(Register::MONTH)?;
|
||||||
|
|
@ -197,7 +197,7 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_date(&mut self, date: &rtcc::NaiveDate) -> Result<(), Self::Error> {
|
fn set_date(&mut self, date: &rtcc::NaiveDate) -> Result<(), Self::Error> {
|
||||||
if !(2000..=2199).contains(&date.year()) {
|
if date.year() < 2000 || date.year() > 2100 {
|
||||||
return Err(Error::InvalidInputData);
|
return Err(Error::InvalidInputData);
|
||||||
}
|
}
|
||||||
let (month, year) = month_year_to_registers(date.month() as u8, date.year() as u16);
|
let (month, year) = month_year_to_registers(date.month() as u8, date.year() as u16);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue