From 0b6abc1a6d6e0311fdbcc1a94335ce5b1b260afc Mon Sep 17 00:00:00 2001 From: Dominic Fischer Date: Sun, 23 Jun 2024 00:08:08 +0100 Subject: [PATCH] Fix DMA wait check in LCD_CAM --- esp-hal/CHANGELOG.md | 2 ++ esp-hal/src/lcd_cam/cam.rs | 24 ++++++++++++++++-------- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/esp-hal/CHANGELOG.md b/esp-hal/CHANGELOG.md index 16608e529bd..50584609699 100644 --- a/esp-hal/CHANGELOG.md +++ b/esp-hal/CHANGELOG.md @@ -20,6 +20,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- ESP32-S3: Fix DMA waiting check in LCD_CAM (#1707) + ### Changed - Refactor `Dac1`/`Dac2` drivers into a single `Dac` driver (#1661) diff --git a/esp-hal/src/lcd_cam/cam.rs b/esp-hal/src/lcd_cam/cam.rs index 8abda6e4b2e..1162d86403f 100644 --- a/esp-hal/src/lcd_cam/cam.rs +++ b/esp-hal/src/lcd_cam/cam.rs @@ -203,14 +203,22 @@ where impl<'d, RX: Rx> DmaSupport for Camera<'d, RX> { fn peripheral_wait_dma(&mut self, _is_tx: bool, _is_rx: bool) { - while ! - // Wait for IN_SUC_EOF (i.e. VSYNC) - self.rx_channel.is_done() || - // Or for IN_DSCR_EMPTY (i.e. No more buffer space) - self.rx_channel.has_dscr_empty_error() || - // Or for IN_DSCR_ERR (i.e. bad descriptor) - self.rx_channel.has_error() - {} + loop { + // Wait for IN_SUC_EOF (i.e. VSYNC) + if self.rx_channel.is_done() { + break; + } + + // Or for IN_DSCR_EMPTY (i.e. No more buffer space) + if self.rx_channel.has_dscr_empty_error() { + break; + } + + // Or for IN_DSCR_ERR (i.e. bad descriptor) + if self.rx_channel.has_error() { + break; + } + } } fn peripheral_dma_stop(&mut self) {