This commit is contained in:
saji 2024-07-18 15:51:07 -05:00
parent a376cadecc
commit b5073bec89
2 changed files with 8 additions and 8 deletions

View file

@ -3,14 +3,14 @@ use linux_embedded_hal::spidev::SpiModeFlags;
use linux_embedded_hal::spidev::SpidevOptions;
use linux_embedded_hal::{CdevPin, Delay, SpidevDevice};
use linux_embedded_hal::gpio_cdev::{Chip, LineRequestFlags};
use anyhow::Result;
use linux_embedded_hal::gpio_cdev::{Chip, LineRequestFlags};
pub struct Wrapper {
spi: SpidevDevice,
gpiochip: Chip,
delay: Delay,
panel: Epd7in3f<SpidevDevice, CdevPin, CdevPin, CdevPin, Delay>
panel: Epd7in3f<SpidevDevice, CdevPin, CdevPin, CdevPin, Delay>,
}
impl Wrapper {
@ -46,11 +46,12 @@ impl Wrapper {
spi,
gpiochip,
delay,
panel
panel,
})
}
pub fn display(&mut self, buf: &[u8]) -> Result<()> {
self.panel.update_and_display_frame(&mut self.spi, buf, &mut self.delay)?;
self.panel
.update_and_display_frame(&mut self.spi, buf, &mut self.delay)?;
self.panel.sleep(&mut self.spi, &mut self.delay)?;
Ok(())
}
@ -60,4 +61,3 @@ impl Wrapper {
Ok(())
}
}

View file

@ -1,8 +1,8 @@
use image::RgbImage;
use image::Rgb as imgRgb;
use palette::color_difference::{Ciede2000, EuclideanDistance};
use palette::{cast::FromComponents, IntoColor, Lab, Oklch, Srgb};
use palette::color_difference::Ciede2000;
use palette::{cast::FromComponents, IntoColor, Lab, Srgb};
/// Palette used on the display; pixels can be one of these colors.
///