From fedbf30fda6ac531554d6032b773fba2e6710e0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1niel=20Buga?= Date: Thu, 22 Aug 2024 13:10:15 +0200 Subject: [PATCH] Clean up i2s* --- hil-test/tests/i2s.rs | 14 ++++---------- hil-test/tests/i2s_async.rs | 14 +++++--------- 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/hil-test/tests/i2s.rs b/hil-test/tests/i2s.rs index 4aa833f50c1..fd282ea3098 100644 --- a/hil-test/tests/i2s.rs +++ b/hil-test/tests/i2s.rs @@ -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 _; @@ -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); diff --git a/hil-test/tests/i2s_async.rs b/hil-test/tests/i2s_async.rs index 345776d2a32..4ea24fc330e 100644 --- a/hil-test/tests/i2s_async.rs +++ b/hil-test/tests/i2s_async.rs @@ -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 _; @@ -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);