mirror of
https://github.com/Anshorei/epd-waveshare.git
synced 2026-10-03 22:06:43 +00:00
Use Drawing::Color instead of hardcoded values
This commit is contained in:
+6
-4
@@ -61,6 +61,8 @@ use hal::{
|
|||||||
mod lut;
|
mod lut;
|
||||||
use self::lut::*;
|
use self::lut::*;
|
||||||
|
|
||||||
|
use drawing::Color;
|
||||||
|
|
||||||
pub mod command;
|
pub mod command;
|
||||||
pub use command::Command as Command;
|
pub use command::Command as Command;
|
||||||
|
|
||||||
@@ -338,8 +340,8 @@ where
|
|||||||
///
|
///
|
||||||
/// TODO: should that option be removed? E.g. the struct contains an additional default background value
|
/// TODO: should that option be removed? E.g. the struct contains an additional default background value
|
||||||
/// which is settable?
|
/// which is settable?
|
||||||
pub fn clear_frame(&mut self, reset_color: Option<u8>) -> Result<(), E> {
|
pub fn clear_frame(&mut self, reset_color: Option<Color>) -> Result<(), E> {
|
||||||
let reset_color: u8 = reset_color.unwrap_or(0xff);
|
let reset_color: Color = reset_color.unwrap_or(Color::White);
|
||||||
|
|
||||||
self.send_resolution()?;
|
self.send_resolution()?;
|
||||||
|
|
||||||
@@ -348,7 +350,7 @@ where
|
|||||||
self.send_command(Command::DATA_START_TRANSMISSION_1)?;
|
self.send_command(Command::DATA_START_TRANSMISSION_1)?;
|
||||||
self.delay_ms(2);
|
self.delay_ms(2);
|
||||||
for _ in 0..size {
|
for _ in 0..size {
|
||||||
self.send_data(reset_color)?;
|
self.send_data(reset_color.get_full_byte())?;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.delay_ms(2);
|
self.delay_ms(2);
|
||||||
@@ -356,7 +358,7 @@ where
|
|||||||
self.send_command(Command::DATA_START_TRANSMISSION_2)?;
|
self.send_command(Command::DATA_START_TRANSMISSION_2)?;
|
||||||
self.delay_ms(2);
|
self.delay_ms(2);
|
||||||
for _ in 0..size {
|
for _ in 0..size {
|
||||||
self.send_data(reset_color)?;
|
self.send_data(reset_color.get_full_byte())?;
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user