Fix clippy lints
parent
30b0ee19f3
commit
a7d0f13d13
|
|
@ -14,7 +14,7 @@ pub enum Color {
|
||||||
|
|
||||||
impl Color {
|
impl Color {
|
||||||
/// Get the color encoding of the color for one bit
|
/// Get the color encoding of the color for one bit
|
||||||
pub fn get_bit_value(&self) -> u8 {
|
pub fn get_bit_value(self) -> u8 {
|
||||||
match self {
|
match self {
|
||||||
Color::White => 1u8,
|
Color::White => 1u8,
|
||||||
Color::Black => 0u8,
|
Color::Black => 0u8,
|
||||||
|
|
@ -22,7 +22,7 @@ impl Color {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Gets a full byte of black or white pixels
|
/// Gets a full byte of black or white pixels
|
||||||
pub fn get_byte_value(&self) -> u8 {
|
pub fn get_byte_value(self) -> u8 {
|
||||||
match self {
|
match self {
|
||||||
Color::White => 0xff,
|
Color::White => 0xff,
|
||||||
Color::Black => 0x00,
|
Color::Black => 0x00,
|
||||||
|
|
@ -41,7 +41,7 @@ impl Color {
|
||||||
/// Returns the inverse of the given color.
|
/// Returns the inverse of the given color.
|
||||||
///
|
///
|
||||||
/// Black returns White and White returns Black
|
/// Black returns White and White returns Black
|
||||||
pub fn inverse(&self) -> Color {
|
pub fn inverse(self) -> Color {
|
||||||
match self {
|
match self {
|
||||||
Color::White => Color::Black,
|
Color::White => Color::Black,
|
||||||
Color::Black => Color::White,
|
Color::Black => Color::White,
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ pub const WIDTH: u32 = 400;
|
||||||
pub const HEIGHT: u32 = 300;
|
pub const HEIGHT: u32 = 300;
|
||||||
pub const DEFAULT_BACKGROUND_COLOR: Color = Color::White;
|
pub 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,
|
||||||
0x00, 0x17, 0x17, 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,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
#[cfg(feature = "epd4in2_fast_update")]
|
#[cfg(feature = "epd4in2_fast_update")]
|
||||||
pub(crate) const LUT_VCOM0_QUICK: [u8; 44] = [
|
pub(crate) const LUT_VCOM0_QUICK: [u8; 44] = [
|
||||||
0x00, 0x0E, 0x00, 0x00, 0x00, 0x01,
|
0x00, 0x0E, 0x00, 0x00, 0x00, 0x01,
|
||||||
|
|
@ -36,6 +38,7 @@ pub(crate) const LUT_WW: [u8; 42] =[
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
#[cfg(feature = "epd4in2_fast_update")]
|
#[cfg(feature = "epd4in2_fast_update")]
|
||||||
pub(crate) const LUT_WW_QUICK: [u8; 42] =[
|
pub(crate) const LUT_WW_QUICK: [u8; 42] =[
|
||||||
0xA0, 0x0E, 0x00, 0x00, 0x00, 0x01,
|
0xA0, 0x0E, 0x00, 0x00, 0x00, 0x01,
|
||||||
|
|
@ -58,6 +61,7 @@ pub(crate) const LUT_BW: [u8; 42] =[
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
#[cfg(feature = "epd4in2_fast_update")]
|
#[cfg(feature = "epd4in2_fast_update")]
|
||||||
pub(crate) const LUT_BW_QUICK: [u8; 42] =[
|
pub(crate) const LUT_BW_QUICK: [u8; 42] =[
|
||||||
0xA0, 0x0E, 0x00, 0x00, 0x00, 0x01,
|
0xA0, 0x0E, 0x00, 0x00, 0x00, 0x01,
|
||||||
|
|
@ -80,6 +84,7 @@ pub(crate) const LUT_BB: [u8; 42] =[
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
#[cfg(feature = "epd4in2_fast_update")]
|
#[cfg(feature = "epd4in2_fast_update")]
|
||||||
pub(crate) const LUT_BB_QUICK: [u8; 42] =[
|
pub(crate) const LUT_BB_QUICK: [u8; 42] =[
|
||||||
0x50, 0x0E, 0x00, 0x00, 0x00, 0x01,
|
0x50, 0x0E, 0x00, 0x00, 0x00, 0x01,
|
||||||
|
|
@ -102,6 +107,7 @@ pub(crate) const LUT_WB: [u8; 42] =[
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
#[cfg(feature = "epd4in2_fast_update")]
|
#[cfg(feature = "epd4in2_fast_update")]
|
||||||
pub(crate) const LUT_WB_QUICK: [u8; 42] =[
|
pub(crate) const LUT_WB_QUICK: [u8; 42] =[
|
||||||
0x50, 0x0E, 0x00, 0x00, 0x00, 0x01,
|
0x50, 0x0E, 0x00, 0x00, 0x00, 0x01,
|
||||||
|
|
|
||||||
|
|
@ -323,18 +323,18 @@ where
|
||||||
self.send_data(spi, &[h as u8])
|
self.send_data(spi, &[h as u8])
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Fill the look-up table for the EPD
|
/// Fill the look-up table for the EPD for a full refresh (slower)
|
||||||
//TODO: make public?
|
pub fn set_lut(&mut self, spi: &mut SPI) -> Result<(), SPI::Error> {
|
||||||
fn set_lut(&mut self, spi: &mut SPI) -> Result<(), SPI::Error> {
|
|
||||||
self.set_lut_helper(spi, &LUT_VCOM0, &LUT_WW, &LUT_BW, &LUT_WB, &LUT_BB)
|
self.set_lut_helper(spi, &LUT_VCOM0, &LUT_WW, &LUT_BW, &LUT_WB, &LUT_BB)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Fill the look-up table for a quick display (partial refresh)
|
/// Fill the look-up table for a quick refresh (partial refresh)
|
||||||
///
|
///
|
||||||
/// Is automatically done by [EPD4in2::display_frame_quick()](EPD4in2::display_frame_quick())
|
/// WARNING: Might lead to ghosting-effects
|
||||||
/// //TODO: make public?
|
#[allow(dead_code)]
|
||||||
|
#[deprecated(note = "Might lead to ghosting-effects/problems with your display. Use set_lut instead!")]
|
||||||
#[cfg(feature = "epd4in2_fast_update")]
|
#[cfg(feature = "epd4in2_fast_update")]
|
||||||
fn set_lut_quick(&mut self, spi: &mut SPI) -> Result<(), SPI::Error> {
|
pub fn set_lut_quick(&mut self, spi: &mut SPI) -> Result<(), SPI::Error> {
|
||||||
self.set_lut_helper(
|
self.set_lut_helper(
|
||||||
spi,
|
spi,
|
||||||
&LUT_VCOM0_QUICK,
|
&LUT_VCOM0_QUICK,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue