mirror of
https://github.com/Anshorei/epd-waveshare.git
synced 2026-10-03 22:06:43 +00:00
Added testcases for default size and color of the various displays
This commit is contained in:
+1
-1
@@ -1,5 +1,5 @@
|
||||
/// Only for the B/W Displays atm
|
||||
#[derive(Clone, Copy)]
|
||||
#[derive(Clone, Copy, PartialEq, Debug)]
|
||||
pub enum Color {
|
||||
Black,
|
||||
White,
|
||||
|
||||
@@ -284,3 +284,15 @@ where
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#[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 HEIGHT: u16 = 300;
|
||||
pub(crate) const DEFAULT_BACKGROUND_COLOR: Color = Color::White;
|
||||
|
||||
pub(crate) const LUT_VCOM0: [u8; 44] = [
|
||||
0x00, 0x17, 0x00, 0x00, 0x00, 0x02,
|
||||
|
||||
+14
-1
@@ -161,7 +161,7 @@ where
|
||||
/// ```
|
||||
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 color = Color::White;
|
||||
let color = DEFAULT_BACKGROUND_COLOR;
|
||||
|
||||
let mut epd = EPD4in2 {
|
||||
interface,
|
||||
@@ -393,3 +393,16 @@ where
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user