Skip to content

Commit

Permalink
Clean up i2s*
Browse files Browse the repository at this point in the history
  • Loading branch information
bugadani committed Aug 22, 2024
1 parent a0fc8ab commit fedbf30
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 19 deletions.
14 changes: 4 additions & 10 deletions hil-test/tests/i2s.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,13 @@
#![no_main]

use esp_hal::{
clock::ClockControl,
delay::Delay,
dma::{Dma, DmaPriority},
dma_buffers,
gpio::Io,
i2s::{DataFormat, I2s, I2sReadDma, I2sWriteDma, Standard},
peripheral::Peripheral,
peripherals::Peripherals,
prelude::*,
system::SystemControl,
};
use hil_test as _;

Expand Down Expand Up @@ -52,17 +49,14 @@ impl Iterator for SampleSource {
#[cfg(test)]
#[embedded_test::tests]
mod tests {

use super::*;

#[init]
fn init() {}

#[test]
fn test_i2s_loopback() {
let peripherals = Peripherals::take();
let system = SystemControl::new(peripherals.SYSTEM);
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
let system = esp_hal::init(CpuClock::boot_default());

let peripherals = system.peripherals;
let clocks = system.clocks;

let mut io = Io::new(peripherals.GPIO, peripherals.IO_MUX);

Expand Down
14 changes: 5 additions & 9 deletions hil-test/tests/i2s_async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@
#![no_main]

use esp_hal::{
clock::ClockControl,
dma::{Dma, DmaChannel0, DmaPriority},
gpio::Io,
i2s::{asynch::*, DataFormat, I2s, I2sTx, Standard},
peripheral::Peripheral,
peripherals::{Peripherals, I2S0},
peripherals::I2S0,
prelude::*,
system::SystemControl,
Async,
};
use hil_test as _;
Expand Down Expand Up @@ -77,16 +75,14 @@ async fn writer(tx_buffer: &'static mut [u8], i2s_tx: I2sTx<'static, I2S0, DmaCh
mod tests {
use super::*;

#[init]
async fn init() {}

#[test]
async fn test_i2s_loopback() {
let spawner = embassy_executor::Spawner::for_current_executor().await;

let peripherals = Peripherals::take();
let system = SystemControl::new(peripherals.SYSTEM);
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
let system = esp_hal::init(CpuClock::boot_default());

let peripherals = system.peripherals;
let clocks = system.clocks;

let mut io = Io::new(peripherals.GPIO, peripherals.IO_MUX);

Expand Down

0 comments on commit fedbf30

Please sign in to comment.