Skip to content

Commit

Permalink
Fix misuse of INT_CLR (#1651)
Browse files Browse the repository at this point in the history
* Fix misuse of INT_CLR

* Use LCD_START instead of interrupt to check for completion
  • Loading branch information
Dominaezzz authored Jun 5, 2024
1 parent f125c20 commit a20054c
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions esp-hal/src/lcd_cam/lcd/i8080.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,9 @@ where

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

Expand Down Expand Up @@ -310,9 +310,9 @@ where
self.start_write_bytes_dma(data.as_ptr() as _, core::mem::size_of_val(data))?;
self.start_send();

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

self.tear_down_send();

Expand Down Expand Up @@ -405,13 +405,15 @@ impl<'d, TX: Tx, P> I8080<'d, TX, P> {
}

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

self.lcd_cam
.lc_dma_int_clr()
.write(|w| w.lcd_trans_done_int_clr().clear_bit());
.write(|w| w.lcd_trans_done_int_clr().set_bit());
}

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

0 comments on commit a20054c

Please sign in to comment.