diff --git a/CHANGELOG.md b/CHANGELOG.md index 49b4330a..26c2b0ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ ### Changed - **(breaking)** [#175](https://github.com/jamwaffles/ssd1306/pull/175) Increased MSRV to 1.57.0 +- **(breaking)** [#179](https://github.com/jamwaffles/ssd1306/pull/179) Changed `Ssd1306::reset` signature. ## [0.7.1] - 2022-08-15 diff --git a/src/lib.rs b/src/lib.rs index e3b8a41c..d56ff51a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -119,6 +119,8 @@ pub mod size; #[doc(hidden)] pub mod test_helpers; +use core::convert::Infallible; + pub use crate::i2c_interface::I2CDisplayInterface; use crate::mode::BasicMode; use brightness::Brightness; @@ -412,43 +414,43 @@ where // SPI-only reset impl Ssd1306, SIZE, MODE> { /// Reset the display. - pub fn reset( + pub fn reset( &mut self, rst: &mut RST, delay: &mut DELAY, - ) -> Result<(), Error<(), PinE>> + ) -> Result<(), Error> where - RST: OutputPin, + RST: OutputPin, DELAY: DelayMs, { - inner_reset(rst, delay) + inner_reset(rst, delay).map_err(Error::Pin) } } // SPI-only reset impl Ssd1306, SIZE, MODE> { /// Reset the display. - pub fn reset( + pub fn reset( &mut self, rst: &mut RST, delay: &mut DELAY, - ) -> Result<(), Error<(), PinE>> + ) -> Result<(), Error> where - RST: OutputPin, + RST: OutputPin, DELAY: DelayMs, { - inner_reset(rst, delay) + inner_reset(rst, delay).map_err(Error::Pin) } } -fn inner_reset(rst: &mut RST, delay: &mut DELAY) -> Result<(), Error<(), PinE>> +fn inner_reset(rst: &mut RST, delay: &mut DELAY) -> Result<(), RST::Error> where - RST: OutputPin, + RST: OutputPin, DELAY: DelayMs, { - rst.set_high().map_err(Error::Pin)?; + rst.set_high()?; delay.delay_ms(1); - rst.set_low().map_err(Error::Pin)?; + rst.set_low()?; delay.delay_ms(10); - rst.set_high().map_err(Error::Pin) + rst.set_high() }