skip closure/task

main
Edwin Svensson 2021-04-11 16:57:28 +02:00
parent 04476e6671
commit c3a4cde815
No known key found for this signature in database
GPG Key ID: 7F9EC4DD0C67951F
13 changed files with 18 additions and 41 deletions

View File

@ -299,7 +299,7 @@ where
DELAY: DelayMs<u8>,
{
fn wait_until_idle(&mut self) {
let _ = self.interface.wait_until_idle(IS_BUSY_LOW, None);
let _ = self.interface.wait_until_idle(IS_BUSY_LOW);
}
pub(crate) fn use_full_frame(&mut self, spi: &mut SPI) -> Result<(), SPI::Error> {

View File

@ -339,7 +339,7 @@ where
}
fn wait_until_idle(&mut self) {
let _ = self.interface.wait_until_idle(IS_BUSY_LOW, None);
let _ = self.interface.wait_until_idle(IS_BUSY_LOW);
}
fn send_resolution(&mut self, spi: &mut SPI) -> Result<(), SPI::Error> {

View File

@ -275,7 +275,7 @@ where
}
fn wait_until_idle(&mut self) {
let _ = self.interface.wait_until_idle(IS_BUSY_LOW, None);
let _ = self.interface.wait_until_idle(IS_BUSY_LOW);
}
fn send_resolution(&mut self, spi: &mut SPI) -> Result<(), SPI::Error> {

View File

@ -564,7 +564,7 @@ where
}
fn wait_until_idle(&mut self) {
let _ = self.interface.wait_until_idle(IS_BUSY_LOW, None);
let _ = self.interface.wait_until_idle(IS_BUSY_LOW);
}
}

View File

@ -363,7 +363,7 @@ where
}
fn wait_until_idle(&mut self) {
let _ = self.interface.wait_until_idle(IS_BUSY_LOW, None);
let _ = self.interface.wait_until_idle(IS_BUSY_LOW);
}
/// Refresh display for partial frame

View File

@ -298,7 +298,7 @@ where
DELAY: DelayMs<u8>,
{
fn wait_until_idle(&mut self) {
let _ = self.interface.wait_until_idle(IS_BUSY_LOW, None);
let _ = self.interface.wait_until_idle(IS_BUSY_LOW);
}
fn use_full_frame(&mut self, spi: &mut SPI) -> Result<(), SPI::Error> {

View File

@ -365,7 +365,7 @@ where
}
fn wait_until_idle(&mut self) {
let _ = self.interface.wait_until_idle(IS_BUSY_LOW, None);
let _ = self.interface.wait_until_idle(IS_BUSY_LOW);
}
fn send_resolution(&mut self, spi: &mut SPI) -> Result<(), SPI::Error> {

View File

@ -372,7 +372,7 @@ where
}
fn wait_until_idle(&mut self) {
let _ = self.interface.wait_until_idle(IS_BUSY_LOW, None);
let _ = self.interface.wait_until_idle(IS_BUSY_LOW);
}
fn send_resolution(&mut self, spi: &mut SPI) -> Result<(), SPI::Error> {
@ -442,7 +442,7 @@ where
}
}
impl<SPI, CS, BUSY, DC, RST, DELAY> QuickRefresh<SPI, CS, BUSY, DC, RST, DELAY>
impl<SPI, CS, BUSY, DC, RST, DELAY> QuickRefresh<SPI, CS, BUSY, DC, RST>
for EPD4in2<SPI, CS, BUSY, DC, RST, DELAY>
where
SPI: Write<u8>,

View File

@ -223,10 +223,10 @@ where
}
fn wait_busy_high(&mut self) {
let _ = self.interface.wait_until_idle(true, None);
let _ = self.interface.wait_until_idle(true);
}
fn wait_busy_low(&mut self) {
let _ = self.interface.wait_until_idle(false, None);
let _ = self.interface.wait_until_idle(false);
}
fn send_resolution(&mut self, spi: &mut SPI) -> Result<(), SPI::Error> {
let w = self.width();

View File

@ -255,7 +255,7 @@ where
}
fn wait_until_idle(&mut self) {
let _ = self.interface.wait_until_idle(IS_BUSY_LOW, None);
let _ = self.interface.wait_until_idle(IS_BUSY_LOW);
}
fn send_resolution(&mut self, spi: &mut SPI) -> Result<(), SPI::Error> {

View File

@ -229,14 +229,10 @@ where
}
fn wait_until_idle(&mut self, spi: &mut SPI, delay: &mut DELAY) -> Result<(), SPI::Error> {
self.interface.wait_until_idle(
IS_BUSY_LOW,
Some((spi, delay, |i, s, d| {
i.cmd(s, Command::GET_STATUS)?;
d.delay_ms(20);
Ok(())
})),
)?;
while self.interface.is_busy(IS_BUSY_LOW) {
self.interface.cmd(spi, Command::GET_STATUS)?;
delay.delay_ms(20);
}
Ok(())
}

View File

@ -130,32 +130,14 @@ where
///
/// Most likely there was a mistake with the 2in9 busy connection
/// //TODO: use the #cfg feature to make this compile the right way for the certain types
pub(crate) fn wait_until_idle(
&mut self,
is_busy_low: bool,
mut task: Option<(
&mut SPI,
&mut DELAY,
fn(&mut Self, &mut SPI, &mut DELAY) -> Result<(), SPI::Error>,
)>,
) -> Result<(), SPI::Error> {
pub(crate) fn wait_until_idle(&mut self, is_busy_low: bool) {
// //tested: worked without the delay for all tested devices
// //self.delay_ms(1);
// Some displays need special treatment (Only 7.5"V2 known so far)
// In those cases, a "task" is provided and run here. If note, this
// just busy waits for the display.
while self.is_busy(is_busy_low) {
match task {
// TODO: Ignore this error?
Some((ref mut spi, ref mut delay, tcb)) => tcb(self, spi, delay)?,
None => {}
}
// //tested: REMOVAL of DELAY: it's only waiting for the signal anyway and should continue work asap
// //old: shorten the time? it was 100 in the beginning
// //self.delay_ms(5);
}
Ok(())
}
/// Checks if device is still busy

View File

@ -280,14 +280,13 @@ where
///# Ok(())
///# }
///```
pub trait QuickRefresh<SPI, CS, BUSY, DC, RST, DELAY>
pub trait QuickRefresh<SPI, CS, BUSY, DC, RST>
where
SPI: Write<u8>,
CS: OutputPin,
BUSY: InputPin,
DC: OutputPin,
RST: OutputPin,
DELAY: DelayMs<u8>,
{
/// Updates the old frame.
fn update_old_frame(&mut self, spi: &mut SPI, buffer: &[u8]) -> Result<(), SPI::Error>;