From 086b6059b92d5b58dea5f635d14cd4f574936221 Mon Sep 17 00:00:00 2001 From: Jesse Braham Date: Tue, 23 Apr 2024 13:25:03 +0000 Subject: [PATCH] Remove the `SystemExt` trait and rename `SystemParts` to `SystemControl` (#1495) * Convert `SoftwareInterrupt` to a unit struct * Remove the `SystemExt` trait and rename `SystemParts` to `SystemControl` * Update all examples an HIL tests to reflect previous API changes * Clean up imports in `hil-test` package, address `clippy` lint warnings * Update `CHANGELOG.md` --- esp-hal/CHANGELOG.md | 8 +- esp-hal/src/prelude.rs | 2 - esp-hal/src/system.rs | 99 ++++++++++--------- examples/src/bin/adc.rs | 3 +- examples/src/bin/adc_cal.rs | 3 +- examples/src/bin/advanced_serial.rs | 3 +- examples/src/bin/blinky.rs | 11 ++- examples/src/bin/blinky_erased_pins.rs | 3 +- examples/src/bin/clock_monitor.rs | 10 +- examples/src/bin/crc.rs | 3 +- examples/src/bin/dac.rs | 3 +- examples/src/bin/debug_assist.rs | 3 +- examples/src/bin/direct_vectoring.rs | 4 +- examples/src/bin/embassy_hello_world.rs | 3 +- .../src/bin/embassy_hello_world_systimer.rs | 3 +- examples/src/bin/embassy_i2c.rs | 3 +- examples/src/bin/embassy_i2s_read.rs | 3 +- examples/src/bin/embassy_i2s_sound.rs | 3 +- examples/src/bin/embassy_multicore.rs | 3 +- .../src/bin/embassy_multicore_interrupt.rs | 3 +- examples/src/bin/embassy_multiprio.rs | 3 +- examples/src/bin/embassy_parl_io_rx.rs | 3 +- examples/src/bin/embassy_parl_io_tx.rs | 3 +- examples/src/bin/embassy_rmt_rx.rs | 3 +- examples/src/bin/embassy_rmt_tx.rs | 3 +- examples/src/bin/embassy_serial.rs | 3 +- examples/src/bin/embassy_spi.rs | 3 +- examples/src/bin/embassy_systimer_delay.rs | 3 +- examples/src/bin/embassy_twai.rs | 3 +- examples/src/bin/embassy_usb_serial_jtag.rs | 3 +- examples/src/bin/embassy_wait.rs | 3 +- examples/src/bin/etm_timer.rs | 3 +- examples/src/bin/gpio_interrupt.rs | 3 +- examples/src/bin/hello_rgb.rs | 3 +- examples/src/bin/hello_world.rs | 3 +- examples/src/bin/hmac.rs | 3 +- .../src/bin/i2c_bmp180_calibration_data.rs | 11 ++- examples/src/bin/i2c_display.rs | 3 +- examples/src/bin/i2s_read.rs | 3 +- examples/src/bin/i2s_sound.rs | 3 +- examples/src/bin/interrupt_preemption.rs | 8 +- examples/src/bin/lcd_i8080.rs | 3 +- examples/src/bin/ledc.rs | 3 +- examples/src/bin/lp_core_uart.rs | 3 +- examples/src/bin/mcpwm.rs | 3 +- examples/src/bin/multicore.rs | 3 +- examples/src/bin/parl_io_rx.rs | 3 +- examples/src/bin/parl_io_tx.rs | 3 +- examples/src/bin/psram.rs | 10 +- examples/src/bin/qspi_flash.rs | 3 +- examples/src/bin/ram.rs | 3 +- examples/src/bin/rmt_rx.rs | 3 +- examples/src/bin/rmt_tx.rs | 3 +- examples/src/bin/rtc_time.rs | 3 +- examples/src/bin/serial_interrupts.rs | 3 +- examples/src/bin/sleep_timer.rs | 3 +- examples/src/bin/sleep_timer_ext0.rs | 3 +- examples/src/bin/sleep_timer_ext1.rs | 3 +- examples/src/bin/sleep_timer_lpio.rs | 3 +- examples/src/bin/sleep_timer_rtcio.rs | 3 +- examples/src/bin/software_interrupts.rs | 4 +- examples/src/bin/spi_eh1_device_loopback.rs | 3 +- examples/src/bin/spi_eh1_loopback.rs | 3 +- .../spi_halfduplex_read_manufacturer_id.rs | 3 +- examples/src/bin/spi_loopback.rs | 3 +- examples/src/bin/spi_loopback_dma.rs | 3 +- examples/src/bin/spi_slave_dma.rs | 3 +- examples/src/bin/systimer.rs | 3 +- examples/src/bin/timer_interrupt.rs | 3 +- examples/src/bin/twai.rs | 3 +- examples/src/bin/usb_serial_jtag.rs | 3 +- examples/src/bin/watchdog.rs | 3 +- hil-test/tests/clock_monitor.rs | 9 +- hil-test/tests/gpio.rs | 4 +- hil-test/tests/spi_full_duplex.rs | 3 +- hil-test/tests/spi_full_duplex_dma.rs | 7 +- hil-test/tests/uart.rs | 3 +- hil-test/tests/uart_async.rs | 4 +- 78 files changed, 244 insertions(+), 139 deletions(-) diff --git a/esp-hal/CHANGELOG.md b/esp-hal/CHANGELOG.md index 2768261da60..5e19c7caaf5 100644 --- a/esp-hal/CHANGELOG.md +++ b/esp-hal/CHANGELOG.md @@ -14,7 +14,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - i2c: i2c1_handler used I2C0 register block by mistake (#1487) -- Smart LEDs docs example (#1504) +- Removed ESP32 specific code for resolutions > 16 bit in ledc embedded_hal::pwm max_duty_cycle function. (#1441) +- Fixed division by zero in ledc embedded_hal::pwm set_duty_cycle function and converted to set_duty_hw instead of set_duty to eliminate loss of granularity. (#1441) ### Changed @@ -23,9 +24,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `IO`, `ADC`, `DAC`, `RTC*`, `LEDC`, `PWM` and `PCNT` drivers have been converted to camel case format (#1473) - RNG is no longer TRNG, the `CryptoRng` implementation has been removed. To track this being re-added see #1499 (#1498) - Make software interrupts shareable (#1500) +- The `SystemParts` struct has been renamed to `SystemControl`, and now has a constructor which takes the `SYSTEM` peripheral (#1495) ### Removed +- Removed the `SystemExt` trait (#1495) + ## [0.17.0] - 2024-04-18 ### Added @@ -62,8 +66,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed writes to SPI not flushing before attempting to write, causing corrupted writes (#1381) - fix AdcConfig::adc_calibrate for xtensa targets (#1379) - Fixed a divide by zero panic when setting the LEDC duty cycle to 0 with `SetDutyCycle::set_duty_cycle` (#1403) -- Fix for issue #1419. Removed ESP32 specific code for resolutions > 16 bit in ledc embedded_hal::pwm max_duty_cycle function. -- Fix for issue #1419. Fixed division by zero in ledc embedded_hal::pwm set_duty_cycle function and converted to set_duty_hw instead of set_duty to eliminate loss of granularity. - Support 192 and 256-bit keys for AES (#1316) - Fixed MCPWM DeadTimeCfg bit values (#1378) - ESP32 LEDC `set_duty_cycle` used HighSpeedChannel for LowSpeedChannel (#1457) diff --git a/esp-hal/src/prelude.rs b/esp-hal/src/prelude.rs index ea4518c14f5..0475184ef6c 100644 --- a/esp-hal/src/prelude.rs +++ b/esp-hal/src/prelude.rs @@ -36,8 +36,6 @@ pub use crate::ledc::{ }, timer::{TimerHW as _esp_hal_ledc_timer_TimerHW, TimerIFace as _esp_hal_ledc_timer_TimerIFace}, }; -#[cfg(any(dport, pcr, system))] -pub use crate::system::SystemExt as _esp_hal_system_SystemExt; #[cfg(any(timg0, timg1))] pub use crate::timer::{ Instance as _esp_hal_timer_Instance, diff --git a/esp-hal/src/system.rs b/esp-hal/src/system.rs index 3c4843c7ebf..d2839881866 100755 --- a/esp-hal/src/system.rs +++ b/esp-hal/src/system.rs @@ -23,7 +23,7 @@ //! ## Example //! ```no_run //! let peripherals = Peripherals::take(); -//! let system = peripherals.SYSTEM.split(); +//! let system = SystemControl::new(peripherals.SYSTEM); //! let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); //! ``` @@ -99,9 +99,30 @@ pub enum Peripheral { LcdCam, } +/// The `DPORT`/`PCR`/`SYSTEM` peripheral split into its different logical +/// components. +pub struct SystemControl<'d> { + _inner: PeripheralRef<'d, SYSTEM>, + pub clock_control: SystemClockControl, + pub software_interrupt_control: SoftwareInterruptControl, +} + +impl<'d> SystemControl<'d> { + /// Construct a new instance of [`SystemControl`]. + pub fn new(system: impl crate::peripheral::Peripheral

+ 'd) -> Self { + crate::into_ref!(system); + + Self { + _inner: system, + clock_control: SystemClockControl::new(), + software_interrupt_control: SoftwareInterruptControl::new(), + } + } +} + /// A software interrupt can be triggered by software. #[non_exhaustive] -pub struct SoftwareInterrupt {} +pub struct SoftwareInterrupt; impl SoftwareInterrupt { /// Sets the interrupt handler for this software-interrupt @@ -192,7 +213,7 @@ impl SoftwareInterrupt { /// time. #[inline] pub unsafe fn steal() -> Self { - Self {} + Self } } @@ -221,17 +242,17 @@ pub struct SoftwareInterruptControl { } impl SoftwareInterruptControl { - fn new_internal() -> Self { + fn new() -> Self { // the thread-executor uses SW-INT0 when used on a multi-core system // we cannot easily require `software_interrupt0` there since it's created // before `main` via proc-macro SoftwareInterruptControl { #[cfg(not(all(feature = "embassy-executor-thread", multi_core)))] - software_interrupt0: SoftwareInterrupt {}, - software_interrupt1: SoftwareInterrupt {}, - software_interrupt2: SoftwareInterrupt {}, - software_interrupt3: SoftwareInterrupt {}, + software_interrupt0: SoftwareInterrupt, + software_interrupt1: SoftwareInterrupt, + software_interrupt2: SoftwareInterrupt, + software_interrupt3: SoftwareInterrupt, } } } @@ -1077,6 +1098,29 @@ pub struct SystemClockControl { _private: (), } +impl SystemClockControl { + pub fn new() -> Self { + Self { _private: () } + } +} + +impl Default for SystemClockControl { + fn default() -> Self { + Self::new() + } +} + +impl crate::peripheral::Peripheral for SystemClockControl { + type P = SystemClockControl; + + #[inline] + unsafe fn clone_unchecked(&mut self) -> Self::P { + SystemClockControl { _private: () } + } +} + +impl crate::private::Sealed for SystemClockControl {} + /// Enumeration of the available radio peripherals for this chip. #[cfg(any(bt, ieee802154, wifi))] pub enum RadioPeripherals { @@ -1110,42 +1154,3 @@ pub trait RadioClockController { fn reset_rpa(&mut self); } - -/// The SYSTEM/DPORT splitted into it's different logical parts. -pub struct SystemParts<'d> { - _private: PeripheralRef<'d, SYSTEM>, - pub clock_control: SystemClockControl, - pub software_interrupt_control: SoftwareInterruptControl, -} - -/// Extension trait to split a SYSTEM/DPORT peripheral in independent logical -/// parts -pub trait SystemExt<'d> { - type Parts; - - /// Splits the SYSTEM/DPORT peripheral into it's parts. - fn split(self) -> Self::Parts; -} - -impl<'d, T: crate::peripheral::Peripheral

+ 'd> SystemExt<'d> for T { - type Parts = SystemParts<'d>; - - fn split(self) -> Self::Parts { - Self::Parts { - _private: self.into_ref(), - clock_control: SystemClockControl { _private: () }, - software_interrupt_control: SoftwareInterruptControl::new_internal(), - } - } -} - -impl crate::peripheral::Peripheral for SystemClockControl { - type P = SystemClockControl; - - #[inline] - unsafe fn clone_unchecked(&mut self) -> Self::P { - SystemClockControl { _private: () } - } -} - -impl crate::private::Sealed for SystemClockControl {} diff --git a/examples/src/bin/adc.rs b/examples/src/bin/adc.rs index a8b0722b4b5..399807bb257 100644 --- a/examples/src/bin/adc.rs +++ b/examples/src/bin/adc.rs @@ -17,13 +17,14 @@ use esp_hal::{ gpio::Io, peripherals::Peripherals, prelude::*, + system::SystemControl, }; use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/examples/src/bin/adc_cal.rs b/examples/src/bin/adc_cal.rs index c6951890363..8a2c9e957a3 100644 --- a/examples/src/bin/adc_cal.rs +++ b/examples/src/bin/adc_cal.rs @@ -15,13 +15,14 @@ use esp_hal::{ gpio::Io, peripherals::Peripherals, prelude::*, + system::SystemControl, }; use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/examples/src/bin/advanced_serial.rs b/examples/src/bin/advanced_serial.rs index 2236ba7a0cf..c19f27a02b9 100644 --- a/examples/src/bin/advanced_serial.rs +++ b/examples/src/bin/advanced_serial.rs @@ -19,6 +19,7 @@ use esp_hal::{ gpio::Io, peripherals::Peripherals, prelude::*, + system::SystemControl, uart::{config::Config, TxRxPins, Uart}, }; use esp_println::println; @@ -27,7 +28,7 @@ use nb::block; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/examples/src/bin/blinky.rs b/examples/src/bin/blinky.rs index 4704ee3c767..27d2d00d38f 100644 --- a/examples/src/bin/blinky.rs +++ b/examples/src/bin/blinky.rs @@ -8,12 +8,19 @@ #![no_main] use esp_backtrace as _; -use esp_hal::{clock::ClockControl, delay::Delay, gpio::Io, peripherals::Peripherals, prelude::*}; +use esp_hal::{ + clock::ClockControl, + delay::Delay, + gpio::Io, + peripherals::Peripherals, + prelude::*, + system::SystemControl, +}; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); // Set GPIO0 as an output, and set its state high initially. diff --git a/examples/src/bin/blinky_erased_pins.rs b/examples/src/bin/blinky_erased_pins.rs index 984f14030cd..9864fa5248e 100644 --- a/examples/src/bin/blinky_erased_pins.rs +++ b/examples/src/bin/blinky_erased_pins.rs @@ -17,12 +17,13 @@ use esp_hal::{ gpio::{AnyPin, Input, Io, Output, PullDown, PushPull}, peripherals::Peripherals, prelude::*, + system::SystemControl, }; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/examples/src/bin/clock_monitor.rs b/examples/src/bin/clock_monitor.rs index a72f68608eb..3c080be4730 100644 --- a/examples/src/bin/clock_monitor.rs +++ b/examples/src/bin/clock_monitor.rs @@ -11,7 +11,13 @@ use core::cell::RefCell; use critical_section::Mutex; use esp_backtrace as _; -use esp_hal::{clock::ClockControl, peripherals::Peripherals, prelude::*, rtc_cntl::Rtc}; +use esp_hal::{ + clock::ClockControl, + peripherals::Peripherals, + prelude::*, + rtc_cntl::Rtc, + system::SystemControl, +}; use esp_println::println; static RTC: Mutex>> = Mutex::new(RefCell::new(None)); @@ -19,7 +25,7 @@ static RTC: Mutex>> = Mutex::new(RefCell::new(None)); #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let mut rtc = Rtc::new(peripherals.LPWR, Some(interrupt_handler)); diff --git a/examples/src/bin/crc.rs b/examples/src/bin/crc.rs index 4b2d6c0bc46..9cd9727a99b 100644 --- a/examples/src/bin/crc.rs +++ b/examples/src/bin/crc.rs @@ -14,13 +14,14 @@ use esp_hal::{ peripherals::Peripherals, prelude::*, rom::{crc, md5}, + system::SystemControl, uart::Uart, }; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let delay = Delay::new(&clocks); diff --git a/examples/src/bin/dac.rs b/examples/src/bin/dac.rs index ede3d334e0c..4eb86ddb015 100644 --- a/examples/src/bin/dac.rs +++ b/examples/src/bin/dac.rs @@ -19,12 +19,13 @@ use esp_hal::{ gpio::Io, peripherals::Peripherals, prelude::*, + system::SystemControl, }; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/examples/src/bin/debug_assist.rs b/examples/src/bin/debug_assist.rs index a648f24f0c6..f0d969870ec 100644 --- a/examples/src/bin/debug_assist.rs +++ b/examples/src/bin/debug_assist.rs @@ -16,6 +16,7 @@ use esp_hal::{ clock::ClockControl, peripherals::Peripherals, prelude::*, + system::SystemControl, }; use esp_println::println; @@ -24,7 +25,7 @@ static DA: Mutex>> = Mutex::new(RefCell::new(None)); #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let mut da = DebugAssist::new(peripherals.ASSIST_DEBUG, Some(interrupt_handler)); diff --git a/examples/src/bin/direct_vectoring.rs b/examples/src/bin/direct_vectoring.rs index 2b063a2173b..3f2a5fd70a6 100644 --- a/examples/src/bin/direct_vectoring.rs +++ b/examples/src/bin/direct_vectoring.rs @@ -11,7 +11,7 @@ use esp_hal::{ interrupt::{self, CpuInterrupt, Priority}, peripherals::{Interrupt, Peripherals}, prelude::*, - system::SoftwareInterrupt, + system::{SoftwareInterrupt, SystemControl}, }; static SWINT0: Mutex>>> = Mutex::new(RefCell::new(None)); @@ -28,7 +28,7 @@ fn main() -> ! { } let sw0_trigger_addr = cpu_intr.cpu_intr_from_cpu_0() as *const _ as u32; - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let sw_int = system.software_interrupt_control; critical_section::with(|cs| { diff --git a/examples/src/bin/embassy_hello_world.rs b/examples/src/bin/embassy_hello_world.rs index bd92de2fc72..6506df51eb8 100644 --- a/examples/src/bin/embassy_hello_world.rs +++ b/examples/src/bin/embassy_hello_world.rs @@ -18,6 +18,7 @@ use esp_hal::{ embassy::{self}, peripherals::Peripherals, prelude::*, + system::SystemControl, timer::TimerGroup, }; @@ -33,7 +34,7 @@ async fn run() { async fn main(spawner: Spawner) { esp_println::println!("Init!"); let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let timg0 = TimerGroup::new_async(peripherals.TIMG0, &clocks); diff --git a/examples/src/bin/embassy_hello_world_systimer.rs b/examples/src/bin/embassy_hello_world_systimer.rs index d3ecb4f4104..af3c11aa77a 100644 --- a/examples/src/bin/embassy_hello_world_systimer.rs +++ b/examples/src/bin/embassy_hello_world_systimer.rs @@ -20,6 +20,7 @@ use esp_hal::{ embassy, peripherals::Peripherals, prelude::*, + system::SystemControl, systimer::SystemTimer, }; @@ -35,7 +36,7 @@ async fn run() { async fn main(spawner: Spawner) { esp_println::println!("Init!"); let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let systimer = SystemTimer::new_async(peripherals.SYSTIMER); diff --git a/examples/src/bin/embassy_i2c.rs b/examples/src/bin/embassy_i2c.rs index 51669bbc206..c5b97b6abc6 100644 --- a/examples/src/bin/embassy_i2c.rs +++ b/examples/src/bin/embassy_i2c.rs @@ -27,6 +27,7 @@ use esp_hal::{ i2c::I2C, peripherals::Peripherals, prelude::*, + system::SystemControl, timer::TimerGroup, }; use lis3dh_async::{Lis3dh, Range, SlaveAddr}; @@ -34,7 +35,7 @@ use lis3dh_async::{Lis3dh, Range, SlaveAddr}; #[main] async fn main(_spawner: Spawner) { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let timg0 = TimerGroup::new_async(peripherals.TIMG0, &clocks); diff --git a/examples/src/bin/embassy_i2s_read.rs b/examples/src/bin/embassy_i2s_read.rs index 34ad8e5e53e..11df65a681a 100644 --- a/examples/src/bin/embassy_i2s_read.rs +++ b/examples/src/bin/embassy_i2s_read.rs @@ -29,6 +29,7 @@ use esp_hal::{ i2s::{asynch::*, DataFormat, I2s, Standard}, peripherals::Peripherals, prelude::*, + system::SystemControl, timer::TimerGroup, }; use esp_println::println; @@ -37,7 +38,7 @@ use esp_println::println; async fn main(_spawner: Spawner) { println!("Init!"); let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let timg0 = TimerGroup::new_async(peripherals.TIMG0, &clocks); diff --git a/examples/src/bin/embassy_i2s_sound.rs b/examples/src/bin/embassy_i2s_sound.rs index 644e1666415..29dcd275179 100644 --- a/examples/src/bin/embassy_i2s_sound.rs +++ b/examples/src/bin/embassy_i2s_sound.rs @@ -44,6 +44,7 @@ use esp_hal::{ i2s::{asynch::*, DataFormat, I2s, Standard}, peripherals::Peripherals, prelude::*, + system::SystemControl, timer::TimerGroup, }; use esp_println::println; @@ -60,7 +61,7 @@ const SINE: [i16; 64] = [ async fn main(_spawner: Spawner) { println!("Init!"); let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let timg0 = TimerGroup::new_async(peripherals.TIMG0, &clocks); diff --git a/examples/src/bin/embassy_multicore.rs b/examples/src/bin/embassy_multicore.rs index 91dc2d0a51b..7ab88bdabc0 100644 --- a/examples/src/bin/embassy_multicore.rs +++ b/examples/src/bin/embassy_multicore.rs @@ -24,6 +24,7 @@ use esp_hal::{ gpio::{GpioPin, Io, Output, PushPull}, peripherals::Peripherals, prelude::*, + system::SystemControl, timer::TimerGroup, }; use esp_println::println; @@ -53,7 +54,7 @@ async fn control_led( #[main] async fn main(_spawner: Spawner) { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/examples/src/bin/embassy_multicore_interrupt.rs b/examples/src/bin/embassy_multicore_interrupt.rs index 181656c7ae7..649146cb011 100644 --- a/examples/src/bin/embassy_multicore_interrupt.rs +++ b/examples/src/bin/embassy_multicore_interrupt.rs @@ -24,6 +24,7 @@ use esp_hal::{ interrupt::Priority, peripherals::Peripherals, prelude::*, + system::SystemControl, timer::TimerGroup, }; use esp_println::println; @@ -72,7 +73,7 @@ async fn enable_disable_led(control: &'static Signal ! { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/examples/src/bin/embassy_multiprio.rs b/examples/src/bin/embassy_multiprio.rs index ec12e2c93d8..c58b17b49af 100644 --- a/examples/src/bin/embassy_multiprio.rs +++ b/examples/src/bin/embassy_multiprio.rs @@ -31,6 +31,7 @@ use esp_hal::{ interrupt::Priority, peripherals::Peripherals, prelude::*, + system::SystemControl, timer::TimerGroup, }; use esp_println::println; @@ -76,7 +77,7 @@ async fn main(low_prio_spawner: Spawner) { esp_println::logger::init_logger_from_env(); println!("Init!"); let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let timg0 = TimerGroup::new_async(peripherals.TIMG0, &clocks); diff --git a/examples/src/bin/embassy_parl_io_rx.rs b/examples/src/bin/embassy_parl_io_rx.rs index 3cfd3873294..07612d23790 100644 --- a/examples/src/bin/embassy_parl_io_rx.rs +++ b/examples/src/bin/embassy_parl_io_rx.rs @@ -22,6 +22,7 @@ use esp_hal::{ parl_io::{BitPackOrder, NoClkPin, ParlIoRxOnly, RxFourBits}, peripherals::Peripherals, prelude::*, + system::SystemControl, timer::TimerGroup, }; use esp_println::println; @@ -30,7 +31,7 @@ use esp_println::println; async fn main(_spawner: Spawner) { esp_println::println!("Init!"); let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let timg0 = TimerGroup::new_async(peripherals.TIMG0, &clocks); diff --git a/examples/src/bin/embassy_parl_io_tx.rs b/examples/src/bin/embassy_parl_io_tx.rs index 1698d65e0cb..67f673f622f 100644 --- a/examples/src/bin/embassy_parl_io_tx.rs +++ b/examples/src/bin/embassy_parl_io_tx.rs @@ -33,6 +33,7 @@ use esp_hal::{ }, peripherals::Peripherals, prelude::*, + system::SystemControl, timer::TimerGroup, }; use esp_println::println; @@ -41,7 +42,7 @@ use esp_println::println; async fn main(_spawner: Spawner) { esp_println::println!("Init!"); let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let timg0 = TimerGroup::new_async(peripherals.TIMG0, &clocks); diff --git a/examples/src/bin/embassy_rmt_rx.rs b/examples/src/bin/embassy_rmt_rx.rs index 8eb40c8feec..d3d2378f868 100644 --- a/examples/src/bin/embassy_rmt_rx.rs +++ b/examples/src/bin/embassy_rmt_rx.rs @@ -18,6 +18,7 @@ use esp_hal::{ peripherals::Peripherals, prelude::*, rmt::{asynch::RxChannelAsync, PulseCode, Rmt, RxChannelConfig, RxChannelCreatorAsync}, + system::SystemControl, }; use esp_println::{print, println}; @@ -41,7 +42,7 @@ async fn signal_task(mut pin: Gpio5>) { async fn main(spawner: Spawner) { println!("Init!"); let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let timer_group0 = esp_hal::timer::TimerGroup::new_async(peripherals.TIMG0, &clocks); diff --git a/examples/src/bin/embassy_rmt_tx.rs b/examples/src/bin/embassy_rmt_tx.rs index b5699f68c42..f002ac9f93b 100644 --- a/examples/src/bin/embassy_rmt_tx.rs +++ b/examples/src/bin/embassy_rmt_tx.rs @@ -19,6 +19,7 @@ use esp_hal::{ peripherals::Peripherals, prelude::*, rmt::{asynch::TxChannelAsync, PulseCode, Rmt, TxChannelConfig, TxChannelCreatorAsync}, + system::SystemControl, timer::TimerGroup, }; use esp_println::println; @@ -27,7 +28,7 @@ use esp_println::println; async fn main(_spawner: Spawner) { println!("Init!"); let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let timg0 = TimerGroup::new_async(peripherals.TIMG0, &clocks); diff --git a/examples/src/bin/embassy_serial.rs b/examples/src/bin/embassy_serial.rs index 87f8fae1f3f..0b0b80a8d5a 100644 --- a/examples/src/bin/embassy_serial.rs +++ b/examples/src/bin/embassy_serial.rs @@ -18,6 +18,7 @@ use esp_hal::{ embassy, peripherals::{Peripherals, UART0}, prelude::*, + system::SystemControl, timer::TimerGroup, uart::{config::AtCmdConfig, Uart, UartRx, UartTx}, Async, @@ -77,7 +78,7 @@ async fn reader( async fn main(spawner: Spawner) { esp_println::println!("Init!"); let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let timg0 = TimerGroup::new_async(peripherals.TIMG0, &clocks); diff --git a/examples/src/bin/embassy_spi.rs b/examples/src/bin/embassy_spi.rs index 4a1ecf374ac..bca2a4a9daa 100644 --- a/examples/src/bin/embassy_spi.rs +++ b/examples/src/bin/embassy_spi.rs @@ -36,6 +36,7 @@ use esp_hal::{ master::{prelude::*, Spi}, SpiMode, }, + system::SystemControl, timer::TimerGroup, }; @@ -43,7 +44,7 @@ use esp_hal::{ async fn main(_spawner: Spawner) { esp_println::println!("Init!"); let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let timg0 = TimerGroup::new_async(peripherals.TIMG0, &clocks); diff --git a/examples/src/bin/embassy_systimer_delay.rs b/examples/src/bin/embassy_systimer_delay.rs index c9dfc7e2be0..2bbf9c2d871 100644 --- a/examples/src/bin/embassy_systimer_delay.rs +++ b/examples/src/bin/embassy_systimer_delay.rs @@ -17,6 +17,7 @@ use esp_hal::{ embassy, peripherals::Peripherals, prelude::*, + system::SystemControl, systimer::SystemTimer, timer::TimerGroup, }; @@ -25,7 +26,7 @@ use esp_hal::{ async fn main(_spawner: Spawner) { esp_println::println!("Init!"); let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let timg0 = TimerGroup::new_async(peripherals.TIMG0, &clocks); diff --git a/examples/src/bin/embassy_twai.rs b/examples/src/bin/embassy_twai.rs index 7f025472493..8c460b62372 100644 --- a/examples/src/bin/embassy_twai.rs +++ b/examples/src/bin/embassy_twai.rs @@ -28,6 +28,7 @@ use esp_hal::{ interrupt, peripherals::{self, Peripherals, TWAI0}, prelude::*, + system::SystemControl, timer::TimerGroup, twai::{self, EspTwaiFrame, TwaiRx, TwaiTx}, }; @@ -83,7 +84,7 @@ async fn transmitter( #[main] async fn main(spawner: Spawner) { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let timg0 = TimerGroup::new_async(peripherals.TIMG0, &clocks); diff --git a/examples/src/bin/embassy_usb_serial_jtag.rs b/examples/src/bin/embassy_usb_serial_jtag.rs index d89171708ad..05223a90236 100644 --- a/examples/src/bin/embassy_usb_serial_jtag.rs +++ b/examples/src/bin/embassy_usb_serial_jtag.rs @@ -17,6 +17,7 @@ use esp_hal::{ embassy, peripherals::Peripherals, prelude::*, + system::SystemControl, timer::TimerGroup, usb_serial_jtag::{UsbSerialJtag, UsbSerialJtagRx, UsbSerialJtagTx}, Async, @@ -68,7 +69,7 @@ async fn reader( async fn main(spawner: Spawner) -> () { esp_println::println!("Init!"); let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); embassy::init(&clocks, TimerGroup::new_async(peripherals.TIMG0, &clocks)); diff --git a/examples/src/bin/embassy_wait.rs b/examples/src/bin/embassy_wait.rs index 76b9e356221..649eaec66e0 100644 --- a/examples/src/bin/embassy_wait.rs +++ b/examples/src/bin/embassy_wait.rs @@ -18,6 +18,7 @@ use esp_hal::{ gpio::Io, peripherals::Peripherals, prelude::*, + system::SystemControl, timer::TimerGroup, }; @@ -25,7 +26,7 @@ use esp_hal::{ async fn main(_spawner: Spawner) { esp_println::println!("Init!"); let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let timg0 = TimerGroup::new_async(peripherals.TIMG0, &clocks); diff --git a/examples/src/bin/etm_timer.rs b/examples/src/bin/etm_timer.rs index 371db9a3337..a6698378156 100644 --- a/examples/src/bin/etm_timer.rs +++ b/examples/src/bin/etm_timer.rs @@ -16,6 +16,7 @@ use esp_hal::{ etm::Etm, peripherals::{Peripherals, TIMG0}, prelude::*, + system::SystemControl, timer::{ etm::{TimerEtmEvents, TimerEtmTasks}, Timer, @@ -31,7 +32,7 @@ static TIMER0: Mutex, esp_hal::Blocking>>>> = #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let timg0 = TimerGroup::new( diff --git a/examples/src/bin/gpio_interrupt.rs b/examples/src/bin/gpio_interrupt.rs index efcae4257b3..3d2300216a7 100644 --- a/examples/src/bin/gpio_interrupt.rs +++ b/examples/src/bin/gpio_interrupt.rs @@ -19,6 +19,7 @@ use esp_hal::{ macros::ram, peripherals::Peripherals, prelude::*, + system::SystemControl, }; #[cfg(any(feature = "esp32", feature = "esp32s2", feature = "esp32s3"))] @@ -31,7 +32,7 @@ static BUTTON: Mutex>>>> = #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); // Set GPIO2 as an output, and set its state high initially. diff --git a/examples/src/bin/hello_rgb.rs b/examples/src/bin/hello_rgb.rs index a7cbdeaf9dc..db3e019c6f9 100644 --- a/examples/src/bin/hello_rgb.rs +++ b/examples/src/bin/hello_rgb.rs @@ -21,6 +21,7 @@ use esp_hal::{ peripherals::Peripherals, prelude::*, rmt::Rmt, + system::SystemControl, }; use esp_hal_smartled::{smartLedBuffer, SmartLedsAdapter}; use smart_leds::{ @@ -33,7 +34,7 @@ use smart_leds::{ #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/examples/src/bin/hello_world.rs b/examples/src/bin/hello_world.rs index 054006ce520..a7e5653de50 100644 --- a/examples/src/bin/hello_world.rs +++ b/examples/src/bin/hello_world.rs @@ -20,13 +20,14 @@ use esp_hal::{ delay::Delay, peripherals::Peripherals, prelude::*, + system::SystemControl, uart::Uart, }; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let delay = Delay::new(&clocks); diff --git a/examples/src/bin/hmac.rs b/examples/src/bin/hmac.rs index 1297337b9e2..f518833cdcd 100644 --- a/examples/src/bin/hmac.rs +++ b/examples/src/bin/hmac.rs @@ -64,6 +64,7 @@ use esp_hal::{ peripherals::Peripherals, prelude::*, rng::Rng, + system::SystemControl, systimer::SystemTimer, }; use esp_println::println; @@ -76,7 +77,7 @@ type HmacSha256 = HmacSw; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let _clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let mut rng = Rng::new(peripherals.RNG); diff --git a/examples/src/bin/i2c_bmp180_calibration_data.rs b/examples/src/bin/i2c_bmp180_calibration_data.rs index 955bab4212e..51e2d142851 100644 --- a/examples/src/bin/i2c_bmp180_calibration_data.rs +++ b/examples/src/bin/i2c_bmp180_calibration_data.rs @@ -12,13 +12,20 @@ #![no_main] use esp_backtrace as _; -use esp_hal::{clock::ClockControl, gpio::Io, i2c::I2C, peripherals::Peripherals, prelude::*}; +use esp_hal::{ + clock::ClockControl, + gpio::Io, + i2c::I2C, + peripherals::Peripherals, + prelude::*, + system::SystemControl, +}; use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/examples/src/bin/i2c_display.rs b/examples/src/bin/i2c_display.rs index d00880c2165..5a56c07b490 100644 --- a/examples/src/bin/i2c_display.rs +++ b/examples/src/bin/i2c_display.rs @@ -30,13 +30,14 @@ use esp_hal::{ i2c::I2C, peripherals::Peripherals, prelude::*, + system::SystemControl, }; use ssd1306::{prelude::*, I2CDisplayInterface, Ssd1306}; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let delay = Delay::new(&clocks); diff --git a/examples/src/bin/i2s_read.rs b/examples/src/bin/i2s_read.rs index 5e28866a6ce..d823e902538 100644 --- a/examples/src/bin/i2s_read.rs +++ b/examples/src/bin/i2s_read.rs @@ -25,13 +25,14 @@ use esp_hal::{ i2s::{DataFormat, I2s, I2sReadDma, Standard}, peripherals::Peripherals, prelude::*, + system::SystemControl, }; use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/examples/src/bin/i2s_sound.rs b/examples/src/bin/i2s_sound.rs index d7f61970540..f4f87c884e6 100644 --- a/examples/src/bin/i2s_sound.rs +++ b/examples/src/bin/i2s_sound.rs @@ -40,6 +40,7 @@ use esp_hal::{ i2s::{DataFormat, I2s, I2sWriteDma, Standard}, peripherals::Peripherals, prelude::*, + system::SystemControl, }; const SINE: [i16; 64] = [ @@ -53,7 +54,7 @@ const SINE: [i16; 64] = [ #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/examples/src/bin/interrupt_preemption.rs b/examples/src/bin/interrupt_preemption.rs index f7d2c3d5cb1..a96d9aad248 100644 --- a/examples/src/bin/interrupt_preemption.rs +++ b/examples/src/bin/interrupt_preemption.rs @@ -13,7 +13,11 @@ use core::cell::RefCell; use critical_section::Mutex; use esp_backtrace as _; -use esp_hal::{peripherals::Peripherals, prelude::*, system::SoftwareInterrupt}; +use esp_hal::{ + peripherals::Peripherals, + prelude::*, + system::{SoftwareInterrupt, SystemControl}, +}; static SWINT0: Mutex>>> = Mutex::new(RefCell::new(None)); static SWINT1: Mutex>>> = Mutex::new(RefCell::new(None)); @@ -23,7 +27,7 @@ static SWINT3: Mutex>>> = Mutex::new(RefCell #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let mut sw_int = system.software_interrupt_control; critical_section::with(|cs| { diff --git a/examples/src/bin/lcd_i8080.rs b/examples/src/bin/lcd_i8080.rs index 530da4eb71f..d54ee4e58c5 100644 --- a/examples/src/bin/lcd_i8080.rs +++ b/examples/src/bin/lcd_i8080.rs @@ -35,13 +35,14 @@ use esp_hal::{ }, peripherals::Peripherals, prelude::*, + system::SystemControl, }; use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/examples/src/bin/ledc.rs b/examples/src/bin/ledc.rs index 9994527fddf..42d0b2e2527 100644 --- a/examples/src/bin/ledc.rs +++ b/examples/src/bin/ledc.rs @@ -21,12 +21,13 @@ use esp_hal::{ }, peripherals::Peripherals, prelude::*, + system::SystemControl, }; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/examples/src/bin/lp_core_uart.rs b/examples/src/bin/lp_core_uart.rs index 060cdfccc2f..04f2c2fbbc3 100644 --- a/examples/src/bin/lp_core_uart.rs +++ b/examples/src/bin/lp_core_uart.rs @@ -17,6 +17,7 @@ use esp_hal::{ lp_core::{LpCore, LpCoreWakeupSource}, peripherals::Peripherals, prelude::*, + system::SystemControl, uart::{config::Config, lp_uart::LpUart, TxRxPins, Uart}, }; use esp_println::println; @@ -24,7 +25,7 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/examples/src/bin/mcpwm.rs b/examples/src/bin/mcpwm.rs index a2c24cccb75..678dc4e544e 100644 --- a/examples/src/bin/mcpwm.rs +++ b/examples/src/bin/mcpwm.rs @@ -15,12 +15,13 @@ use esp_hal::{ mcpwm::{operator::PwmPinConfig, timer::PwmWorkingMode, McPwm, PeripheralClockConfig}, peripherals::Peripherals, prelude::*, + system::SystemControl, }; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/examples/src/bin/multicore.rs b/examples/src/bin/multicore.rs index c76ce426af2..1d028bdc9b9 100644 --- a/examples/src/bin/multicore.rs +++ b/examples/src/bin/multicore.rs @@ -18,6 +18,7 @@ use esp_hal::{ delay::Delay, peripherals::Peripherals, prelude::*, + system::SystemControl, }; use esp_println::println; @@ -26,7 +27,7 @@ static mut APP_CORE_STACK: Stack<8192> = Stack::new(); #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let delay = Delay::new(&clocks); diff --git a/examples/src/bin/parl_io_rx.rs b/examples/src/bin/parl_io_rx.rs index b396e94e12b..ae5203d8e78 100644 --- a/examples/src/bin/parl_io_rx.rs +++ b/examples/src/bin/parl_io_rx.rs @@ -18,13 +18,14 @@ use esp_hal::{ parl_io::{BitPackOrder, NoClkPin, ParlIoRxOnly, RxFourBits}, peripherals::Peripherals, prelude::*, + system::SystemControl, }; use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/examples/src/bin/parl_io_tx.rs b/examples/src/bin/parl_io_tx.rs index 3f5ad34bdf8..7e0d24c0a65 100644 --- a/examples/src/bin/parl_io_tx.rs +++ b/examples/src/bin/parl_io_tx.rs @@ -29,13 +29,14 @@ use esp_hal::{ }, peripherals::Peripherals, prelude::*, + system::SystemControl, }; use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/examples/src/bin/psram.rs b/examples/src/bin/psram.rs index c7ba179c306..47dfc69ceb8 100644 --- a/examples/src/bin/psram.rs +++ b/examples/src/bin/psram.rs @@ -13,7 +13,13 @@ extern crate alloc; use alloc::{string::String, vec::Vec}; use esp_backtrace as _; -use esp_hal::{clock::ClockControl, peripherals::Peripherals, prelude::*, psram}; +use esp_hal::{ + clock::ClockControl, + peripherals::Peripherals, + prelude::*, + psram, + system::SystemControl, +}; use esp_println::println; #[global_allocator] @@ -35,7 +41,7 @@ fn main() -> ! { psram::init_psram(peripherals.PSRAM); init_psram_heap(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let _clocks = ClockControl::max(system.clock_control).freeze(); println!("Going to access PSRAM"); diff --git a/examples/src/bin/qspi_flash.rs b/examples/src/bin/qspi_flash.rs index 3050b3e09b1..e4c96e6f77e 100644 --- a/examples/src/bin/qspi_flash.rs +++ b/examples/src/bin/qspi_flash.rs @@ -41,13 +41,14 @@ use esp_hal::{ SpiDataMode, SpiMode, }, + system::SystemControl, }; use esp_println::{print, println}; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/examples/src/bin/ram.rs b/examples/src/bin/ram.rs index 045e443514d..db406ae5a85 100644 --- a/examples/src/bin/ram.rs +++ b/examples/src/bin/ram.rs @@ -24,6 +24,7 @@ use esp_hal::{ peripherals::Peripherals, prelude::*, rtc_cntl::Rtc, + system::SystemControl, }; use esp_println::println; @@ -39,7 +40,7 @@ static mut SOME_ZEROED_DATA: [u8; 8] = [0; 8]; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let delay = Delay::new(&clocks); diff --git a/examples/src/bin/rmt_rx.rs b/examples/src/bin/rmt_rx.rs index 8a66863c449..07a6d0387e4 100644 --- a/examples/src/bin/rmt_rx.rs +++ b/examples/src/bin/rmt_rx.rs @@ -14,6 +14,7 @@ use esp_hal::{ peripherals::Peripherals, prelude::*, rmt::{PulseCode, Rmt, RxChannel, RxChannelConfig, RxChannelCreator}, + system::SystemControl, }; use esp_println::{print, println}; @@ -22,7 +23,7 @@ const WIDTH: usize = 80; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/examples/src/bin/rmt_tx.rs b/examples/src/bin/rmt_tx.rs index 3f61a578fab..6398eb582bf 100644 --- a/examples/src/bin/rmt_tx.rs +++ b/examples/src/bin/rmt_tx.rs @@ -15,12 +15,13 @@ use esp_hal::{ peripherals::Peripherals, prelude::*, rmt::{PulseCode, Rmt, TxChannel, TxChannelConfig, TxChannelCreator}, + system::SystemControl, }; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/examples/src/bin/rtc_time.rs b/examples/src/bin/rtc_time.rs index 24ad3f7ee3a..61eb101e0af 100644 --- a/examples/src/bin/rtc_time.rs +++ b/examples/src/bin/rtc_time.rs @@ -12,12 +12,13 @@ use esp_hal::{ peripherals::Peripherals, prelude::*, rtc_cntl::Rtc, + system::SystemControl, }; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let rtc = Rtc::new(peripherals.LPWR, None); diff --git a/examples/src/bin/serial_interrupts.rs b/examples/src/bin/serial_interrupts.rs index cc3cdadf033..2a6cce02aab 100644 --- a/examples/src/bin/serial_interrupts.rs +++ b/examples/src/bin/serial_interrupts.rs @@ -17,6 +17,7 @@ use esp_hal::{ gpio, peripherals::{Peripherals, UART0}, prelude::*, + system::SystemControl, uart::{ config::{AtCmdConfig, Config}, TxRxPins, @@ -30,7 +31,7 @@ static SERIAL: Mutex>>> = Mutex::new(RefCel #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let delay = Delay::new(&clocks); diff --git a/examples/src/bin/sleep_timer.rs b/examples/src/bin/sleep_timer.rs index 2c29ce70b3d..ae47dec398f 100644 --- a/examples/src/bin/sleep_timer.rs +++ b/examples/src/bin/sleep_timer.rs @@ -15,6 +15,7 @@ use esp_hal::{ peripherals::Peripherals, prelude::*, rtc_cntl::{get_reset_reason, get_wakeup_cause, sleep::TimerWakeupSource, Rtc, SocResetReason}, + system::SystemControl, Cpu, }; use esp_println::println; @@ -22,7 +23,7 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let mut delay = Delay::new(&clocks); diff --git a/examples/src/bin/sleep_timer_ext0.rs b/examples/src/bin/sleep_timer_ext0.rs index 936d0b49c5d..57f225b5c5c 100644 --- a/examples/src/bin/sleep_timer_ext0.rs +++ b/examples/src/bin/sleep_timer_ext0.rs @@ -22,6 +22,7 @@ use esp_hal::{ Rtc, SocResetReason, }, + system::SystemControl, Cpu, }; use esp_println::println; @@ -29,7 +30,7 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let mut rtc = Rtc::new(peripherals.LPWR, None); diff --git a/examples/src/bin/sleep_timer_ext1.rs b/examples/src/bin/sleep_timer_ext1.rs index e0f10710e38..b400f95e47f 100644 --- a/examples/src/bin/sleep_timer_ext1.rs +++ b/examples/src/bin/sleep_timer_ext1.rs @@ -22,6 +22,7 @@ use esp_hal::{ Rtc, SocResetReason, }, + system::SystemControl, Cpu, }; use esp_println::println; @@ -29,7 +30,7 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let mut rtc = Rtc::new(peripherals.LPWR, None); diff --git a/examples/src/bin/sleep_timer_lpio.rs b/examples/src/bin/sleep_timer_lpio.rs index 0d679498df5..b3e392d919c 100644 --- a/examples/src/bin/sleep_timer_lpio.rs +++ b/examples/src/bin/sleep_timer_lpio.rs @@ -22,6 +22,7 @@ use esp_hal::{ Rtc, SocResetReason, }, + system::SystemControl, Cpu, }; use esp_println::println; @@ -29,7 +30,7 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let mut rtc = Rtc::new(peripherals.LPWR, None); diff --git a/examples/src/bin/sleep_timer_rtcio.rs b/examples/src/bin/sleep_timer_rtcio.rs index 1456914b893..e1e488c49fd 100644 --- a/examples/src/bin/sleep_timer_rtcio.rs +++ b/examples/src/bin/sleep_timer_rtcio.rs @@ -24,6 +24,7 @@ use esp_hal::{ Rtc, SocResetReason, }, + system::SystemControl, Cpu, }; use esp_println::println; @@ -31,7 +32,7 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let mut io = Io::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/examples/src/bin/software_interrupts.rs b/examples/src/bin/software_interrupts.rs index 4c400becf2e..5fa0f5252b9 100644 --- a/examples/src/bin/software_interrupts.rs +++ b/examples/src/bin/software_interrupts.rs @@ -18,7 +18,7 @@ use esp_hal::{ delay::Delay, peripherals::Peripherals, prelude::*, - system::SoftwareInterrupt, + system::{SoftwareInterrupt, SystemControl}, }; static SWINT0: Mutex>>> = Mutex::new(RefCell::new(None)); @@ -29,7 +29,7 @@ static SWINT3: Mutex>>> = Mutex::new(RefCell #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let mut sw_int = system.software_interrupt_control; diff --git a/examples/src/bin/spi_eh1_device_loopback.rs b/examples/src/bin/spi_eh1_device_loopback.rs index a82a115cb1a..614ea5dd0ea 100644 --- a/examples/src/bin/spi_eh1_device_loopback.rs +++ b/examples/src/bin/spi_eh1_device_loopback.rs @@ -41,13 +41,14 @@ use esp_hal::{ peripherals::Peripherals, prelude::*, spi::{master::Spi, SpiMode}, + system::SystemControl, }; use esp_println::{print, println}; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/examples/src/bin/spi_eh1_loopback.rs b/examples/src/bin/spi_eh1_loopback.rs index a41ea7be937..45a4ea71ce7 100644 --- a/examples/src/bin/spi_eh1_loopback.rs +++ b/examples/src/bin/spi_eh1_loopback.rs @@ -28,13 +28,14 @@ use esp_hal::{ peripherals::Peripherals, prelude::*, spi::{master::Spi, SpiMode}, + system::SystemControl, }; use esp_println::{print, println}; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/examples/src/bin/spi_halfduplex_read_manufacturer_id.rs b/examples/src/bin/spi_halfduplex_read_manufacturer_id.rs index 4f61c23a395..b79f0e6643c 100644 --- a/examples/src/bin/spi_halfduplex_read_manufacturer_id.rs +++ b/examples/src/bin/spi_halfduplex_read_manufacturer_id.rs @@ -39,13 +39,14 @@ use esp_hal::{ SpiDataMode, SpiMode, }, + system::SystemControl, }; use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/examples/src/bin/spi_loopback.rs b/examples/src/bin/spi_loopback.rs index 07a02d23208..3a7e870ef06 100644 --- a/examples/src/bin/spi_loopback.rs +++ b/examples/src/bin/spi_loopback.rs @@ -26,13 +26,14 @@ use esp_hal::{ peripherals::Peripherals, prelude::*, spi::{master::Spi, SpiMode}, + system::SystemControl, }; use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/examples/src/bin/spi_loopback_dma.rs b/examples/src/bin/spi_loopback_dma.rs index 56881291bff..e5f55c3fec9 100644 --- a/examples/src/bin/spi_loopback_dma.rs +++ b/examples/src/bin/spi_loopback_dma.rs @@ -31,13 +31,14 @@ use esp_hal::{ master::{prelude::*, Spi}, SpiMode, }, + system::SystemControl, }; use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/examples/src/bin/spi_slave_dma.rs b/examples/src/bin/spi_slave_dma.rs index 7a207fd00d2..c65cabfd918 100644 --- a/examples/src/bin/spi_slave_dma.rs +++ b/examples/src/bin/spi_slave_dma.rs @@ -41,13 +41,14 @@ use esp_hal::{ slave::{prelude::*, Spi}, SpiMode, }, + system::SystemControl, }; use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/examples/src/bin/systimer.rs b/examples/src/bin/systimer.rs index cf6362bddf1..45f241d40ed 100644 --- a/examples/src/bin/systimer.rs +++ b/examples/src/bin/systimer.rs @@ -17,6 +17,7 @@ use esp_hal::{ interrupt::{self, Priority}, peripherals::{Interrupt, Peripherals}, prelude::*, + system::SystemControl, systimer::{Alarm, Periodic, SystemTimer, Target}, Blocking, }; @@ -31,7 +32,7 @@ static ALARM2: Mutex>>> = Mutex::new(R #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let systimer = SystemTimer::new(peripherals.SYSTIMER); diff --git a/examples/src/bin/timer_interrupt.rs b/examples/src/bin/timer_interrupt.rs index 0696c60e818..f3c96497e26 100644 --- a/examples/src/bin/timer_interrupt.rs +++ b/examples/src/bin/timer_interrupt.rs @@ -16,6 +16,7 @@ use esp_hal::{ interrupt::{self, Priority}, peripherals::{Interrupt, Peripherals, TIMG0}, prelude::*, + system::SystemControl, timer::{Timer, Timer0, TimerGroup, TimerInterrupts}, }; @@ -25,7 +26,7 @@ static TIMER0: Mutex, esp_hal::Blocking>>>> = #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let timg0 = TimerGroup::new( diff --git a/examples/src/bin/twai.rs b/examples/src/bin/twai.rs index 9ca7a965969..076ba2b98eb 100644 --- a/examples/src/bin/twai.rs +++ b/examples/src/bin/twai.rs @@ -24,6 +24,7 @@ use esp_hal::{ gpio::Io, peripherals::Peripherals, prelude::*, + system::SystemControl, twai::{self, filter::SingleStandardFilter, EspTwaiFrame, StandardId}, }; use esp_println::println; @@ -32,7 +33,7 @@ use nb::block; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/examples/src/bin/usb_serial_jtag.rs b/examples/src/bin/usb_serial_jtag.rs index 84eb34df939..e7c3c1b4cdd 100644 --- a/examples/src/bin/usb_serial_jtag.rs +++ b/examples/src/bin/usb_serial_jtag.rs @@ -17,6 +17,7 @@ use esp_hal::{ delay::Delay, peripherals::Peripherals, prelude::*, + system::SystemControl, usb_serial_jtag::UsbSerialJtag, Blocking, }; @@ -27,7 +28,7 @@ static USB_SERIAL: Mutex>>> = #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let delay = Delay::new(&clocks); diff --git a/examples/src/bin/watchdog.rs b/examples/src/bin/watchdog.rs index 6595e29cd23..026ee8ce0cf 100644 --- a/examples/src/bin/watchdog.rs +++ b/examples/src/bin/watchdog.rs @@ -14,6 +14,7 @@ use esp_hal::{ delay::Delay, peripherals::Peripherals, prelude::*, + system::SystemControl, timer::TimerGroup, }; use esp_println::println; @@ -21,7 +22,7 @@ use esp_println::println; #[entry] fn main() -> ! { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let delay = Delay::new(&clocks); diff --git a/hil-test/tests/clock_monitor.rs b/hil-test/tests/clock_monitor.rs index f300d129b3b..193fd0155f3 100644 --- a/hil-test/tests/clock_monitor.rs +++ b/hil-test/tests/clock_monitor.rs @@ -7,7 +7,12 @@ use defmt_rtt as _; use esp_backtrace as _; -use esp_hal::{clock::ClockControl, peripherals::Peripherals, prelude::*, rtc_cntl::Rtc}; +use esp_hal::{ + clock::ClockControl, + peripherals::Peripherals, + rtc_cntl::Rtc, + system::SystemControl, +}; struct Context<'a> { rtc: Rtc<'a>, @@ -16,7 +21,7 @@ struct Context<'a> { impl Context<'_> { pub fn init() -> Self { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); ClockControl::boot_defaults(system.clock_control).freeze(); let rtc = Rtc::new(peripherals.LPWR, None); diff --git a/hil-test/tests/gpio.rs b/hil-test/tests/gpio.rs index acec9947c53..64ef997441c 100644 --- a/hil-test/tests/gpio.rs +++ b/hil-test/tests/gpio.rs @@ -19,8 +19,8 @@ use esp_hal::{ gpio::{GpioPin, Input, Io, Output, OutputPin, PullDown, PushPull, Unknown}, macros::handler, peripherals::Peripherals, - system::SystemExt, timer::TimerGroup, + system::SystemControl, }; static COUNTER: Mutex> = Mutex::new(RefCell::new(0)); @@ -36,7 +36,7 @@ struct Context { impl Context { pub fn init() -> Self { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let mut io = Io::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/hil-test/tests/spi_full_duplex.rs b/hil-test/tests/spi_full_duplex.rs index b5a1cc6a4a7..fdbcba5a030 100644 --- a/hil-test/tests/spi_full_duplex.rs +++ b/hil-test/tests/spi_full_duplex.rs @@ -20,6 +20,7 @@ use esp_hal::{ peripherals::Peripherals, prelude::*, spi::{master::Spi, FullDuplexMode, SpiMode}, + system::SystemControl, }; struct Context { @@ -29,7 +30,7 @@ struct Context { impl Context { pub fn init() -> Self { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/hil-test/tests/spi_full_duplex_dma.rs b/hil-test/tests/spi_full_duplex_dma.rs index 82bf64ebba1..3feef3c8fae 100644 --- a/hil-test/tests/spi_full_duplex_dma.rs +++ b/hil-test/tests/spi_full_duplex_dma.rs @@ -26,6 +26,7 @@ use esp_hal::{ master::{prelude::*, Spi}, SpiMode, }, + system::SystemControl, }; #[cfg(test)] @@ -41,7 +42,7 @@ mod tests { const DMA_BUFFER_SIZE: usize = 4; let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); @@ -84,7 +85,7 @@ mod tests { #[timeout(3)] fn test_asymmetric_dma_transfer() { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); @@ -128,7 +129,7 @@ mod tests { const DMA_BUFFER_SIZE: usize = 4096; let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); diff --git a/hil-test/tests/uart.rs b/hil-test/tests/uart.rs index 4ee7cd982cc..658aa398102 100644 --- a/hil-test/tests/uart.rs +++ b/hil-test/tests/uart.rs @@ -17,6 +17,7 @@ use esp_hal::{ gpio::Io, peripherals::{Peripherals, UART0}, prelude::*, + system::SystemControl, uart::{config::Config, TxRxPins, Uart}, Blocking, }; @@ -29,7 +30,7 @@ struct Context { impl Context { pub fn init() -> Self { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); let pins = TxRxPins::new_tx_rx( diff --git a/hil-test/tests/uart_async.rs b/hil-test/tests/uart_async.rs index 4c6bd306b74..fe1eb67524b 100644 --- a/hil-test/tests/uart_async.rs +++ b/hil-test/tests/uart_async.rs @@ -15,9 +15,9 @@ use esp_hal::{ clock::ClockControl, gpio::Io, peripherals::{Peripherals, UART0}, - prelude::*, uart::{config::Config, TxRxPins, Uart, UartRx, UartTx}, Async, + system::SystemControl, }; struct Context { @@ -28,7 +28,7 @@ struct Context { impl Context { pub fn init() -> Self { let peripherals = Peripherals::take(); - let system = peripherals.SYSTEM.split(); + let system = SystemControl::new(peripherals.SYSTEM); let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); let pins = TxRxPins::new_tx_rx(