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

View file

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