Loosen trait bounds

This commit is contained in:
Grant Miller 2021-05-10 17:25:05 -05:00
parent be44c24eea
commit 535feb236c
2 changed files with 8 additions and 2 deletions

View file

@ -1,4 +1,4 @@
use crate::{Ili9341, OutputPin}; use crate::Ili9341;
use core::iter; use core::iter;
@ -17,7 +17,6 @@ use embedded_graphics::{
impl<IFACE, RESET> DrawTarget<Rgb565> for Ili9341<IFACE, RESET> impl<IFACE, RESET> DrawTarget<Rgb565> for Ili9341<IFACE, RESET>
where where
IFACE: display_interface::WriteOnlyDataCommand, IFACE: display_interface::WriteOnlyDataCommand,
RESET: OutputPin,
{ {
type Error = display_interface::DisplayError; type Error = display_interface::DisplayError;

View file

@ -130,7 +130,12 @@ where
Ok(ili9341) Ok(ili9341)
} }
}
impl<IFACE, RESET> Ili9341<IFACE, RESET>
where
IFACE: WriteOnlyDataCommand,
{
fn command(&mut self, cmd: Command, args: &[u8]) -> Result { fn command(&mut self, cmd: Command, args: &[u8]) -> Result {
self.interface.send_commands(U8Iter(&mut once(cmd as u8)))?; self.interface.send_commands(U8Iter(&mut once(cmd as u8)))?;
self.interface.send_data(U8Iter(&mut args.iter().cloned())) self.interface.send_data(U8Iter(&mut args.iter().cloned()))
@ -270,7 +275,9 @@ where
self.mode = mode; self.mode = mode;
Ok(()) Ok(())
} }
}
impl<IFACE, RESET> Ili9341<IFACE, RESET> {
/// Get the current screen width. It can change based on the current orientation /// Get the current screen width. It can change based on the current orientation
pub fn width(&self) -> usize { pub fn width(&self) -> usize {
self.width self.width