Skip to content

Commit

Permalink
Only use crate::interrupt:free for ESP32
Browse files Browse the repository at this point in the history
  • Loading branch information
jessebraham committed Jan 7, 2025
1 parent 0a46d68 commit b82f174
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion esp-hal/src/uart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,15 @@ where
}

if self.rx_fifo_count() > 0 {
let byte = crate::interrupt::free(|| fifo.read().rxfifo_rd_byte().bits());
// https://docs.espressif.com/projects/esp-chip-errata/en/latest/esp32/03-errata-description/esp32/cpu-subsequent-access-halted-when-get-interrupted.html
cfg_if::cfg_if! {
if #[cfg(esp32)] {
let byte = crate::interrupt::free(|| fifo.read().rxfifo_rd_byte().bits());
} else {
let byte = fifo.read().rxfifo_rd_byte().bits();
}
}

Ok(byte)
} else {
Err(nb::Error::WouldBlock)
Expand Down

0 comments on commit b82f174

Please sign in to comment.