Skip to content

Commit

Permalink
small cleanup in i2s_parallel examples
Browse files Browse the repository at this point in the history
  • Loading branch information
liebman committed Oct 21, 2024
1 parent 7852126 commit 2bddce5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
7 changes: 0 additions & 7 deletions examples/src/bin/embassy_i2s_parallel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,6 @@ async fn main(_spawner: Spawner) {
data[3] = (offset + 1) as u8;
}

let tx_buffer = unsafe {
use esp_hal::dma::ReadBuffer;
let (ptr, len) = tx_buffer.read_buffer();
// SAFETY: tx_buffer is left inside of the TxBuf
core::slice::from_raw_parts_mut(ptr as *mut u8, len)
};

let mut tx_buf = DmaTxBuf::new(tx_descriptors, tx_buffer).expect("DmaTxBuf::new failed");

info!("Sending {} bytes!", BUFFER_SIZE);
Expand Down
10 changes: 2 additions & 8 deletions examples/src/bin/i2s_parallel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
//! rate with a delay of 10ms between each transfer.
//!
//! The following wiring is assumed:
//! - Data pins => GPIO16, GPIO4, GPIO17, GPIO18, GPIO5, GPIO19, GPIO12, and GPIO14
//! - Data pins => GPIO16, GPIO4, GPIO17, GPIO18, GPIO5, GPIO19, GPIO12, and
//! GPIO14
//! - Clock output pin => GPIO25
//!
//! You can use a logic analyzer to see how the pins are used.
Expand Down Expand Up @@ -68,13 +69,6 @@ fn main() -> ! {
data[3] = (offset + 1) as u8;
}

let tx_buffer = unsafe {
use esp_hal::dma::ReadBuffer;
let (ptr, len) = tx_buffer.read_buffer();
// SAFETY: tx_buffer is left inside of the TxBuf
core::slice::from_raw_parts_mut(ptr as *mut u8, len)
};

let mut tx_buf: DmaTxBuf =
DmaTxBuf::new(tx_descriptors, tx_buffer).expect("DmaTxBuf::new failed");

Expand Down

0 comments on commit 2bddce5

Please sign in to comment.