diff --git a/src/error.rs b/src/error.rs deleted file mode 100644 index 89e76dd..0000000 --- a/src/error.rs +++ /dev/null @@ -1,16 +0,0 @@ -use core::fmt::{self, Debug}; -use hal::digital::v2::OutputPin; - -pub enum Error { - /// A GPIO could not be set. - Gpio(GPIO::Error), -} - -impl Debug for Error -{ - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - match self { - Error::Gpio(_) => write!(f, "GPIO error"), - } - } -} \ No newline at end of file diff --git a/src/interface.rs b/src/interface.rs index 3eb0764..433f0cf 100644 --- a/src/interface.rs +++ b/src/interface.rs @@ -1,4 +1,4 @@ -use crate::Error; +use core::fmt::Debug; use hal; // Section 15.2 of the HINK-E0213A07 data sheet says to hold for 10ms @@ -138,29 +138,32 @@ impl DisplayInterface for Interface, CS: hal::digital::v2::OutputPin, + CS::Error: Debug, BUSY: hal::digital::v2::InputPin, DC: hal::digital::v2::OutputPin, + DC::Error: Debug, RESET: hal::digital::v2::OutputPin, + RESET::Error: Debug, { type Error = SPI::Error; - fn reset>(&mut self, delay: &mut D){ - self.reset.set_low().map_err::, _>(Error::Gpio).unwrap(); + fn reset>(&mut self, delay: &mut D) { + self.reset.set_low().unwrap(); delay.delay_ms(RESET_DELAY_MS); - self.reset.set_high().map_err::, _>(Error::Gpio).unwrap(); + self.reset.set_high().unwrap(); delay.delay_ms(RESET_DELAY_MS); } fn send_command(&mut self, command: u8) -> Result<(), Self::Error> { - self.dc.set_low().map_err::, _>(Error::Gpio).unwrap(); + self.dc.set_low().unwrap(); self.write(&[command])?; - self.dc.set_high().map_err::, _>(Error::Gpio).unwrap(); + self.dc.set_high().unwrap(); Ok(()) } fn send_data(&mut self, data: &[u8]) -> Result<(), Self::Error> { - self.dc.set_high().map_err::, _>(Error::Gpio).unwrap(); + self.dc.set_high().unwrap(); self.write(data) } diff --git a/src/lib.rs b/src/lib.rs index ce4fc3b..f366c05 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -47,14 +47,12 @@ mod color; pub mod command; pub mod config; pub mod display; -pub mod error; pub mod graphics; pub mod interface; pub use color::Color; pub use config::Builder; pub use display::{Dimensions, Display, Rotation}; -pub use error::Error; pub use graphics::GraphicDisplay; pub use interface::DisplayInterface; pub use interface::Interface;