skip closure/task
parent
04476e6671
commit
c3a4cde815
|
|
@ -299,7 +299,7 @@ where
|
||||||
DELAY: DelayMs<u8>,
|
DELAY: DelayMs<u8>,
|
||||||
{
|
{
|
||||||
fn wait_until_idle(&mut self) {
|
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> {
|
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) {
|
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> {
|
fn send_resolution(&mut self, spi: &mut SPI) -> Result<(), SPI::Error> {
|
||||||
|
|
|
||||||
|
|
@ -275,7 +275,7 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
fn wait_until_idle(&mut self) {
|
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> {
|
fn send_resolution(&mut self, spi: &mut SPI) -> Result<(), SPI::Error> {
|
||||||
|
|
|
||||||
|
|
@ -564,7 +564,7 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
fn wait_until_idle(&mut self) {
|
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) {
|
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
|
/// Refresh display for partial frame
|
||||||
|
|
|
||||||
|
|
@ -298,7 +298,7 @@ where
|
||||||
DELAY: DelayMs<u8>,
|
DELAY: DelayMs<u8>,
|
||||||
{
|
{
|
||||||
fn wait_until_idle(&mut self) {
|
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> {
|
fn use_full_frame(&mut self, spi: &mut SPI) -> Result<(), SPI::Error> {
|
||||||
|
|
|
||||||
|
|
@ -365,7 +365,7 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
fn wait_until_idle(&mut self) {
|
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> {
|
fn send_resolution(&mut self, spi: &mut SPI) -> Result<(), SPI::Error> {
|
||||||
|
|
|
||||||
|
|
@ -372,7 +372,7 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
fn wait_until_idle(&mut self) {
|
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> {
|
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>
|
for EPD4in2<SPI, CS, BUSY, DC, RST, DELAY>
|
||||||
where
|
where
|
||||||
SPI: Write<u8>,
|
SPI: Write<u8>,
|
||||||
|
|
|
||||||
|
|
@ -223,10 +223,10 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
fn wait_busy_high(&mut self) {
|
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) {
|
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> {
|
fn send_resolution(&mut self, spi: &mut SPI) -> Result<(), SPI::Error> {
|
||||||
let w = self.width();
|
let w = self.width();
|
||||||
|
|
|
||||||
|
|
@ -255,7 +255,7 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
fn wait_until_idle(&mut self) {
|
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> {
|
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> {
|
fn wait_until_idle(&mut self, spi: &mut SPI, delay: &mut DELAY) -> Result<(), SPI::Error> {
|
||||||
self.interface.wait_until_idle(
|
while self.interface.is_busy(IS_BUSY_LOW) {
|
||||||
IS_BUSY_LOW,
|
self.interface.cmd(spi, Command::GET_STATUS)?;
|
||||||
Some((spi, delay, |i, s, d| {
|
delay.delay_ms(20);
|
||||||
i.cmd(s, Command::GET_STATUS)?;
|
}
|
||||||
d.delay_ms(20);
|
|
||||||
Ok(())
|
|
||||||
})),
|
|
||||||
)?;
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -130,32 +130,14 @@ where
|
||||||
///
|
///
|
||||||
/// Most likely there was a mistake with the 2in9 busy connection
|
/// 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
|
/// //TODO: use the #cfg feature to make this compile the right way for the certain types
|
||||||
pub(crate) fn wait_until_idle(
|
pub(crate) fn wait_until_idle(&mut self, is_busy_low: bool) {
|
||||||
&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> {
|
|
||||||
// //tested: worked without the delay for all tested devices
|
// //tested: worked without the delay for all tested devices
|
||||||
// //self.delay_ms(1);
|
// //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) {
|
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
|
// //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
|
// //old: shorten the time? it was 100 in the beginning
|
||||||
// //self.delay_ms(5);
|
// //self.delay_ms(5);
|
||||||
}
|
}
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Checks if device is still busy
|
/// Checks if device is still busy
|
||||||
|
|
|
||||||
|
|
@ -280,14 +280,13 @@ where
|
||||||
///# Ok(())
|
///# Ok(())
|
||||||
///# }
|
///# }
|
||||||
///```
|
///```
|
||||||
pub trait QuickRefresh<SPI, CS, BUSY, DC, RST, DELAY>
|
pub trait QuickRefresh<SPI, CS, BUSY, DC, RST>
|
||||||
where
|
where
|
||||||
SPI: Write<u8>,
|
SPI: Write<u8>,
|
||||||
CS: OutputPin,
|
CS: OutputPin,
|
||||||
BUSY: InputPin,
|
BUSY: InputPin,
|
||||||
DC: OutputPin,
|
DC: OutputPin,
|
||||||
RST: OutputPin,
|
RST: OutputPin,
|
||||||
DELAY: DelayMs<u8>,
|
|
||||||
{
|
{
|
||||||
/// Updates the old frame.
|
/// Updates the old frame.
|
||||||
fn update_old_frame(&mut self, spi: &mut SPI, buffer: &[u8]) -> Result<(), SPI::Error>;
|
fn update_old_frame(&mut self, spi: &mut SPI, buffer: &[u8]) -> Result<(), SPI::Error>;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue