Added testcases for default size and color of the various displays
parent
806d9a1e2d
commit
80090d8df2
|
|
@ -1,5 +1,5 @@
|
||||||
/// Only for the B/W Displays atm
|
/// Only for the B/W Displays atm
|
||||||
#[derive(Clone, Copy)]
|
#[derive(Clone, Copy, PartialEq, Debug)]
|
||||||
pub enum Color {
|
pub enum Color {
|
||||||
Black,
|
Black,
|
||||||
White,
|
White,
|
||||||
|
|
|
||||||
|
|
@ -284,3 +284,15 @@ where
|
||||||
self.interface.command_with_data(Command::WRITE_LUT_REGISTER, buffer)
|
self.interface.command_with_data(Command::WRITE_LUT_REGISTER, buffer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn epd_size() {
|
||||||
|
assert_eq!(WIDTH, 200);
|
||||||
|
assert_eq!(HEIGHT, 200);
|
||||||
|
assert_eq!(DEFAULT_BACKGROUND_COLOR, Color::White);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -286,3 +286,16 @@ where
|
||||||
self.interface.command_with_data(Command::WRITE_LUT_REGISTER, buffer)
|
self.interface.command_with_data(Command::WRITE_LUT_REGISTER, buffer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn epd_size() {
|
||||||
|
assert_eq!(WIDTH, 128);
|
||||||
|
assert_eq!(HEIGHT, 296);
|
||||||
|
assert_eq!(DEFAULT_BACKGROUND_COLOR, Color::White);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
|
use color::Color;
|
||||||
|
|
||||||
pub(crate) const WIDTH: u16 = 400;
|
pub(crate) const WIDTH: u16 = 400;
|
||||||
pub(crate) const HEIGHT: u16 = 300;
|
pub(crate) const HEIGHT: u16 = 300;
|
||||||
|
pub(crate) const DEFAULT_BACKGROUND_COLOR: Color = Color::White;
|
||||||
|
|
||||||
pub(crate) const LUT_VCOM0: [u8; 44] = [
|
pub(crate) const LUT_VCOM0: [u8; 44] = [
|
||||||
0x00, 0x17, 0x00, 0x00, 0x00, 0x02,
|
0x00, 0x17, 0x00, 0x00, 0x00, 0x02,
|
||||||
|
|
|
||||||
|
|
@ -161,7 +161,7 @@ where
|
||||||
/// ```
|
/// ```
|
||||||
fn new(spi: SPI, cs: CS, busy: BUSY, dc: DC, rst: RST, delay: Delay) -> Result<Self, ERR> {
|
fn new(spi: SPI, cs: CS, busy: BUSY, dc: DC, rst: RST, delay: Delay) -> Result<Self, ERR> {
|
||||||
let interface = ConnectionInterface::new(spi, cs, busy, dc, rst, delay);
|
let interface = ConnectionInterface::new(spi, cs, busy, dc, rst, delay);
|
||||||
let color = Color::White;
|
let color = DEFAULT_BACKGROUND_COLOR;
|
||||||
|
|
||||||
let mut epd = EPD4in2 {
|
let mut epd = EPD4in2 {
|
||||||
interface,
|
interface,
|
||||||
|
|
@ -393,3 +393,16 @@ where
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn epd_size() {
|
||||||
|
assert_eq!(WIDTH, 400);
|
||||||
|
assert_eq!(HEIGHT, 300);
|
||||||
|
assert_eq!(DEFAULT_BACKGROUND_COLOR, Color::White);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue