Skip to content

Commit a20054c

Browse files
authored
Fix misuse of INT_CLR (#1651)
* Fix misuse of INT_CLR * Use LCD_START instead of interrupt to check for completion
1 parent f125c20 commit a20054c

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

esp-hal/src/lcd_cam/lcd/i8080.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,9 @@ where
233233

234234
impl<'d, TX: Tx, P: TxPins> DmaSupport for I8080<'d, TX, P> {
235235
fn peripheral_wait_dma(&mut self, _is_tx: bool, _is_rx: bool) {
236-
let dma_int_raw = self.lcd_cam.lc_dma_int_raw();
237-
// Wait until LCD_TRANS_DONE is set.
238-
while dma_int_raw.read().lcd_trans_done_int_raw().bit_is_clear() {}
236+
let lcd_user = self.lcd_cam.lcd_user();
237+
// Wait until LCD_START is cleared by hardware.
238+
while lcd_user.read().lcd_start().bit_is_set() {}
239239
self.tear_down_send();
240240
}
241241

@@ -310,9 +310,9 @@ where
310310
self.start_write_bytes_dma(data.as_ptr() as _, core::mem::size_of_val(data))?;
311311
self.start_send();
312312

313-
let dma_int_raw = self.lcd_cam.lc_dma_int_raw();
314-
// Wait until LCD_TRANS_DONE is set.
315-
while dma_int_raw.read().lcd_trans_done_int_raw().bit_is_clear() {}
313+
let lcd_user = self.lcd_cam.lcd_user();
314+
// Wait until LCD_START is cleared by hardware.
315+
while lcd_user.read().lcd_start().bit_is_set() {}
316316

317317
self.tear_down_send();
318318

@@ -405,13 +405,15 @@ impl<'d, TX: Tx, P> I8080<'d, TX, P> {
405405
}
406406

407407
fn tear_down_send(&mut self) {
408+
// This will already be cleared unless the user is trying to cancel,
409+
// which is why this is still here.
408410
self.lcd_cam
409411
.lcd_user()
410412
.modify(|_, w| w.lcd_start().clear_bit());
411413

412414
self.lcd_cam
413415
.lc_dma_int_clr()
414-
.write(|w| w.lcd_trans_done_int_clr().clear_bit());
416+
.write(|w| w.lcd_trans_done_int_clr().set_bit());
415417
}
416418

417419
fn start_write_bytes_dma(&mut self, ptr: *const u8, len: usize) -> Result<(), DmaError> {

0 commit comments

Comments
 (0)