skip closure/task
parent
04476e6671
commit
c3a4cde815
|
|
@ -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> {
|
||||
|
|
|
|||
|
|
@ -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> {
|
||||
|
|
|
|||
|
|
@ -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> {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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> {
|
||||
|
|
|
|||
|
|
@ -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> {
|
||||
|
|
|
|||
|
|
@ -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>,
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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> {
|
||||
|
|
|
|||
|
|
@ -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(())
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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>;
|
||||
|
|
|
|||
Loading…
Reference in New Issue