Add rustfmt::skip to constants and graphics::rotation

digi-v2-tests
Chris 5 years ago
parent b505440c09
commit 2796d875f5

@ -4,6 +4,7 @@ pub const WIDTH: u32 = 400;
pub const HEIGHT: u32 = 300;
pub const DEFAULT_BACKGROUND_COLOR: Color = Color::White;
#[rustfmt::skip]
pub(crate) const LUT_VCOM0: [u8; 44] = [
0x00, 0x17, 0x00, 0x00, 0x00, 0x02,
0x00, 0x17, 0x17, 0x00, 0x00, 0x02,
@ -14,6 +15,7 @@ pub(crate) const LUT_VCOM0: [u8; 44] = [
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
];
#[rustfmt::skip]
pub(crate) const LUT_VCOM0_QUICK: [u8; 44] = [
0x00, 0x0E, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -24,7 +26,7 @@ pub(crate) const LUT_VCOM0_QUICK: [u8; 44] = [
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
];
#[rustfmt::skip]
pub(crate) const LUT_WW: [u8; 42] =[
0x40, 0x17, 0x00, 0x00, 0x00, 0x02,
0x90, 0x17, 0x17, 0x00, 0x00, 0x02,
@ -35,7 +37,7 @@ pub(crate) const LUT_WW: [u8; 42] =[
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
];
#[rustfmt::skip]
pub(crate) const LUT_WW_QUICK: [u8; 42] =[
0xA0, 0x0E, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -46,7 +48,7 @@ pub(crate) const LUT_WW_QUICK: [u8; 42] =[
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
];
#[rustfmt::skip]
pub(crate) const LUT_BW: [u8; 42] =[
0x40, 0x17, 0x00, 0x00, 0x00, 0x02,
0x90, 0x17, 0x17, 0x00, 0x00, 0x02,
@ -57,7 +59,7 @@ pub(crate) const LUT_BW: [u8; 42] =[
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
];
#[rustfmt::skip]
pub(crate) const LUT_BW_QUICK: [u8; 42] =[
0xA0, 0x0E, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -68,7 +70,7 @@ pub(crate) const LUT_BW_QUICK: [u8; 42] =[
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
];
#[rustfmt::skip]
pub(crate) const LUT_BB: [u8; 42] =[
0x80, 0x17, 0x00, 0x00, 0x00, 0x02,
0x90, 0x17, 0x17, 0x00, 0x00, 0x02,
@ -79,7 +81,7 @@ pub(crate) const LUT_BB: [u8; 42] =[
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
];
#[rustfmt::skip]
pub(crate) const LUT_BB_QUICK: [u8; 42] =[
0x50, 0x0E, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -90,7 +92,7 @@ pub(crate) const LUT_BB_QUICK: [u8; 42] =[
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
];
#[rustfmt::skip]
pub(crate) const LUT_WB: [u8; 42] =[
0x80, 0x17, 0x00, 0x00, 0x00, 0x02,
0x90, 0x17, 0x17, 0x00, 0x00, 0x02,
@ -101,7 +103,7 @@ pub(crate) const LUT_WB: [u8; 42] =[
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
];
#[rustfmt::skip]
pub(crate) const LUT_WB_QUICK: [u8; 42] =[
0x50, 0x0E, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

@ -3,7 +3,7 @@
use color::Color;
use embedded_graphics::prelude::*;
/// Displayrotation
/// Displayrotation
#[derive(Clone, Copy)]
pub enum DisplayRotation {
/// No rotation
@ -82,7 +82,7 @@ impl<'a> Drawing<Color> for Display<'a> {
Color::White => {
self.buffer[index] |= bit;
}
}
}
}
}
}
@ -97,12 +97,14 @@ fn outside_display(x: u32, y: u32, width: u32, height: u32, rotation: DisplayRot
DisplayRotation::Rotate90 | DisplayRotation::Rotate270 => {
if y >= width || x >= height {
return true;
}
}
}
}
false
}
#[rustfmt::skip]
//returns index position in the u8-slice and the bit-position inside that u8
fn rotation(x: u32, y: u32, width: u32, height: u32, rotation: DisplayRotation) -> (u32, u8) {
match rotation {
DisplayRotation::Rotate0 => (
@ -147,7 +149,7 @@ mod tests {
for &byte in display.buffer.iter() {
assert_eq!(byte, Color::White.get_byte_value());
}
}
}
#[test]
@ -181,7 +183,7 @@ mod tests {
use epd2in9::DEFAULT_BACKGROUND_COLOR;
let width = 128;
let height = 296;
let mut buffer = [DEFAULT_BACKGROUND_COLOR.get_byte_value(); 128 / 8 * 296];
let mut display = Display::new(width, height, &mut buffer);
@ -190,7 +192,7 @@ mod tests {
.with_stroke(Some(Color::Black))
.into_iter(),
);
let buffer = display.buffer();
assert_eq!(buffer[0], Color::Black.get_byte_value());
@ -205,7 +207,7 @@ mod tests {
use epd2in9::DEFAULT_BACKGROUND_COLOR;
let width = 128;
let height = 296;
let mut buffer = [DEFAULT_BACKGROUND_COLOR.get_byte_value(); 128 / 8 * 296];
let mut display = Display::new(width, height, &mut buffer);
@ -216,7 +218,7 @@ mod tests {
.with_stroke(Some(Color::Black))
.into_iter(),
);
let buffer = display.buffer();
extern crate std;

@ -1,4 +1,5 @@
// Original Waveforms from Waveshare
#[rustfmt::skip]
pub(crate) const LUT_FULL_UPDATE: [u8; 30] =[
0x02, 0x02, 0x01, 0x11, 0x12, 0x12, 0x22, 0x22,
0x66, 0x69, 0x69, 0x59, 0x58, 0x99, 0x99, 0x88,
@ -6,6 +7,7 @@ pub(crate) const LUT_FULL_UPDATE: [u8; 30] =[
0x35, 0x51, 0x51, 0x19, 0x01, 0x00
];
#[rustfmt::skip]
pub(crate) const LUT_PARTIAL_UPDATE: [u8; 30] =[
0x10, 0x18, 0x18, 0x08, 0x18, 0x18, 0x08, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

Loading…
Cancel
Save