Further improvements around acronym lowercases,...
parent
9d95eeb64b
commit
15e557951f
|
|
@ -9,13 +9,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|||
|
||||
### Added
|
||||
|
||||
- Added QuickRefresh Trait and implemented it for EPD4in2 in #62 (thanks to @David-OConnor)
|
||||
- Added QuickRefresh Trait and implemented it for Epd4in2 in #62 (thanks to @David-OConnor)
|
||||
- Added Epd 2in7 (B) support in #60 (thanks to @pjsier)
|
||||
|
||||
### Changed
|
||||
|
||||
- Use specific ParseColorError instead of ()
|
||||
- EPD4in2: Don't set the resolution (and some more) over and over again (#48)
|
||||
- Epd4in2: Don't set the resolution (and some more) over and over again (#48)
|
||||
- Removed `#[allow(non_camel_case_types)]` to fix various issues around it
|
||||
|
||||
### Fixed
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ There are multiple examples in the examples folder. Use `cargo run --example exa
|
|||
|
||||
```Rust
|
||||
// Setup the epd
|
||||
let mut epd = EPD4in2::new( & mut spi, cs, busy, dc, rst, & mut delay) ?;
|
||||
let mut epd = Epd4in2::new( & mut spi, cs, busy, dc, rst, & mut delay) ?;
|
||||
|
||||
// Setup the graphics
|
||||
let mut display = Display4in2::default ();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#![deny(warnings)]
|
||||
|
||||
use embedded_hal::prelude::*;
|
||||
use epd_waveshare::{epd1in54::EPD1in54, prelude::*};
|
||||
use epd_waveshare::{epd1in54::Epd1in54, prelude::*};
|
||||
use linux_embedded_hal::{
|
||||
spidev::{self, SpidevOptions},
|
||||
sysfs_gpio::Direction,
|
||||
|
|
@ -58,14 +58,14 @@ fn main() -> Result<(), std::io::Error> {
|
|||
|
||||
// Setup of the needed pins is finished here
|
||||
// Now the "real" usage of the eink-waveshare-rs crate begins
|
||||
let mut epd = EPD1in54::new(&mut spi, cs_pin, busy, dc, rst, &mut delay)?;
|
||||
let mut epd = Epd1in54::new(&mut spi, cs_pin, busy, dc, rst, &mut delay)?;
|
||||
|
||||
// Clear the full screen
|
||||
epd.clear_frame(&mut spi)?;
|
||||
epd.display_frame(&mut spi)?;
|
||||
|
||||
// Speeddemo
|
||||
epd.set_lut(&mut spi, Some(RefreshLUT::QUICK))?;
|
||||
epd.set_lut(&mut spi, Some(RefreshLut::Quick))?;
|
||||
let small_buffer = [Color::Black.get_byte_value(); 32]; //16x16
|
||||
let number_of_runs = 1;
|
||||
for i in 0..number_of_runs {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ use embedded_graphics::{
|
|||
use embedded_hal::prelude::*;
|
||||
use epd_waveshare::{
|
||||
color::*,
|
||||
epd2in13_v2::{Display2in13, EPD2in13},
|
||||
epd2in13_v2::{Display2in13, Epd2in13},
|
||||
graphics::{Display, DisplayRotation},
|
||||
prelude::*,
|
||||
};
|
||||
|
|
@ -63,7 +63,7 @@ fn main() -> Result<(), std::io::Error> {
|
|||
let mut delay = Delay {};
|
||||
|
||||
let mut epd2in13 =
|
||||
EPD2in13::new(&mut spi, cs, busy, dc, rst, &mut delay).expect("eink initalize error");
|
||||
Epd2in13::new(&mut spi, cs, busy, dc, rst, &mut delay).expect("eink initalize error");
|
||||
|
||||
//println!("Test all the rotations");
|
||||
let mut display = Display2in13::default();
|
||||
|
|
@ -121,7 +121,7 @@ fn main() -> Result<(), std::io::Error> {
|
|||
// Demonstrating how to use the partial refresh feature of the screen.
|
||||
// Real animations can be used.
|
||||
epd2in13
|
||||
.set_refresh(&mut spi, &mut delay, RefreshLUT::QUICK)
|
||||
.set_refresh(&mut spi, &mut delay, RefreshLut::Quick)
|
||||
.unwrap();
|
||||
epd2in13.clear_frame(&mut spi).unwrap();
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ use embedded_graphics::{
|
|||
use embedded_hal::prelude::*;
|
||||
use epd_waveshare::{
|
||||
color::*,
|
||||
epd4in2::{Display4in2, EPD4in2},
|
||||
epd4in2::{Display4in2, Epd4in2},
|
||||
graphics::{Display, DisplayRotation},
|
||||
prelude::*,
|
||||
};
|
||||
|
|
@ -63,7 +63,7 @@ fn main() -> Result<(), std::io::Error> {
|
|||
let mut delay = Delay {};
|
||||
|
||||
let mut epd4in2 =
|
||||
EPD4in2::new(&mut spi, cs, busy, dc, rst, &mut delay).expect("eink initalize error");
|
||||
Epd4in2::new(&mut spi, cs, busy, dc, rst, &mut delay).expect("eink initalize error");
|
||||
|
||||
//println!("Test all the rotations");
|
||||
let mut display = Display4in2::default();
|
||||
|
|
@ -120,7 +120,7 @@ fn main() -> Result<(), std::io::Error> {
|
|||
|
||||
// a moving `Hello World!`
|
||||
let limit = 10;
|
||||
epd4in2.set_lut(&mut spi, Some(RefreshLUT::QUICK)).unwrap();
|
||||
epd4in2.set_lut(&mut spi, Some(RefreshLut::Quick)).unwrap();
|
||||
epd4in2.clear_frame(&mut spi).unwrap();
|
||||
for i in 0..limit {
|
||||
//println!("Moving Hello World. Loop {} from {}", (i + 1), limit);
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ use embedded_graphics::{
|
|||
use embedded_hal::prelude::*;
|
||||
use epd_waveshare::{
|
||||
color::*,
|
||||
epd4in2::{self, EPD4in2},
|
||||
epd4in2::{self, Epd4in2},
|
||||
graphics::{Display, DisplayRotation, VarDisplay},
|
||||
prelude::*,
|
||||
};
|
||||
|
|
@ -64,7 +64,7 @@ fn main() -> Result<(), std::io::Error> {
|
|||
let mut delay = Delay {};
|
||||
|
||||
let mut epd4in2 =
|
||||
EPD4in2::new(&mut spi, cs, busy, dc, rst, &mut delay).expect("eink initalize error");
|
||||
Epd4in2::new(&mut spi, cs, busy, dc, rst, &mut delay).expect("eink initalize error");
|
||||
|
||||
println!("Test all the rotations");
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
//!# let mut delay = delay::MockNoop::new();
|
||||
//!
|
||||
//!// Setup EPD
|
||||
//!let mut epd = EPD1in54::new(&mut spi, cs_pin, busy_in, dc, rst, &mut delay)?;
|
||||
//!let mut epd = Epd1in54::new(&mut spi, cs_pin, busy_in, dc, rst, &mut delay)?;
|
||||
//!
|
||||
//!// Use display graphics from embedded-graphics
|
||||
//!let mut display = Display1in54::default();
|
||||
|
|
@ -61,7 +61,7 @@ use crate::type_a::{
|
|||
|
||||
use crate::color::Color;
|
||||
|
||||
use crate::traits::{RefreshLUT, WaveshareDisplay};
|
||||
use crate::traits::{RefreshLut, WaveshareDisplay};
|
||||
|
||||
use crate::interface::DisplayInterface;
|
||||
|
||||
|
|
@ -70,18 +70,18 @@ mod graphics;
|
|||
#[cfg(feature = "graphics")]
|
||||
pub use crate::epd1in54::graphics::Display1in54;
|
||||
|
||||
/// EPD1in54 driver
|
||||
/// Epd1in54 driver
|
||||
///
|
||||
pub struct EPD1in54<SPI, CS, BUSY, DC, RST> {
|
||||
pub struct Epd1in54<SPI, CS, BUSY, DC, RST> {
|
||||
/// SPI
|
||||
interface: DisplayInterface<SPI, CS, BUSY, DC, RST>,
|
||||
/// Color
|
||||
background_color: Color,
|
||||
/// Refresh LUT
|
||||
refresh: RefreshLUT,
|
||||
refresh: RefreshLut,
|
||||
}
|
||||
|
||||
impl<SPI, CS, BUSY, DC, RST> EPD1in54<SPI, CS, BUSY, DC, RST>
|
||||
impl<SPI, CS, BUSY, DC, RST> Epd1in54<SPI, CS, BUSY, DC, RST>
|
||||
where
|
||||
SPI: Write<u8>,
|
||||
CS: OutputPin,
|
||||
|
|
@ -140,7 +140,7 @@ where
|
|||
}
|
||||
|
||||
impl<SPI, CS, BUSY, DC, RST, E> WaveshareDisplay<SPI, CS, BUSY, DC, RST>
|
||||
for EPD1in54<SPI, CS, BUSY, DC, RST>
|
||||
for Epd1in54<SPI, CS, BUSY, DC, RST>
|
||||
where
|
||||
SPI: Write<u8, Error = E>,
|
||||
CS: OutputPin,
|
||||
|
|
@ -167,10 +167,10 @@ where
|
|||
) -> Result<Self, SPI::Error> {
|
||||
let interface = DisplayInterface::new(cs, busy, dc, rst);
|
||||
|
||||
let mut epd = EPD1in54 {
|
||||
let mut epd = Epd1in54 {
|
||||
interface,
|
||||
background_color: DEFAULT_BACKGROUND_COLOR,
|
||||
refresh: RefreshLUT::FULL,
|
||||
refresh: RefreshLut::Full,
|
||||
};
|
||||
|
||||
epd.init(spi, delay)?;
|
||||
|
|
@ -232,7 +232,7 @@ where
|
|||
self.interface.cmd(spi, Command::MasterActivation)?;
|
||||
// MASTER Activation should not be interupted to avoid currption of panel images
|
||||
// therefore a terminate command is send
|
||||
self.interface.cmd(spi, Command::NOP)?;
|
||||
self.interface.cmd(spi, Command::Nop)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
@ -266,14 +266,14 @@ where
|
|||
fn set_lut(
|
||||
&mut self,
|
||||
spi: &mut SPI,
|
||||
refresh_rate: Option<RefreshLUT>,
|
||||
refresh_rate: Option<RefreshLut>,
|
||||
) -> Result<(), SPI::Error> {
|
||||
if let Some(refresh_lut) = refresh_rate {
|
||||
self.refresh = refresh_lut;
|
||||
}
|
||||
match self.refresh {
|
||||
RefreshLUT::FULL => self.set_lut_helper(spi, &LUT_FULL_UPDATE),
|
||||
RefreshLUT::QUICK => self.set_lut_helper(spi, &LUT_PARTIAL_UPDATE),
|
||||
RefreshLut::Full => self.set_lut_helper(spi, &LUT_FULL_UPDATE),
|
||||
RefreshLut::Quick => self.set_lut_helper(spi, &LUT_PARTIAL_UPDATE),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -282,7 +282,7 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
impl<SPI, CS, BUSY, DC, RST> EPD1in54<SPI, CS, BUSY, DC, RST>
|
||||
impl<SPI, CS, BUSY, DC, RST> Epd1in54<SPI, CS, BUSY, DC, RST>
|
||||
where
|
||||
SPI: Write<u8>,
|
||||
CS: OutputPin,
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ pub(crate) enum Command {
|
|||
LutRed1 = 0x27,
|
||||
|
||||
PllControl = 0x30,
|
||||
TemperatureSensorCommand = 0x40,
|
||||
TemperatureSensor = 0x40,
|
||||
TemperatureSensorSelection = 0x41,
|
||||
VcomAndDataIntervalSetting = 0x50,
|
||||
ResolutionSetting = 0x61,
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ use embedded_hal::{
|
|||
|
||||
use crate::interface::DisplayInterface;
|
||||
use crate::traits::{
|
||||
InternalWiAdditions, RefreshLUT, WaveshareDisplay, WaveshareThreeColorDisplay,
|
||||
InternalWiAdditions, RefreshLut, WaveshareDisplay, WaveshareThreeColorDisplay,
|
||||
};
|
||||
|
||||
//The Lookup Tables for the Display
|
||||
|
|
@ -32,14 +32,14 @@ mod graphics;
|
|||
#[cfg(feature = "graphics")]
|
||||
pub use self::graphics::Display1in54b;
|
||||
|
||||
/// EPD1in54b driver
|
||||
pub struct EPD1in54b<SPI, CS, BUSY, DC, RST> {
|
||||
/// Epd1in54b driver
|
||||
pub struct Epd1in54b<SPI, CS, BUSY, DC, RST> {
|
||||
interface: DisplayInterface<SPI, CS, BUSY, DC, RST>,
|
||||
color: Color,
|
||||
}
|
||||
|
||||
impl<SPI, CS, BUSY, DC, RST> InternalWiAdditions<SPI, CS, BUSY, DC, RST>
|
||||
for EPD1in54b<SPI, CS, BUSY, DC, RST>
|
||||
for Epd1in54b<SPI, CS, BUSY, DC, RST>
|
||||
where
|
||||
SPI: Write<u8>,
|
||||
CS: OutputPin,
|
||||
|
|
@ -89,7 +89,7 @@ where
|
|||
}
|
||||
|
||||
impl<SPI, CS, BUSY, DC, RST> WaveshareThreeColorDisplay<SPI, CS, BUSY, DC, RST>
|
||||
for EPD1in54b<SPI, CS, BUSY, DC, RST>
|
||||
for Epd1in54b<SPI, CS, BUSY, DC, RST>
|
||||
where
|
||||
SPI: Write<u8>,
|
||||
CS: OutputPin,
|
||||
|
|
@ -132,7 +132,7 @@ where
|
|||
}
|
||||
|
||||
impl<SPI, CS, BUSY, DC, RST> WaveshareDisplay<SPI, CS, BUSY, DC, RST>
|
||||
for EPD1in54b<SPI, CS, BUSY, DC, RST>
|
||||
for Epd1in54b<SPI, CS, BUSY, DC, RST>
|
||||
where
|
||||
SPI: Write<u8>,
|
||||
CS: OutputPin,
|
||||
|
|
@ -152,7 +152,7 @@ where
|
|||
let interface = DisplayInterface::new(cs, busy, dc, rst);
|
||||
let color = DEFAULT_BACKGROUND_COLOR;
|
||||
|
||||
let mut epd = EPD1in54b { interface, color };
|
||||
let mut epd = Epd1in54b { interface, color };
|
||||
|
||||
epd.init(spi, delay)?;
|
||||
|
||||
|
|
@ -165,7 +165,7 @@ where
|
|||
.cmd_with_data(spi, Command::VcomAndDataIntervalSetting, &[0x17])?; //border floating
|
||||
|
||||
self.interface
|
||||
.cmd_with_data(spi, Command::VcmDcSetting, &[0x00])?; // VCOM to 0V
|
||||
.cmd_with_data(spi, Command::VcmDcSetting, &[0x00])?; // Vcom to 0V
|
||||
|
||||
self.interface
|
||||
.cmd_with_data(spi, Command::PowerSetting, &[0x02, 0x00, 0x00, 0x00])?; //VG&VS to 0V fast
|
||||
|
|
@ -276,7 +276,7 @@ where
|
|||
fn set_lut(
|
||||
&mut self,
|
||||
spi: &mut SPI,
|
||||
_refresh_rate: Option<RefreshLUT>,
|
||||
_refresh_rate: Option<RefreshLut>,
|
||||
) -> Result<(), SPI::Error> {
|
||||
self.interface
|
||||
.cmd_with_data(spi, Command::LutForVcom, LUT_VCOM0)?;
|
||||
|
|
@ -301,7 +301,7 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
impl<SPI, CS, BUSY, DC, RST> EPD1in54b<SPI, CS, BUSY, DC, RST>
|
||||
impl<SPI, CS, BUSY, DC, RST> Epd1in54b<SPI, CS, BUSY, DC, RST>
|
||||
where
|
||||
SPI: Write<u8>,
|
||||
CS: OutputPin,
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ pub(crate) enum Command {
|
|||
LutBlackToBlack = 0x24,
|
||||
|
||||
PllControl = 0x30,
|
||||
TemperatureSensorCommand = 0x40,
|
||||
TemperatureSensor = 0x40,
|
||||
TemperatureSensorSelection = 0x41,
|
||||
VcomAndDataIntervalSetting = 0x50,
|
||||
ResolutionSetting = 0x61,
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ use embedded_hal::{
|
|||
|
||||
use crate::interface::DisplayInterface;
|
||||
use crate::traits::{
|
||||
InternalWiAdditions, RefreshLUT, WaveshareDisplay, WaveshareThreeColorDisplay,
|
||||
InternalWiAdditions, RefreshLut, WaveshareDisplay, WaveshareThreeColorDisplay,
|
||||
};
|
||||
|
||||
/// Width of epd1in54 in pixels
|
||||
|
|
@ -30,14 +30,14 @@ mod graphics;
|
|||
#[cfg(feature = "graphics")]
|
||||
pub use self::graphics::Display1in54c;
|
||||
|
||||
/// EPD1in54c driver
|
||||
pub struct EPD1in54c<SPI, CS, BUSY, DC, RST> {
|
||||
/// Epd1in54c driver
|
||||
pub struct Epd1in54c<SPI, CS, BUSY, DC, RST> {
|
||||
interface: DisplayInterface<SPI, CS, BUSY, DC, RST>,
|
||||
color: Color,
|
||||
}
|
||||
|
||||
impl<SPI, CS, BUSY, DC, RST> InternalWiAdditions<SPI, CS, BUSY, DC, RST>
|
||||
for EPD1in54c<SPI, CS, BUSY, DC, RST>
|
||||
for Epd1in54c<SPI, CS, BUSY, DC, RST>
|
||||
where
|
||||
SPI: Write<u8>,
|
||||
CS: OutputPin,
|
||||
|
|
@ -77,7 +77,7 @@ where
|
|||
}
|
||||
|
||||
impl<SPI, CS, BUSY, DC, RST> WaveshareThreeColorDisplay<SPI, CS, BUSY, DC, RST>
|
||||
for EPD1in54c<SPI, CS, BUSY, DC, RST>
|
||||
for Epd1in54c<SPI, CS, BUSY, DC, RST>
|
||||
where
|
||||
SPI: Write<u8>,
|
||||
CS: OutputPin,
|
||||
|
|
@ -115,7 +115,7 @@ where
|
|||
}
|
||||
|
||||
impl<SPI, CS, BUSY, DC, RST> WaveshareDisplay<SPI, CS, BUSY, DC, RST>
|
||||
for EPD1in54c<SPI, CS, BUSY, DC, RST>
|
||||
for Epd1in54c<SPI, CS, BUSY, DC, RST>
|
||||
where
|
||||
SPI: Write<u8>,
|
||||
CS: OutputPin,
|
||||
|
|
@ -135,7 +135,7 @@ where
|
|||
let interface = DisplayInterface::new(cs, busy, dc, rst);
|
||||
let color = DEFAULT_BACKGROUND_COLOR;
|
||||
|
||||
let mut epd = EPD1in54c { interface, color };
|
||||
let mut epd = Epd1in54c { interface, color };
|
||||
|
||||
epd.init(spi, delay)?;
|
||||
|
||||
|
|
@ -233,7 +233,7 @@ where
|
|||
fn set_lut(
|
||||
&mut self,
|
||||
_spi: &mut SPI,
|
||||
_refresh_rate: Option<RefreshLUT>,
|
||||
_refresh_rate: Option<RefreshLut>,
|
||||
) -> Result<(), SPI::Error> {
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -243,7 +243,7 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
impl<SPI, CS, BUSY, DC, RST> EPD1in54c<SPI, CS, BUSY, DC, RST>
|
||||
impl<SPI, CS, BUSY, DC, RST> Epd1in54c<SPI, CS, BUSY, DC, RST>
|
||||
where
|
||||
SPI: Write<u8>,
|
||||
CS: OutputPin,
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ use crate::traits;
|
|||
extern crate bit_field;
|
||||
use bit_field::BitField;
|
||||
|
||||
/// EPD2in13 v2
|
||||
/// Epd2in13 v2
|
||||
///
|
||||
/// For more infos about the addresses and what they are doing look into the pdfs
|
||||
#[allow(dead_code)]
|
||||
|
|
@ -54,7 +54,7 @@ pub(crate) enum Command {
|
|||
SetAnalogBlockControl = 0x74,
|
||||
SetDigitalBlockControl = 0x7E,
|
||||
|
||||
NOP = 0x7F,
|
||||
Nop = 0x7F,
|
||||
}
|
||||
|
||||
pub(crate) struct DriverOutput {
|
||||
|
|
@ -151,34 +151,34 @@ pub(crate) enum DataEntryModeDir {
|
|||
|
||||
#[allow(dead_code)]
|
||||
#[derive(Copy, Clone)]
|
||||
pub(crate) enum BorderWaveFormVBD {
|
||||
GS = 0x0,
|
||||
pub(crate) enum BorderWaveFormVbd {
|
||||
Gs = 0x0,
|
||||
FixLevel = 0x1,
|
||||
VCOM = 0x2,
|
||||
Vcom = 0x2,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(Copy, Clone)]
|
||||
pub(crate) enum BorderWaveFormFixLevel {
|
||||
VSS = 0x0,
|
||||
VSH1 = 0x1,
|
||||
VSL = 0x2,
|
||||
VSH2 = 0x3,
|
||||
Vss = 0x0,
|
||||
Vsh1 = 0x1,
|
||||
Vsl = 0x2,
|
||||
Vsh2 = 0x3,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(Copy, Clone)]
|
||||
pub(crate) enum BorderWaveFormGS {
|
||||
LUT0 = 0x0,
|
||||
LUT1 = 0x1,
|
||||
LUT2 = 0x2,
|
||||
LUT3 = 0x3,
|
||||
pub(crate) enum BorderWaveFormGs {
|
||||
Lut0 = 0x0,
|
||||
Lut1 = 0x1,
|
||||
Lut2 = 0x2,
|
||||
Lut3 = 0x3,
|
||||
}
|
||||
|
||||
pub(crate) struct BorderWaveForm {
|
||||
pub vbd: BorderWaveFormVBD,
|
||||
pub vbd: BorderWaveFormVbd,
|
||||
pub fix_level: BorderWaveFormFixLevel,
|
||||
pub gs_trans: BorderWaveFormGS,
|
||||
pub gs_trans: BorderWaveFormGs,
|
||||
}
|
||||
|
||||
impl BorderWaveForm {
|
||||
|
|
@ -204,10 +204,10 @@ pub enum DeepSleepMode {
|
|||
|
||||
pub(crate) struct GateDrivingVoltage(pub u8);
|
||||
pub(crate) struct SourceDrivingVoltage(pub u8);
|
||||
pub(crate) struct VCOM(pub u8);
|
||||
pub(crate) struct Vcom(pub u8);
|
||||
|
||||
pub(crate) trait I32Ext {
|
||||
fn vcom(self) -> VCOM;
|
||||
fn vcom(self) -> Vcom;
|
||||
fn gate_driving_decivolt(self) -> GateDrivingVoltage;
|
||||
fn source_driving_decivolt(self) -> SourceDrivingVoltage;
|
||||
}
|
||||
|
|
@ -215,7 +215,7 @@ pub(crate) trait I32Ext {
|
|||
impl I32Ext for i32 {
|
||||
// This is really not very nice. Until I find something better, this will be
|
||||
// a placeholder.
|
||||
fn vcom(self) -> VCOM {
|
||||
fn vcom(self) -> Vcom {
|
||||
assert!((-30..=-2).contains(&self));
|
||||
let u = match -self {
|
||||
2 => 0x08,
|
||||
|
|
@ -249,7 +249,7 @@ impl I32Ext for i32 {
|
|||
30 => 0x78,
|
||||
_ => 0,
|
||||
};
|
||||
VCOM(u)
|
||||
Vcom(u)
|
||||
}
|
||||
|
||||
fn gate_driving_decivolt(self) -> GateDrivingVoltage {
|
||||
|
|
|
|||
|
|
@ -16,13 +16,13 @@ use embedded_hal::{
|
|||
use crate::buffer_len;
|
||||
use crate::color::Color;
|
||||
use crate::interface::DisplayInterface;
|
||||
use crate::traits::{InternalWiAdditions, RefreshLUT, WaveshareDisplay};
|
||||
use crate::traits::{InternalWiAdditions, RefreshLut, WaveshareDisplay};
|
||||
|
||||
pub(crate) mod command;
|
||||
use self::command::{
|
||||
BorderWaveForm, BorderWaveFormFixLevel, BorderWaveFormGS, BorderWaveFormVBD, Command,
|
||||
BorderWaveForm, BorderWaveFormFixLevel, BorderWaveFormGs, BorderWaveFormVbd, Command,
|
||||
DataEntryModeDir, DataEntryModeIncr, DeepSleepMode, DisplayUpdateControl2, DriverOutput,
|
||||
GateDrivingVoltage, I32Ext, SourceDrivingVoltage, VCOM,
|
||||
GateDrivingVoltage, I32Ext, SourceDrivingVoltage, Vcom,
|
||||
};
|
||||
|
||||
pub(crate) mod constants;
|
||||
|
|
@ -43,9 +43,9 @@ pub const HEIGHT: u32 = 250;
|
|||
pub const DEFAULT_BACKGROUND_COLOR: Color = Color::White;
|
||||
const IS_BUSY_LOW: bool = false;
|
||||
|
||||
/// EPD2in13 (V2) driver
|
||||
/// Epd2in13 (V2) driver
|
||||
///
|
||||
pub struct EPD2in13<SPI, CS, BUSY, DC, RST> {
|
||||
pub struct Epd2in13<SPI, CS, BUSY, DC, RST> {
|
||||
/// Connection Interface
|
||||
interface: DisplayInterface<SPI, CS, BUSY, DC, RST>,
|
||||
|
||||
|
|
@ -53,11 +53,11 @@ pub struct EPD2in13<SPI, CS, BUSY, DC, RST> {
|
|||
|
||||
/// Background Color
|
||||
background_color: Color,
|
||||
refresh: RefreshLUT,
|
||||
refresh: RefreshLut,
|
||||
}
|
||||
|
||||
impl<SPI, CS, BUSY, DC, RST> InternalWiAdditions<SPI, CS, BUSY, DC, RST>
|
||||
for EPD2in13<SPI, CS, BUSY, DC, RST>
|
||||
for Epd2in13<SPI, CS, BUSY, DC, RST>
|
||||
where
|
||||
SPI: Write<u8>,
|
||||
CS: OutputPin,
|
||||
|
|
@ -73,7 +73,7 @@ where
|
|||
// HW reset
|
||||
self.interface.reset(delay, 10);
|
||||
|
||||
if self.refresh == RefreshLUT::QUICK {
|
||||
if self.refresh == RefreshLut::Quick {
|
||||
self.set_vcom_register(spi, (-9).vcom())?;
|
||||
self.wait_until_idle();
|
||||
|
||||
|
|
@ -94,9 +94,9 @@ where
|
|||
self.set_border_waveform(
|
||||
spi,
|
||||
BorderWaveForm {
|
||||
vbd: BorderWaveFormVBD::GS,
|
||||
fix_level: BorderWaveFormFixLevel::VSS,
|
||||
gs_trans: BorderWaveFormGS::LUT1,
|
||||
vbd: BorderWaveFormVbd::Gs,
|
||||
fix_level: BorderWaveFormFixLevel::Vss,
|
||||
gs_trans: BorderWaveFormGs::Lut1,
|
||||
},
|
||||
)?;
|
||||
} else {
|
||||
|
|
@ -127,9 +127,9 @@ where
|
|||
self.set_border_waveform(
|
||||
spi,
|
||||
BorderWaveForm {
|
||||
vbd: BorderWaveFormVBD::GS,
|
||||
fix_level: BorderWaveFormFixLevel::VSS,
|
||||
gs_trans: BorderWaveFormGS::LUT3,
|
||||
vbd: BorderWaveFormVbd::Gs,
|
||||
fix_level: BorderWaveFormFixLevel::Vss,
|
||||
gs_trans: BorderWaveFormGs::Lut3,
|
||||
},
|
||||
)?;
|
||||
|
||||
|
|
@ -154,7 +154,7 @@ where
|
|||
}
|
||||
|
||||
impl<SPI, CS, BUSY, DC, RST> WaveshareDisplay<SPI, CS, BUSY, DC, RST>
|
||||
for EPD2in13<SPI, CS, BUSY, DC, RST>
|
||||
for Epd2in13<SPI, CS, BUSY, DC, RST>
|
||||
where
|
||||
SPI: Write<u8>,
|
||||
CS: OutputPin,
|
||||
|
|
@ -171,11 +171,11 @@ where
|
|||
rst: RST,
|
||||
delay: &mut DELAY,
|
||||
) -> Result<Self, SPI::Error> {
|
||||
let mut epd = EPD2in13 {
|
||||
let mut epd = Epd2in13 {
|
||||
interface: DisplayInterface::new(cs, busy, dc, rst),
|
||||
sleep_mode: DeepSleepMode::Mode1,
|
||||
background_color: DEFAULT_BACKGROUND_COLOR,
|
||||
refresh: RefreshLUT::FULL,
|
||||
refresh: RefreshLut::Full,
|
||||
};
|
||||
|
||||
epd.init(spi, delay)?;
|
||||
|
|
@ -215,7 +215,7 @@ where
|
|||
|
||||
self.cmd_with_data(spi, Command::WriteRam, buffer)?;
|
||||
|
||||
if self.refresh == RefreshLUT::FULL {
|
||||
if self.refresh == RefreshLut::Full {
|
||||
// Always keep the base buffer equal to current if not doing partial refresh.
|
||||
self.set_ram_area(spi, 0, 0, WIDTH - 1, HEIGHT - 1)?;
|
||||
self.set_ram_address_counters(spi, 0, 0)?;
|
||||
|
|
@ -245,14 +245,14 @@ where
|
|||
// RAM content). Using this function will most probably make the actual
|
||||
// display incorrect as the controler will compare with something
|
||||
// incorrect.
|
||||
assert!(self.refresh == RefreshLUT::FULL);
|
||||
assert!(self.refresh == RefreshLut::Full);
|
||||
|
||||
self.set_ram_area(spi, x, y, x + width, y + height)?;
|
||||
self.set_ram_address_counters(spi, x, y)?;
|
||||
|
||||
self.cmd_with_data(spi, Command::WriteRam, buffer)?;
|
||||
|
||||
if self.refresh == RefreshLUT::FULL {
|
||||
if self.refresh == RefreshLut::Full {
|
||||
// Always keep the base buffer equals to current if not doing partial refresh.
|
||||
self.set_ram_area(spi, x, y, x + width, y + height)?;
|
||||
self.set_ram_address_counters(spi, x, y)?;
|
||||
|
|
@ -266,7 +266,7 @@ where
|
|||
/// Never use directly this function when using partial refresh, or also
|
||||
/// keep the base buffer in syncd using `set_partial_base_buffer` function.
|
||||
fn display_frame(&mut self, spi: &mut SPI) -> Result<(), SPI::Error> {
|
||||
if self.refresh == RefreshLUT::FULL {
|
||||
if self.refresh == RefreshLut::Full {
|
||||
self.set_display_update_control_2(
|
||||
spi,
|
||||
DisplayUpdateControl2::new()
|
||||
|
|
@ -289,7 +289,7 @@ where
|
|||
self.update_frame(spi, buffer)?;
|
||||
self.display_frame(spi)?;
|
||||
|
||||
if self.refresh == RefreshLUT::QUICK {
|
||||
if self.refresh == RefreshLut::Quick {
|
||||
self.set_partial_base_buffer(spi, buffer)?;
|
||||
}
|
||||
Ok(())
|
||||
|
|
@ -309,7 +309,7 @@ where
|
|||
)?;
|
||||
|
||||
// Always keep the base buffer equals to current if not doing partial refresh.
|
||||
if self.refresh == RefreshLUT::FULL {
|
||||
if self.refresh == RefreshLut::Full {
|
||||
self.set_ram_area(spi, 0, 0, WIDTH - 1, HEIGHT - 1)?;
|
||||
self.set_ram_address_counters(spi, 0, 0)?;
|
||||
|
||||
|
|
@ -342,11 +342,11 @@ where
|
|||
fn set_lut(
|
||||
&mut self,
|
||||
spi: &mut SPI,
|
||||
refresh_rate: Option<RefreshLUT>,
|
||||
refresh_rate: Option<RefreshLut>,
|
||||
) -> Result<(), SPI::Error> {
|
||||
let buffer = match refresh_rate {
|
||||
Some(RefreshLUT::FULL) | None => &LUT_FULL_UPDATE,
|
||||
Some(RefreshLUT::QUICK) => &LUT_PARTIAL_UPDATE,
|
||||
Some(RefreshLut::Full) | None => &LUT_FULL_UPDATE,
|
||||
Some(RefreshLut::Quick) => &LUT_PARTIAL_UPDATE,
|
||||
};
|
||||
|
||||
self.cmd_with_data(spi, Command::WriteLutRegister, buffer)
|
||||
|
|
@ -357,7 +357,7 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
impl<SPI, CS, BUSY, DC, RST> EPD2in13<SPI, CS, BUSY, DC, RST>
|
||||
impl<SPI, CS, BUSY, DC, RST> Epd2in13<SPI, CS, BUSY, DC, RST>
|
||||
where
|
||||
SPI: Write<u8>,
|
||||
CS: OutputPin,
|
||||
|
|
@ -391,7 +391,7 @@ where
|
|||
&mut self,
|
||||
spi: &mut SPI,
|
||||
delay: &mut DELAY,
|
||||
refresh: RefreshLUT,
|
||||
refresh: RefreshLut,
|
||||
) -> Result<(), SPI::Error> {
|
||||
if self.refresh != refresh {
|
||||
self.refresh = refresh;
|
||||
|
|
@ -425,7 +425,7 @@ where
|
|||
)
|
||||
}
|
||||
|
||||
fn set_vcom_register(&mut self, spi: &mut SPI, vcom: VCOM) -> Result<(), SPI::Error> {
|
||||
fn set_vcom_register(&mut self, spi: &mut SPI, vcom: Vcom) -> Result<(), SPI::Error> {
|
||||
self.cmd_with_data(spi, Command::WriteVcomRegister, &[vcom.0])
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ pub(crate) enum Command {
|
|||
/// This command reads the temperature sensed by the temperature sensor.
|
||||
///
|
||||
/// Doesn't work! Waveshare doesn't connect the read pin
|
||||
TemperatureSensorCommand = 0x40,
|
||||
TemperatureSensor = 0x40,
|
||||
/// This command selects Internal or External temperature sensor.
|
||||
TemperatureSensorCalibration = 0x41,
|
||||
/// Write External Temperature Sensor
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ use embedded_hal::{
|
|||
|
||||
use crate::interface::DisplayInterface;
|
||||
use crate::traits::{
|
||||
InternalWiAdditions, RefreshLUT, WaveshareDisplay, WaveshareThreeColorDisplay,
|
||||
InternalWiAdditions, RefreshLut, WaveshareDisplay, WaveshareThreeColorDisplay,
|
||||
};
|
||||
|
||||
// The Lookup Tables for the Display
|
||||
|
|
@ -34,8 +34,8 @@ mod graphics;
|
|||
#[cfg(feature = "graphics")]
|
||||
pub use self::graphics::Display2in7b;
|
||||
|
||||
/// EPD2in7b driver
|
||||
pub struct EPD2in7b<SPI, CS, BUSY, DC, RST> {
|
||||
/// Epd2in7b driver
|
||||
pub struct Epd2in7b<SPI, CS, BUSY, DC, RST> {
|
||||
/// Connection Interface
|
||||
interface: DisplayInterface<SPI, CS, BUSY, DC, RST>,
|
||||
/// Background Color
|
||||
|
|
@ -43,7 +43,7 @@ pub struct EPD2in7b<SPI, CS, BUSY, DC, RST> {
|
|||
}
|
||||
|
||||
impl<SPI, CS, BUSY, DC, RST> InternalWiAdditions<SPI, CS, BUSY, DC, RST>
|
||||
for EPD2in7b<SPI, CS, BUSY, DC, RST>
|
||||
for Epd2in7b<SPI, CS, BUSY, DC, RST>
|
||||
where
|
||||
SPI: Write<u8>,
|
||||
CS: OutputPin,
|
||||
|
|
@ -112,7 +112,7 @@ where
|
|||
}
|
||||
|
||||
impl<SPI, CS, BUSY, DC, RST> WaveshareDisplay<SPI, CS, BUSY, DC, RST>
|
||||
for EPD2in7b<SPI, CS, BUSY, DC, RST>
|
||||
for Epd2in7b<SPI, CS, BUSY, DC, RST>
|
||||
where
|
||||
SPI: Write<u8>,
|
||||
CS: OutputPin,
|
||||
|
|
@ -132,7 +132,7 @@ where
|
|||
let interface = DisplayInterface::new(cs, busy, dc, rst);
|
||||
let color = DEFAULT_BACKGROUND_COLOR;
|
||||
|
||||
let mut epd = EPD2in7b { interface, color };
|
||||
let mut epd = Epd2in7b { interface, color };
|
||||
|
||||
epd.init(spi, delay)?;
|
||||
|
||||
|
|
@ -247,7 +247,7 @@ where
|
|||
fn set_lut(
|
||||
&mut self,
|
||||
spi: &mut SPI,
|
||||
_refresh_rate: Option<RefreshLUT>,
|
||||
_refresh_rate: Option<RefreshLut>,
|
||||
) -> Result<(), SPI::Error> {
|
||||
self.wait_until_idle();
|
||||
self.cmd_with_data(spi, Command::LutForVcom, &LUT_VCOM_DC)?;
|
||||
|
|
@ -264,7 +264,7 @@ where
|
|||
}
|
||||
|
||||
impl<SPI, CS, BUSY, DC, RST> WaveshareThreeColorDisplay<SPI, CS, BUSY, DC, RST>
|
||||
for EPD2in7b<SPI, CS, BUSY, DC, RST>
|
||||
for Epd2in7b<SPI, CS, BUSY, DC, RST>
|
||||
where
|
||||
SPI: Write<u8>,
|
||||
CS: OutputPin,
|
||||
|
|
@ -316,7 +316,7 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
impl<SPI, CS, BUSY, DC, RST> EPD2in7b<SPI, CS, BUSY, DC, RST>
|
||||
impl<SPI, CS, BUSY, DC, RST> Epd2in7b<SPI, CS, BUSY, DC, RST>
|
||||
where
|
||||
SPI: Write<u8>,
|
||||
CS: OutputPin,
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
//!# let mut delay = delay::MockNoop::new();
|
||||
//!
|
||||
//!// Setup EPD
|
||||
//!let mut epd = EPD2in9::new(&mut spi, cs_pin, busy_in, dc, rst, &mut delay)?;
|
||||
//!let mut epd = Epd2in9::new(&mut spi, cs_pin, busy_in, dc, rst, &mut delay)?;
|
||||
//!
|
||||
//!// Use display graphics from embedded-graphics
|
||||
//!let mut display = Display2in9::default();
|
||||
|
|
@ -70,18 +70,18 @@ mod graphics;
|
|||
#[cfg(feature = "graphics")]
|
||||
pub use crate::epd2in9::graphics::Display2in9;
|
||||
|
||||
/// EPD2in9 driver
|
||||
/// Epd2in9 driver
|
||||
///
|
||||
pub struct EPD2in9<SPI, CS, BUSY, DC, RST> {
|
||||
pub struct Epd2in9<SPI, CS, BUSY, DC, RST> {
|
||||
/// SPI
|
||||
interface: DisplayInterface<SPI, CS, BUSY, DC, RST>,
|
||||
/// Color
|
||||
background_color: Color,
|
||||
/// Refresh LUT
|
||||
refresh: RefreshLUT,
|
||||
refresh: RefreshLut,
|
||||
}
|
||||
|
||||
impl<SPI, CS, BUSY, DC, RST> EPD2in9<SPI, CS, BUSY, DC, RST>
|
||||
impl<SPI, CS, BUSY, DC, RST> Epd2in9<SPI, CS, BUSY, DC, RST>
|
||||
where
|
||||
SPI: Write<u8>,
|
||||
CS: OutputPin,
|
||||
|
|
@ -136,7 +136,7 @@ where
|
|||
}
|
||||
|
||||
impl<SPI, CS, BUSY, DC, RST> WaveshareDisplay<SPI, CS, BUSY, DC, RST>
|
||||
for EPD2in9<SPI, CS, BUSY, DC, RST>
|
||||
for Epd2in9<SPI, CS, BUSY, DC, RST>
|
||||
where
|
||||
SPI: Write<u8>,
|
||||
CS: OutputPin,
|
||||
|
|
@ -163,10 +163,10 @@ where
|
|||
) -> Result<Self, SPI::Error> {
|
||||
let interface = DisplayInterface::new(cs, busy, dc, rst);
|
||||
|
||||
let mut epd = EPD2in9 {
|
||||
let mut epd = Epd2in9 {
|
||||
interface,
|
||||
background_color: DEFAULT_BACKGROUND_COLOR,
|
||||
refresh: RefreshLUT::FULL,
|
||||
refresh: RefreshLut::Full,
|
||||
};
|
||||
|
||||
epd.init(spi, delay)?;
|
||||
|
|
@ -231,7 +231,7 @@ where
|
|||
self.interface.cmd(spi, Command::MasterActivation)?;
|
||||
// MASTER Activation should not be interupted to avoid currption of panel images
|
||||
// therefore a terminate command is send
|
||||
self.interface.cmd(spi, Command::NOP)?;
|
||||
self.interface.cmd(spi, Command::Nop)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
@ -265,14 +265,14 @@ where
|
|||
fn set_lut(
|
||||
&mut self,
|
||||
spi: &mut SPI,
|
||||
refresh_rate: Option<RefreshLUT>,
|
||||
refresh_rate: Option<RefreshLut>,
|
||||
) -> Result<(), SPI::Error> {
|
||||
if let Some(refresh_lut) = refresh_rate {
|
||||
self.refresh = refresh_lut;
|
||||
}
|
||||
match self.refresh {
|
||||
RefreshLUT::FULL => self.set_lut_helper(spi, &LUT_FULL_UPDATE),
|
||||
RefreshLUT::QUICK => self.set_lut_helper(spi, &LUT_PARTIAL_UPDATE),
|
||||
RefreshLut::Full => self.set_lut_helper(spi, &LUT_FULL_UPDATE),
|
||||
RefreshLut::Quick => self.set_lut_helper(spi, &LUT_PARTIAL_UPDATE),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -281,7 +281,7 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
impl<SPI, CS, BUSY, DC, RST> EPD2in9<SPI, CS, BUSY, DC, RST>
|
||||
impl<SPI, CS, BUSY, DC, RST> Epd2in9<SPI, CS, BUSY, DC, RST>
|
||||
where
|
||||
SPI: Write<u8>,
|
||||
CS: OutputPin,
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ pub(crate) enum Command {
|
|||
LutBlackToBlack = 0x24,
|
||||
|
||||
PllControl = 0x30,
|
||||
TemperatureSensorCommand = 0x40,
|
||||
TemperatureSensor = 0x40,
|
||||
TemperatureSensorSelection = 0x41,
|
||||
VcomAndDataIntervalSetting = 0x50,
|
||||
ResolutionSetting = 0x61,
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
//!# let mut delay = delay::MockNoop::new();
|
||||
//!
|
||||
//!// Setup EPD
|
||||
//!let mut epd = EPD2in9bc::new(&mut spi, cs_pin, busy_in, dc, rst, &mut delay)?;
|
||||
//!let mut epd = Epd2in9bc::new(&mut spi, cs_pin, busy_in, dc, rst, &mut delay)?;
|
||||
//!
|
||||
//!// Use display graphics from embedded-graphics
|
||||
//!// This display is for the black/white pixels
|
||||
|
|
@ -60,7 +60,7 @@ use embedded_hal::{
|
|||
|
||||
use crate::interface::DisplayInterface;
|
||||
use crate::traits::{
|
||||
InternalWiAdditions, RefreshLUT, WaveshareDisplay, WaveshareThreeColorDisplay,
|
||||
InternalWiAdditions, RefreshLut, WaveshareDisplay, WaveshareThreeColorDisplay,
|
||||
};
|
||||
|
||||
/// Width of epd2in9bc in pixels
|
||||
|
|
@ -89,14 +89,14 @@ mod graphics;
|
|||
#[cfg(feature = "graphics")]
|
||||
pub use self::graphics::Display2in9bc;
|
||||
|
||||
/// EPD2in9bc driver
|
||||
pub struct EPD2in9bc<SPI, CS, BUSY, DC, RST> {
|
||||
/// Epd2in9bc driver
|
||||
pub struct Epd2in9bc<SPI, CS, BUSY, DC, RST> {
|
||||
interface: DisplayInterface<SPI, CS, BUSY, DC, RST>,
|
||||
color: Color,
|
||||
}
|
||||
|
||||
impl<SPI, CS, BUSY, DC, RST> InternalWiAdditions<SPI, CS, BUSY, DC, RST>
|
||||
for EPD2in9bc<SPI, CS, BUSY, DC, RST>
|
||||
for Epd2in9bc<SPI, CS, BUSY, DC, RST>
|
||||
where
|
||||
SPI: Write<u8>,
|
||||
CS: OutputPin,
|
||||
|
|
@ -143,7 +143,7 @@ where
|
|||
}
|
||||
|
||||
impl<SPI, CS, BUSY, DC, RST> WaveshareThreeColorDisplay<SPI, CS, BUSY, DC, RST>
|
||||
for EPD2in9bc<SPI, CS, BUSY, DC, RST>
|
||||
for Epd2in9bc<SPI, CS, BUSY, DC, RST>
|
||||
where
|
||||
SPI: Write<u8>,
|
||||
CS: OutputPin,
|
||||
|
|
@ -187,7 +187,7 @@ where
|
|||
}
|
||||
|
||||
impl<SPI, CS, BUSY, DC, RST> WaveshareDisplay<SPI, CS, BUSY, DC, RST>
|
||||
for EPD2in9bc<SPI, CS, BUSY, DC, RST>
|
||||
for Epd2in9bc<SPI, CS, BUSY, DC, RST>
|
||||
where
|
||||
SPI: Write<u8>,
|
||||
CS: OutputPin,
|
||||
|
|
@ -207,7 +207,7 @@ where
|
|||
let interface = DisplayInterface::new(cs, busy, dc, rst);
|
||||
let color = DEFAULT_BACKGROUND_COLOR;
|
||||
|
||||
let mut epd = EPD2in9bc { interface, color };
|
||||
let mut epd = Epd2in9bc { interface, color };
|
||||
|
||||
epd.init(spi, delay)?;
|
||||
|
||||
|
|
@ -317,7 +317,7 @@ where
|
|||
fn set_lut(
|
||||
&mut self,
|
||||
_spi: &mut SPI,
|
||||
_refresh_rate: Option<RefreshLUT>,
|
||||
_refresh_rate: Option<RefreshLut>,
|
||||
) -> Result<(), SPI::Error> {
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -327,7 +327,7 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
impl<SPI, CS, BUSY, DC, RST> EPD2in9bc<SPI, CS, BUSY, DC, RST>
|
||||
impl<SPI, CS, BUSY, DC, RST> Epd2in9bc<SPI, CS, BUSY, DC, RST>
|
||||
where
|
||||
SPI: Write<u8>,
|
||||
CS: OutputPin,
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ pub(crate) enum Command {
|
|||
/// This command reads the temperature sensed by the temperature sensor.
|
||||
///
|
||||
/// Doesn't work! Waveshare doesn't connect the read pin
|
||||
TemperatureSensorCommand = 0x40,
|
||||
TemperatureSensor = 0x40,
|
||||
/// Selects the Internal or External temperature sensor and offset
|
||||
TemperatureSensorSelection = 0x41,
|
||||
/// Write External Temperature Sensor
|
||||
|
|
@ -114,7 +114,7 @@ pub(crate) enum Command {
|
|||
/// The LUT_REV / Chip Revision is read from OTP address = 0x001.
|
||||
///
|
||||
/// Doesn't work! Waveshare doesn't connect the read pin
|
||||
REVISION = 0x70,
|
||||
Revision = 0x70,
|
||||
/// Read Flags. This command reads the IC status
|
||||
/// PTL, I2C_ERR, I2C_BUSY, DATA, PON, POF, BUSY
|
||||
///
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
//!# let mut delay = delay::MockNoop::new();
|
||||
//!
|
||||
//!// Setup EPD
|
||||
//!let mut epd = EPD4in2::new(&mut spi, cs_pin, busy_in, dc, rst, &mut delay)?;
|
||||
//!let mut epd = Epd4in2::new(&mut spi, cs_pin, busy_in, dc, rst, &mut delay)?;
|
||||
//!
|
||||
//!// Use display graphics from embedded-graphics
|
||||
//!let mut display = Display4in2::default();
|
||||
|
|
@ -55,7 +55,7 @@ use embedded_hal::{
|
|||
};
|
||||
|
||||
use crate::interface::DisplayInterface;
|
||||
use crate::traits::{InternalWiAdditions, QuickRefresh, RefreshLUT, WaveshareDisplay};
|
||||
use crate::traits::{InternalWiAdditions, QuickRefresh, RefreshLut, WaveshareDisplay};
|
||||
|
||||
//The Lookup Tables for the Display
|
||||
mod constants;
|
||||
|
|
@ -79,19 +79,19 @@ mod graphics;
|
|||
#[cfg(feature = "graphics")]
|
||||
pub use self::graphics::Display4in2;
|
||||
|
||||
/// EPD4in2 driver
|
||||
/// Epd4in2 driver
|
||||
///
|
||||
pub struct EPD4in2<SPI, CS, BUSY, DC, RST> {
|
||||
pub struct Epd4in2<SPI, CS, BUSY, DC, RST> {
|
||||
/// Connection Interface
|
||||
interface: DisplayInterface<SPI, CS, BUSY, DC, RST>,
|
||||
/// Background Color
|
||||
color: Color,
|
||||
/// Refresh LUT
|
||||
refresh: RefreshLUT,
|
||||
refresh: RefreshLut,
|
||||
}
|
||||
|
||||
impl<SPI, CS, BUSY, DC, RST> InternalWiAdditions<SPI, CS, BUSY, DC, RST>
|
||||
for EPD4in2<SPI, CS, BUSY, DC, RST>
|
||||
for Epd4in2<SPI, CS, BUSY, DC, RST>
|
||||
where
|
||||
SPI: Write<u8>,
|
||||
CS: OutputPin,
|
||||
|
|
@ -149,7 +149,7 @@ where
|
|||
}
|
||||
|
||||
impl<SPI, CS, BUSY, DC, RST> WaveshareDisplay<SPI, CS, BUSY, DC, RST>
|
||||
for EPD4in2<SPI, CS, BUSY, DC, RST>
|
||||
for Epd4in2<SPI, CS, BUSY, DC, RST>
|
||||
where
|
||||
SPI: Write<u8>,
|
||||
CS: OutputPin,
|
||||
|
|
@ -169,10 +169,10 @@ where
|
|||
let interface = DisplayInterface::new(cs, busy, dc, rst);
|
||||
let color = DEFAULT_BACKGROUND_COLOR;
|
||||
|
||||
let mut epd = EPD4in2 {
|
||||
let mut epd = Epd4in2 {
|
||||
interface,
|
||||
color,
|
||||
refresh: RefreshLUT::FULL,
|
||||
refresh: RefreshLut::Full,
|
||||
};
|
||||
|
||||
epd.init(spi, delay)?;
|
||||
|
|
@ -313,16 +313,16 @@ where
|
|||
fn set_lut(
|
||||
&mut self,
|
||||
spi: &mut SPI,
|
||||
refresh_rate: Option<RefreshLUT>,
|
||||
refresh_rate: Option<RefreshLut>,
|
||||
) -> Result<(), SPI::Error> {
|
||||
if let Some(refresh_lut) = refresh_rate {
|
||||
self.refresh = refresh_lut;
|
||||
}
|
||||
match self.refresh {
|
||||
RefreshLUT::FULL => {
|
||||
RefreshLut::Full => {
|
||||
self.set_lut_helper(spi, &LUT_VCOM0, &LUT_WW, &LUT_BW, &LUT_WB, &LUT_BB)
|
||||
}
|
||||
RefreshLUT::QUICK => self.set_lut_helper(
|
||||
RefreshLut::Quick => self.set_lut_helper(
|
||||
spi,
|
||||
&LUT_VCOM0_QUICK,
|
||||
&LUT_WW_QUICK,
|
||||
|
|
@ -338,7 +338,7 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
impl<SPI, CS, BUSY, DC, RST> EPD4in2<SPI, CS, BUSY, DC, RST>
|
||||
impl<SPI, CS, BUSY, DC, RST> Epd4in2<SPI, CS, BUSY, DC, RST>
|
||||
where
|
||||
SPI: Write<u8>,
|
||||
CS: OutputPin,
|
||||
|
|
@ -435,7 +435,7 @@ where
|
|||
}
|
||||
|
||||
impl<SPI, CS, BUSY, DC, RST> QuickRefresh<SPI, CS, BUSY, DC, RST>
|
||||
for EPD4in2<SPI, CS, BUSY, DC, RST>
|
||||
for Epd4in2<SPI, CS, BUSY, DC, RST>
|
||||
where
|
||||
SPI: Write<u8>,
|
||||
CS: OutputPin,
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ pub(crate) enum Command {
|
|||
DisplayRefresh = 0x12,
|
||||
|
||||
/// Image Process Command
|
||||
ImageProcessCommand = 0x13,
|
||||
ImageProcess = 0x13,
|
||||
|
||||
/// This command builds the VCOM Look-Up Table (LUTC).
|
||||
LutForVcom = 0x20,
|
||||
|
|
@ -91,7 +91,7 @@ pub(crate) enum Command {
|
|||
PllControl = 0x30,
|
||||
|
||||
/// This command reads the temperature sensed by the temperature sensor.
|
||||
TemperatureSensorCommand = 0x40,
|
||||
TemperatureSensor = 0x40,
|
||||
/// This command selects the Internal or External temperature sensor.
|
||||
TemperatureCalibration = 0x41,
|
||||
/// This command could write data to the external temperature sensor.
|
||||
|
|
@ -115,7 +115,7 @@ pub(crate) enum Command {
|
|||
//SpiFlashControl = 0x65,
|
||||
|
||||
/// The LUT_REV / Chip Revision is read from OTP address = 25001 and 25000.
|
||||
//REVISION = 0x70,
|
||||
//Revision = 0x70,
|
||||
/// This command reads the IC status.
|
||||
GetStatus = 0x71,
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ use embedded_hal::{
|
|||
|
||||
use crate::color::OctColor;
|
||||
use crate::interface::DisplayInterface;
|
||||
use crate::traits::{InternalWiAdditions, RefreshLUT, WaveshareDisplay};
|
||||
use crate::traits::{InternalWiAdditions, RefreshLut, WaveshareDisplay};
|
||||
|
||||
pub(crate) mod command;
|
||||
use self::command::Command;
|
||||
|
|
@ -31,9 +31,9 @@ pub const HEIGHT: u32 = 448;
|
|||
pub const DEFAULT_BACKGROUND_COLOR: OctColor = OctColor::White;
|
||||
const IS_BUSY_LOW: bool = true;
|
||||
|
||||
/// EPD5in65f driver
|
||||
/// Epd5in65f driver
|
||||
///
|
||||
pub struct EPD5in65f<SPI, CS, BUSY, DC, RST> {
|
||||
pub struct Epd5in65f<SPI, CS, BUSY, DC, RST> {
|
||||
/// Connection Interface
|
||||
interface: DisplayInterface<SPI, CS, BUSY, DC, RST>,
|
||||
/// Background Color
|
||||
|
|
@ -41,7 +41,7 @@ pub struct EPD5in65f<SPI, CS, BUSY, DC, RST> {
|
|||
}
|
||||
|
||||
impl<SPI, CS, BUSY, DC, RST> InternalWiAdditions<SPI, CS, BUSY, DC, RST>
|
||||
for EPD5in65f<SPI, CS, BUSY, DC, RST>
|
||||
for Epd5in65f<SPI, CS, BUSY, DC, RST>
|
||||
where
|
||||
SPI: Write<u8>,
|
||||
CS: OutputPin,
|
||||
|
|
@ -62,7 +62,7 @@ where
|
|||
self.cmd_with_data(spi, Command::PowerOffSequenceSetting, &[0x00])?;
|
||||
self.cmd_with_data(spi, Command::BoosterSoftStart, &[0xC7, 0xC7, 0x1D])?;
|
||||
self.cmd_with_data(spi, Command::PllControl, &[0x3C])?;
|
||||
self.cmd_with_data(spi, Command::TemperatureSensorCommand, &[0x00])?;
|
||||
self.cmd_with_data(spi, Command::TemperatureSensor, &[0x00])?;
|
||||
self.cmd_with_data(spi, Command::VcomAndDataIntervalSetting, &[0x37])?;
|
||||
self.cmd_with_data(spi, Command::TconSetting, &[0x22])?;
|
||||
self.send_resolution(spi)?;
|
||||
|
|
@ -77,7 +77,7 @@ where
|
|||
}
|
||||
|
||||
impl<SPI, CS, BUSY, DC, RST> WaveshareDisplay<SPI, CS, BUSY, DC, RST>
|
||||
for EPD5in65f<SPI, CS, BUSY, DC, RST>
|
||||
for Epd5in65f<SPI, CS, BUSY, DC, RST>
|
||||
where
|
||||
SPI: Write<u8>,
|
||||
CS: OutputPin,
|
||||
|
|
@ -97,7 +97,7 @@ where
|
|||
let interface = DisplayInterface::new(cs, busy, dc, rst);
|
||||
let color = DEFAULT_BACKGROUND_COLOR;
|
||||
|
||||
let mut epd = EPD5in65f { interface, color };
|
||||
let mut epd = Epd5in65f { interface, color };
|
||||
|
||||
epd.init(spi, delay)?;
|
||||
|
||||
|
|
@ -182,7 +182,7 @@ where
|
|||
fn set_lut(
|
||||
&mut self,
|
||||
_spi: &mut SPI,
|
||||
_refresh_rate: Option<RefreshLUT>,
|
||||
_refresh_rate: Option<RefreshLut>,
|
||||
) -> Result<(), SPI::Error> {
|
||||
unimplemented!();
|
||||
}
|
||||
|
|
@ -192,7 +192,7 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
impl<SPI, CS, BUSY, DC, RST> EPD5in65f<SPI, CS, BUSY, DC, RST>
|
||||
impl<SPI, CS, BUSY, DC, RST> Epd5in65f<SPI, CS, BUSY, DC, RST>
|
||||
where
|
||||
SPI: Write<u8>,
|
||||
CS: OutputPin,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
use crate::traits;
|
||||
|
||||
/// EPD7in5 commands
|
||||
/// Epd7in5 commands
|
||||
///
|
||||
/// Should rarely (never?) be needed directly.
|
||||
///
|
||||
|
|
@ -93,7 +93,7 @@ pub(crate) enum Command {
|
|||
PllControl = 0x30,
|
||||
|
||||
/// This command reads the temperature sensed by the temperature sensor.
|
||||
TemperatureSensorCommand = 0x40,
|
||||
TemperatureSensor = 0x40,
|
||||
/// This command selects the Internal or External temperature sensor.
|
||||
TemperatureCalibration = 0x41,
|
||||
/// This command could write data to the external temperature sensor.
|
||||
|
|
@ -117,7 +117,7 @@ pub(crate) enum Command {
|
|||
SpiFlashControl = 0x65,
|
||||
|
||||
/// The LUT_REV / Chip Revision is read from OTP address = 25001 and 25000.
|
||||
REVISION = 0x70,
|
||||
Revision = 0x70,
|
||||
/// This command reads the IC status.
|
||||
GetStatus = 0x71,
|
||||
|
||||
|
|
@ -128,7 +128,7 @@ pub(crate) enum Command {
|
|||
/// This command sets `VCOM_DC` value.
|
||||
VcmDcSetting = 0x82,
|
||||
|
||||
/// This is in all the Waveshare controllers for EPD7in5, but it's not documented
|
||||
/// This is in all the Waveshare controllers for Epd7in5, but it's not documented
|
||||
/// anywhere in the datasheet `¯\_(ツ)_/¯`
|
||||
FlashMode = 0xE5,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ use embedded_hal::{
|
|||
|
||||
use crate::color::Color;
|
||||
use crate::interface::DisplayInterface;
|
||||
use crate::traits::{InternalWiAdditions, RefreshLUT, WaveshareDisplay};
|
||||
use crate::traits::{InternalWiAdditions, RefreshLut, WaveshareDisplay};
|
||||
|
||||
pub(crate) mod command;
|
||||
use self::command::Command;
|
||||
|
|
@ -31,9 +31,9 @@ pub const HEIGHT: u32 = 384;
|
|||
pub const DEFAULT_BACKGROUND_COLOR: Color = Color::White;
|
||||
const IS_BUSY_LOW: bool = true;
|
||||
|
||||
/// EPD7in5 driver
|
||||
/// Epd7in5 driver
|
||||
///
|
||||
pub struct EPD7in5<SPI, CS, BUSY, DC, RST> {
|
||||
pub struct Epd7in5<SPI, CS, BUSY, DC, RST> {
|
||||
/// Connection Interface
|
||||
interface: DisplayInterface<SPI, CS, BUSY, DC, RST>,
|
||||
/// Background Color
|
||||
|
|
@ -41,7 +41,7 @@ pub struct EPD7in5<SPI, CS, BUSY, DC, RST> {
|
|||
}
|
||||
|
||||
impl<SPI, CS, BUSY, DC, RST> InternalWiAdditions<SPI, CS, BUSY, DC, RST>
|
||||
for EPD7in5<SPI, CS, BUSY, DC, RST>
|
||||
for Epd7in5<SPI, CS, BUSY, DC, RST>
|
||||
where
|
||||
SPI: Write<u8>,
|
||||
CS: OutputPin,
|
||||
|
|
@ -91,7 +91,7 @@ where
|
|||
// Set VCOM_DC to -1.5V
|
||||
self.cmd_with_data(spi, Command::VcmDcSetting, &[0x1E])?;
|
||||
|
||||
// This is in all the Waveshare controllers for EPD7in5
|
||||
// This is in all the Waveshare controllers for Epd7in5
|
||||
self.cmd_with_data(spi, Command::FlashMode, &[0x03])?;
|
||||
|
||||
self.wait_until_idle();
|
||||
|
|
@ -100,7 +100,7 @@ where
|
|||
}
|
||||
|
||||
impl<SPI, CS, BUSY, DC, RST> WaveshareDisplay<SPI, CS, BUSY, DC, RST>
|
||||
for EPD7in5<SPI, CS, BUSY, DC, RST>
|
||||
for Epd7in5<SPI, CS, BUSY, DC, RST>
|
||||
where
|
||||
SPI: Write<u8>,
|
||||
CS: OutputPin,
|
||||
|
|
@ -120,7 +120,7 @@ where
|
|||
let interface = DisplayInterface::new(cs, busy, dc, rst);
|
||||
let color = DEFAULT_BACKGROUND_COLOR;
|
||||
|
||||
let mut epd = EPD7in5 { interface, color };
|
||||
let mut epd = Epd7in5 { interface, color };
|
||||
|
||||
epd.init(spi, delay)?;
|
||||
|
||||
|
|
@ -214,7 +214,7 @@ where
|
|||
fn set_lut(
|
||||
&mut self,
|
||||
_spi: &mut SPI,
|
||||
_refresh_rate: Option<RefreshLUT>,
|
||||
_refresh_rate: Option<RefreshLut>,
|
||||
) -> Result<(), SPI::Error> {
|
||||
unimplemented!();
|
||||
}
|
||||
|
|
@ -224,7 +224,7 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
impl<SPI, CS, BUSY, DC, RST> EPD7in5<SPI, CS, BUSY, DC, RST>
|
||||
impl<SPI, CS, BUSY, DC, RST> Epd7in5<SPI, CS, BUSY, DC, RST>
|
||||
where
|
||||
SPI: Write<u8>,
|
||||
CS: OutputPin,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
use crate::traits;
|
||||
|
||||
/// EPD7in5 commands
|
||||
/// Epd7in5 commands
|
||||
///
|
||||
/// Should rarely (never?) be needed directly.
|
||||
///
|
||||
|
|
@ -94,7 +94,7 @@ pub(crate) enum Command {
|
|||
PllControl = 0x30,
|
||||
|
||||
/// This command reads the temperature sensed by the temperature sensor.
|
||||
TemperatureSensorCommand = 0x40,
|
||||
TemperatureSensor = 0x40,
|
||||
/// This command selects the Internal or External temperature sensor.
|
||||
TemperatureCalibration = 0x41,
|
||||
/// This command could write data to the external temperature sensor.
|
||||
|
|
@ -118,7 +118,7 @@ pub(crate) enum Command {
|
|||
SpiFlashControl = 0x65,
|
||||
|
||||
/// The LUT_REV / Chip Revision is read from OTP address = 25001 and 25000.
|
||||
REVISION = 0x70,
|
||||
Revision = 0x70,
|
||||
/// This command reads the IC status.
|
||||
GetStatus = 0x71,
|
||||
|
||||
|
|
@ -128,7 +128,7 @@ pub(crate) enum Command {
|
|||
ReadVcomValue = 0x81,
|
||||
/// This command sets `VCOM_DC` value.
|
||||
VcmDcSetting = 0x82,
|
||||
// /// This is in all the Waveshare controllers for EPD7in5, but it's not documented
|
||||
// /// This is in all the Waveshare controllers for Epd7in5, but it's not documented
|
||||
// /// anywhere in the datasheet `¯\_(ツ)_/¯`
|
||||
// FlashMode = 0xE5,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ use embedded_hal::{
|
|||
|
||||
use crate::color::Color;
|
||||
use crate::interface::DisplayInterface;
|
||||
use crate::traits::{InternalWiAdditions, RefreshLUT, WaveshareDisplay};
|
||||
use crate::traits::{InternalWiAdditions, RefreshLut, WaveshareDisplay};
|
||||
|
||||
pub(crate) mod command;
|
||||
use self::command::Command;
|
||||
|
|
@ -35,9 +35,9 @@ pub const HEIGHT: u32 = 480;
|
|||
pub const DEFAULT_BACKGROUND_COLOR: Color = Color::White;
|
||||
const IS_BUSY_LOW: bool = true;
|
||||
|
||||
/// EPD7in5 (V2) driver
|
||||
/// Epd7in5 (V2) driver
|
||||
///
|
||||
pub struct EPD7in5<SPI, CS, BUSY, DC, RST> {
|
||||
pub struct Epd7in5<SPI, CS, BUSY, DC, RST> {
|
||||
/// Connection Interface
|
||||
interface: DisplayInterface<SPI, CS, BUSY, DC, RST>,
|
||||
/// Background Color
|
||||
|
|
@ -45,7 +45,7 @@ pub struct EPD7in5<SPI, CS, BUSY, DC, RST> {
|
|||
}
|
||||
|
||||
impl<SPI, CS, BUSY, DC, RST> InternalWiAdditions<SPI, CS, BUSY, DC, RST>
|
||||
for EPD7in5<SPI, CS, BUSY, DC, RST>
|
||||
for Epd7in5<SPI, CS, BUSY, DC, RST>
|
||||
where
|
||||
SPI: Write<u8>,
|
||||
CS: OutputPin,
|
||||
|
|
@ -82,7 +82,7 @@ where
|
|||
}
|
||||
|
||||
impl<SPI, CS, BUSY, DC, RST> WaveshareDisplay<SPI, CS, BUSY, DC, RST>
|
||||
for EPD7in5<SPI, CS, BUSY, DC, RST>
|
||||
for Epd7in5<SPI, CS, BUSY, DC, RST>
|
||||
where
|
||||
SPI: Write<u8>,
|
||||
CS: OutputPin,
|
||||
|
|
@ -102,7 +102,7 @@ where
|
|||
let interface = DisplayInterface::new(cs, busy, dc, rst);
|
||||
let color = DEFAULT_BACKGROUND_COLOR;
|
||||
|
||||
let mut epd = EPD7in5 { interface, color };
|
||||
let mut epd = Epd7in5 { interface, color };
|
||||
|
||||
epd.init(spi, delay)?;
|
||||
|
||||
|
|
@ -188,7 +188,7 @@ where
|
|||
fn set_lut(
|
||||
&mut self,
|
||||
_spi: &mut SPI,
|
||||
_refresh_rate: Option<RefreshLUT>,
|
||||
_refresh_rate: Option<RefreshLut>,
|
||||
) -> Result<(), SPI::Error> {
|
||||
unimplemented!();
|
||||
}
|
||||
|
|
@ -198,7 +198,7 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
impl<SPI, CS, BUSY, DC, RST> EPD7in5<SPI, CS, BUSY, DC, RST>
|
||||
impl<SPI, CS, BUSY, DC, RST> Epd7in5<SPI, CS, BUSY, DC, RST>
|
||||
where
|
||||
SPI: Write<u8>,
|
||||
CS: OutputPin,
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ where
|
|||
|
||||
/// Basic function for sending an array of u8-values of data over spi
|
||||
///
|
||||
/// Enables direct interaction with the device with the help of [command()](EPD4in2::command())
|
||||
/// Enables direct interaction with the device with the help of [command()](Epd4in2::command())
|
||||
pub(crate) fn data(&mut self, spi: &mut SPI, data: &[u8]) -> Result<(), SPI::Error> {
|
||||
// high for data
|
||||
let _ = self.dc.set_high();
|
||||
|
|
@ -157,7 +157,7 @@ where
|
|||
|
||||
/// Resets the device.
|
||||
///
|
||||
/// Often used to awake the module from deep sleep. See [EPD4in2::sleep()](EPD4in2::sleep())
|
||||
/// Often used to awake the module from deep sleep. See [Epd4in2::sleep()](Epd4in2::sleep())
|
||||
///
|
||||
/// The timing of keeping the reset pin low seems to be important and different per device.
|
||||
/// Most displays seem to require keeping it low for 10ms, but the 7in5_v2 only seems to reset
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
//!# let mut delay = delay::MockNoop::new();
|
||||
//!
|
||||
//!// Setup EPD
|
||||
//!let mut epd = EPD1in54::new(&mut spi, cs_pin, busy_in, dc, rst, &mut delay)?;
|
||||
//!let mut epd = Epd1in54::new(&mut spi, cs_pin, busy_in, dc, rst, &mut delay)?;
|
||||
//!
|
||||
//!// Use display graphics from embedded-graphics
|
||||
//!let mut display = Display1in54::default();
|
||||
|
|
@ -90,7 +90,7 @@ pub(crate) mod type_a;
|
|||
pub mod prelude {
|
||||
pub use crate::color::{Color, OctColor, TriColor};
|
||||
pub use crate::traits::{
|
||||
QuickRefresh, RefreshLUT, WaveshareDisplay, WaveshareThreeColorDisplay,
|
||||
QuickRefresh, RefreshLut, WaveshareDisplay, WaveshareThreeColorDisplay,
|
||||
};
|
||||
|
||||
pub use crate::SPI_MODE;
|
||||
|
|
|
|||
|
|
@ -12,17 +12,17 @@ pub(crate) trait Command {
|
|||
|
||||
/// Seperates the different LUT for the Display Refresh process
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Copy)]
|
||||
pub enum RefreshLUT {
|
||||
pub enum RefreshLut {
|
||||
/// The "normal" full Lookuptable for the Refresh-Sequence
|
||||
FULL,
|
||||
Full,
|
||||
/// The quick LUT where not the full refresh sequence is followed.
|
||||
/// This might lead to some
|
||||
QUICK,
|
||||
Quick,
|
||||
}
|
||||
|
||||
impl Default for RefreshLUT {
|
||||
impl Default for RefreshLut {
|
||||
fn default() -> Self {
|
||||
RefreshLUT::FULL
|
||||
RefreshLut::Full
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -108,7 +108,7 @@ where
|
|||
///# let mut delay = delay::MockNoop::new();
|
||||
///
|
||||
///// Setup EPD
|
||||
///let mut epd = EPD4in2::new(&mut spi, cs_pin, busy_in, dc, rst, &mut delay)?;
|
||||
///let mut epd = Epd4in2::new(&mut spi, cs_pin, busy_in, dc, rst, &mut delay)?;
|
||||
///
|
||||
///// Use display graphics from embedded-graphics
|
||||
///let mut display = Display4in2::default();
|
||||
|
|
@ -219,7 +219,7 @@ where
|
|||
fn set_lut(
|
||||
&mut self,
|
||||
spi: &mut SPI,
|
||||
refresh_rate: Option<RefreshLUT>,
|
||||
refresh_rate: Option<RefreshLut>,
|
||||
) -> Result<(), SPI::Error>;
|
||||
|
||||
/// Checks if the display is busy transmitting data
|
||||
|
|
@ -258,7 +258,7 @@ where
|
|||
///# let mut delay = delay::MockNoop::new();
|
||||
///#
|
||||
///# // Setup EPD
|
||||
///# let mut epd = EPD4in2::new(&mut spi, cs_pin, busy_in, dc, rst, &mut delay)?;
|
||||
///# let mut epd = Epd4in2::new(&mut spi, cs_pin, busy_in, dc, rst, &mut delay)?;
|
||||
///let (x, y, frame_width, frame_height) = (20, 40, 80,80);
|
||||
///
|
||||
///let mut buffer = [DEFAULT_BACKGROUND_COLOR.get_byte_value(); 80 / 8 * 80];
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
use crate::traits;
|
||||
|
||||
/// EPD1in54 and EPD2IN9 commands
|
||||
/// Epd1in54 and EPD2IN9 commands
|
||||
///
|
||||
/// Should rarely (never?) be needed directly.
|
||||
///
|
||||
|
|
@ -67,7 +67,7 @@ pub(crate) enum Command {
|
|||
|
||||
SetRamYAddressCounter = 0x4F,
|
||||
|
||||
NOP = 0xFF,
|
||||
Nop = 0xFF,
|
||||
}
|
||||
|
||||
impl traits::Command for Command {
|
||||
|
|
@ -88,6 +88,6 @@ mod tests {
|
|||
|
||||
assert_eq!(Command::SetRamXAddressCounter.address(), 0x4E);
|
||||
|
||||
assert_eq!(Command::NOP.address(), 0xFF);
|
||||
assert_eq!(Command::Nop.address(), 0xFF);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue