Derive Builder Lite pattern for HAL configuration, update examples/tests (#2645)
* Derive Builder Lite pattern for `esp_hal::Config` and `WatchdogConfig` * User builder pattern for `esp_hal::Config` in examples/tests * Update `CHANGELOG.md`
This commit is contained in:
parent
9f3476b006
commit
891a12e13f
@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- Configuration structs in the I2C, SPI, and UART drivers now implement the Builder Lite pattern (#2614)
|
- Configuration structs in the I2C, SPI, and UART drivers now implement the Builder Lite pattern (#2614)
|
||||||
- Added `I8080::apply_config`, `DPI::apply_config` and `Camera::apply_config` (#2610)
|
- Added `I8080::apply_config`, `DPI::apply_config` and `Camera::apply_config` (#2610)
|
||||||
- Introduced the `unstable` feature which will be used to restrict stable APIs to a subset of esp-hal. (#2628)
|
- Introduced the `unstable` feature which will be used to restrict stable APIs to a subset of esp-hal. (#2628)
|
||||||
|
- HAL configuration structs now implement the Builder Lite pattern (#2645)
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
|||||||
@ -38,26 +38,8 @@
|
|||||||
//! ```rust, no_run
|
//! ```rust, no_run
|
||||||
#![doc = crate::before_snippet!()]
|
#![doc = crate::before_snippet!()]
|
||||||
//! // Initialize with the highest possible frequency for this chip
|
//! // Initialize with the highest possible frequency for this chip
|
||||||
//! let peripherals = esp_hal::init({
|
//! let config = esp_hal::Config::default().with_cpu_clock(CpuClock::max());
|
||||||
//! let mut config = esp_hal::Config::default();
|
//! let peripherals = esp_hal::init(config);
|
||||||
//! config.cpu_clock = CpuClock::max();
|
|
||||||
//! config
|
|
||||||
//! });
|
|
||||||
//!
|
|
||||||
//! // Initialize with custom clock frequency
|
|
||||||
//! // let peripherals = esp_hal::init({
|
|
||||||
//! // let mut config = esp_hal::Config::default();
|
|
||||||
#![cfg_attr(
|
|
||||||
not(any(esp32c2, esp32h2)),
|
|
||||||
doc = "// config.cpu_clock = CpuClock::Clock160MHz;"
|
|
||||||
)]
|
|
||||||
#![cfg_attr(esp32c2, doc = "// config.cpu_clock = CpuClock::Clock120MHz;")]
|
|
||||||
#![cfg_attr(esp32h2, doc = "// config.cpu_clock = CpuClock::Clock96MHz;")]
|
|
||||||
//! // config
|
|
||||||
//! // });
|
|
||||||
//! //
|
|
||||||
//! // Initialize with default clock frequency for this chip
|
|
||||||
//! // let peripherals = esp_hal::init(esp_hal::Config::default());
|
|
||||||
//! # }
|
//! # }
|
||||||
//! ```
|
//! ```
|
||||||
|
|
||||||
|
|||||||
@ -22,10 +22,10 @@
|
|||||||
//! ### Custom initialization
|
//! ### Custom initialization
|
||||||
//! ```rust, no_run
|
//! ```rust, no_run
|
||||||
#![doc = crate::before_snippet!()]
|
#![doc = crate::before_snippet!()]
|
||||||
//! let mut config = esp_hal::Config::default();
|
//! let config =
|
||||||
//! config.cpu_clock = CpuClock::max();
|
//! esp_hal::Config::default().with_cpu_clock(CpuClock::max()).
|
||||||
//! config.watchdog.rwdt =
|
//! with_watchdog(esp_hal::config::WatchdogConfig::default().
|
||||||
//! esp_hal::config::WatchdogStatus::Enabled(fugit::MicrosDurationU64::millis(1000 as u64));
|
//! with_rwdt(esp_hal::config::WatchdogStatus::Enabled(fugit::MicrosDurationU64::millis(1000u64))));
|
||||||
//! let peripherals = esp_hal::init(config);
|
//! let peripherals = esp_hal::init(config);
|
||||||
//! # }
|
//! # }
|
||||||
//! ```
|
//! ```
|
||||||
@ -42,7 +42,7 @@ pub enum WatchdogStatus {
|
|||||||
|
|
||||||
/// Watchdog configuration.
|
/// Watchdog configuration.
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(Default)]
|
#[derive(Default, procmacros::BuilderLite)]
|
||||||
pub struct WatchdogConfig {
|
pub struct WatchdogConfig {
|
||||||
#[cfg(not(any(esp32, esp32s2)))]
|
#[cfg(not(any(esp32, esp32s2)))]
|
||||||
/// Enable the super watchdog timer, which has a trigger time of slightly
|
/// Enable the super watchdog timer, which has a trigger time of slightly
|
||||||
|
|||||||
@ -75,12 +75,8 @@
|
|||||||
//!
|
//!
|
||||||
//! #[entry]
|
//! #[entry]
|
||||||
//! fn main() -> ! {
|
//! fn main() -> ! {
|
||||||
//! let peripherals = esp_hal::init({
|
//! let config = esp_hal::Config::default().with_cpu_clock(CpuClock::max());
|
||||||
//! let mut config = esp_hal::Config::default();
|
//! let peripherals = esp_hal::init(config);
|
||||||
//! // Configure the CPU to run at the maximum frequency.
|
|
||||||
//! config.cpu_clock = CpuClock::max();
|
|
||||||
//! config
|
|
||||||
//! });
|
|
||||||
//!
|
//!
|
||||||
//! // Set GPIO0 as an output, and set its state high initially.
|
//! // Set GPIO0 as an output, and set its state high initially.
|
||||||
//! let mut led = Output::new(peripherals.GPIO0, Level::High);
|
//! let mut led = Output::new(peripherals.GPIO0, Level::High);
|
||||||
@ -482,7 +478,7 @@ use crate::{
|
|||||||
///
|
///
|
||||||
/// For usage examples, see the [config module documentation](crate::config).
|
/// For usage examples, see the [config module documentation](crate::config).
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(Default)]
|
#[derive(Default, procmacros::BuilderLite)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
/// The CPU clock configuration.
|
/// The CPU clock configuration.
|
||||||
pub cpu_clock: CpuClock,
|
pub cpu_clock: CpuClock,
|
||||||
|
|||||||
@ -31,11 +31,8 @@ const MAC_ADDRESS: [u8; 6] = [0x00, 0x80, 0x41, 0x13, 0x37, 0x42];
|
|||||||
#[entry]
|
#[entry]
|
||||||
fn main() -> ! {
|
fn main() -> ! {
|
||||||
esp_println::logger::init_logger_from_env();
|
esp_println::logger::init_logger_from_env();
|
||||||
let peripherals = esp_hal::init({
|
let config = esp_hal::Config::default().with_cpu_clock(CpuClock::max());
|
||||||
let mut config = esp_hal::Config::default();
|
let peripherals = esp_hal::init(config);
|
||||||
config.cpu_clock = CpuClock::max();
|
|
||||||
config
|
|
||||||
});
|
|
||||||
|
|
||||||
esp_alloc::heap_allocator!(72 * 1024);
|
esp_alloc::heap_allocator!(72 * 1024);
|
||||||
|
|
||||||
|
|||||||
@ -40,11 +40,8 @@ use smoltcp::iface::{SocketSet, SocketStorage};
|
|||||||
#[entry]
|
#[entry]
|
||||||
fn main() -> ! {
|
fn main() -> ! {
|
||||||
esp_println::logger::init_logger_from_env();
|
esp_println::logger::init_logger_from_env();
|
||||||
let peripherals = esp_hal::init({
|
let config = esp_hal::Config::default().with_cpu_clock(CpuClock::max());
|
||||||
let mut config = esp_hal::Config::default();
|
let peripherals = esp_hal::init(config);
|
||||||
config.cpu_clock = CpuClock::max();
|
|
||||||
config
|
|
||||||
});
|
|
||||||
|
|
||||||
esp_alloc::heap_allocator!(72 * 1024);
|
esp_alloc::heap_allocator!(72 * 1024);
|
||||||
|
|
||||||
|
|||||||
@ -46,11 +46,8 @@ const PASSWORD: &str = env!("PASSWORD");
|
|||||||
#[entry]
|
#[entry]
|
||||||
fn main() -> ! {
|
fn main() -> ! {
|
||||||
esp_println::logger::init_logger(log::LevelFilter::Info);
|
esp_println::logger::init_logger(log::LevelFilter::Info);
|
||||||
let peripherals = esp_hal::init({
|
let config = esp_hal::Config::default().with_cpu_clock(CpuClock::max());
|
||||||
let mut config = esp_hal::Config::default();
|
let peripherals = esp_hal::init(config);
|
||||||
config.cpu_clock = CpuClock::max();
|
|
||||||
config
|
|
||||||
});
|
|
||||||
|
|
||||||
esp_alloc::heap_allocator!(72 * 1024);
|
esp_alloc::heap_allocator!(72 * 1024);
|
||||||
|
|
||||||
|
|||||||
@ -57,11 +57,8 @@ const UPLOAD_DOWNLOAD_PORT: u16 = 4323;
|
|||||||
#[entry]
|
#[entry]
|
||||||
fn main() -> ! {
|
fn main() -> ! {
|
||||||
esp_println::logger::init_logger_from_env();
|
esp_println::logger::init_logger_from_env();
|
||||||
let peripherals = esp_hal::init({
|
let config = esp_hal::Config::default().with_cpu_clock(CpuClock::max());
|
||||||
let mut config = esp_hal::Config::default();
|
let peripherals = esp_hal::init(config);
|
||||||
config.cpu_clock = CpuClock::max();
|
|
||||||
config
|
|
||||||
});
|
|
||||||
|
|
||||||
esp_alloc::heap_allocator!(72 * 1024);
|
esp_alloc::heap_allocator!(72 * 1024);
|
||||||
|
|
||||||
|
|||||||
@ -37,11 +37,8 @@ use esp_wifi::{ble::controller::BleConnector, init};
|
|||||||
#[entry]
|
#[entry]
|
||||||
fn main() -> ! {
|
fn main() -> ! {
|
||||||
esp_println::logger::init_logger_from_env();
|
esp_println::logger::init_logger_from_env();
|
||||||
let peripherals = esp_hal::init({
|
let config = esp_hal::Config::default().with_cpu_clock(CpuClock::max());
|
||||||
let mut config = esp_hal::Config::default();
|
let peripherals = esp_hal::init(config);
|
||||||
config.cpu_clock = CpuClock::max();
|
|
||||||
config
|
|
||||||
});
|
|
||||||
|
|
||||||
esp_alloc::heap_allocator!(72 * 1024);
|
esp_alloc::heap_allocator!(72 * 1024);
|
||||||
|
|
||||||
|
|||||||
@ -53,11 +53,8 @@ const PASSWORD: &str = env!("PASSWORD");
|
|||||||
#[entry]
|
#[entry]
|
||||||
fn main() -> ! {
|
fn main() -> ! {
|
||||||
esp_println::logger::init_logger_from_env();
|
esp_println::logger::init_logger_from_env();
|
||||||
let peripherals = esp_hal::init({
|
let config = esp_hal::Config::default().with_cpu_clock(CpuClock::max());
|
||||||
let mut config = esp_hal::Config::default();
|
let peripherals = esp_hal::init(config);
|
||||||
config.cpu_clock = CpuClock::max();
|
|
||||||
config
|
|
||||||
});
|
|
||||||
|
|
||||||
static mut HEAP: core::mem::MaybeUninit<[u8; 72 * 1024]> = core::mem::MaybeUninit::uninit();
|
static mut HEAP: core::mem::MaybeUninit<[u8; 72 * 1024]> = core::mem::MaybeUninit::uninit();
|
||||||
|
|
||||||
|
|||||||
@ -45,11 +45,8 @@ const PASSWORD: &str = env!("PASSWORD");
|
|||||||
#[entry]
|
#[entry]
|
||||||
fn main() -> ! {
|
fn main() -> ! {
|
||||||
esp_println::logger::init_logger_from_env();
|
esp_println::logger::init_logger_from_env();
|
||||||
let peripherals = esp_hal::init({
|
let config = esp_hal::Config::default().with_cpu_clock(CpuClock::max());
|
||||||
let mut config = esp_hal::Config::default();
|
let peripherals = esp_hal::init(config);
|
||||||
config.cpu_clock = CpuClock::max();
|
|
||||||
config
|
|
||||||
});
|
|
||||||
|
|
||||||
esp_alloc::heap_allocator!(72 * 1024);
|
esp_alloc::heap_allocator!(72 * 1024);
|
||||||
|
|
||||||
|
|||||||
@ -47,11 +47,8 @@ const PASSWORD: &str = env!("PASSWORD");
|
|||||||
#[entry]
|
#[entry]
|
||||||
fn main() -> ! {
|
fn main() -> ! {
|
||||||
esp_println::logger::init_logger_from_env();
|
esp_println::logger::init_logger_from_env();
|
||||||
let peripherals = esp_hal::init({
|
let config = esp_hal::Config::default().with_cpu_clock(CpuClock::max());
|
||||||
let mut config = esp_hal::Config::default();
|
let peripherals = esp_hal::init(config);
|
||||||
config.cpu_clock = CpuClock::max();
|
|
||||||
config
|
|
||||||
});
|
|
||||||
|
|
||||||
esp_alloc::heap_allocator!(72 * 1024);
|
esp_alloc::heap_allocator!(72 * 1024);
|
||||||
|
|
||||||
|
|||||||
@ -49,11 +49,8 @@ const PASSWORD: &str = env!("PASSWORD");
|
|||||||
#[entry]
|
#[entry]
|
||||||
fn main() -> ! {
|
fn main() -> ! {
|
||||||
esp_println::logger::init_logger_from_env();
|
esp_println::logger::init_logger_from_env();
|
||||||
let peripherals = esp_hal::init({
|
let config = esp_hal::Config::default().with_cpu_clock(CpuClock::max());
|
||||||
let mut config = esp_hal::Config::default();
|
let peripherals = esp_hal::init(config);
|
||||||
config.cpu_clock = CpuClock::max();
|
|
||||||
config
|
|
||||||
});
|
|
||||||
|
|
||||||
esp_alloc::heap_allocator!(72 * 1024);
|
esp_alloc::heap_allocator!(72 * 1024);
|
||||||
|
|
||||||
|
|||||||
@ -57,11 +57,8 @@ macro_rules! mk_static {
|
|||||||
#[esp_hal_embassy::main]
|
#[esp_hal_embassy::main]
|
||||||
async fn main(spawner: Spawner) -> ! {
|
async fn main(spawner: Spawner) -> ! {
|
||||||
esp_println::logger::init_logger_from_env();
|
esp_println::logger::init_logger_from_env();
|
||||||
let peripherals = esp_hal::init({
|
let config = esp_hal::Config::default().with_cpu_clock(CpuClock::max());
|
||||||
let mut config = esp_hal::Config::default();
|
let peripherals = esp_hal::init(config);
|
||||||
config.cpu_clock = CpuClock::max();
|
|
||||||
config
|
|
||||||
});
|
|
||||||
|
|
||||||
esp_alloc::heap_allocator!(72 * 1024);
|
esp_alloc::heap_allocator!(72 * 1024);
|
||||||
|
|
||||||
|
|||||||
@ -65,11 +65,8 @@ macro_rules! mk_static {
|
|||||||
#[esp_hal_embassy::main]
|
#[esp_hal_embassy::main]
|
||||||
async fn main(spawner: Spawner) -> ! {
|
async fn main(spawner: Spawner) -> ! {
|
||||||
esp_println::logger::init_logger_from_env();
|
esp_println::logger::init_logger_from_env();
|
||||||
let peripherals = esp_hal::init({
|
let config = esp_hal::Config::default().with_cpu_clock(CpuClock::max());
|
||||||
let mut config = esp_hal::Config::default();
|
let peripherals = esp_hal::init(config);
|
||||||
config.cpu_clock = CpuClock::max();
|
|
||||||
config
|
|
||||||
});
|
|
||||||
|
|
||||||
esp_alloc::heap_allocator!(72 * 1024);
|
esp_alloc::heap_allocator!(72 * 1024);
|
||||||
|
|
||||||
|
|||||||
@ -68,11 +68,8 @@ static mut TX_BUFFER: [u8; TX_BUFFER_SIZE] = [0; TX_BUFFER_SIZE];
|
|||||||
#[esp_hal_embassy::main]
|
#[esp_hal_embassy::main]
|
||||||
async fn main(spawner: Spawner) -> ! {
|
async fn main(spawner: Spawner) -> ! {
|
||||||
esp_println::logger::init_logger_from_env();
|
esp_println::logger::init_logger_from_env();
|
||||||
let peripherals = esp_hal::init({
|
let config = esp_hal::Config::default().with_cpu_clock(CpuClock::max());
|
||||||
let mut config = esp_hal::Config::default();
|
let peripherals = esp_hal::init(config);
|
||||||
config.cpu_clock = CpuClock::max();
|
|
||||||
config
|
|
||||||
});
|
|
||||||
|
|
||||||
static mut HEAP: core::mem::MaybeUninit<[u8; 32 * 1024]> = core::mem::MaybeUninit::uninit();
|
static mut HEAP: core::mem::MaybeUninit<[u8; 32 * 1024]> = core::mem::MaybeUninit::uninit();
|
||||||
|
|
||||||
|
|||||||
@ -50,11 +50,8 @@ macro_rules! mk_static {
|
|||||||
#[esp_hal_embassy::main]
|
#[esp_hal_embassy::main]
|
||||||
async fn main(_spawner: Spawner) -> ! {
|
async fn main(_spawner: Spawner) -> ! {
|
||||||
esp_println::logger::init_logger_from_env();
|
esp_println::logger::init_logger_from_env();
|
||||||
let peripherals = esp_hal::init({
|
let config = esp_hal::Config::default().with_cpu_clock(CpuClock::max());
|
||||||
let mut config = esp_hal::Config::default();
|
let peripherals = esp_hal::init(config);
|
||||||
config.cpu_clock = CpuClock::max();
|
|
||||||
config
|
|
||||||
});
|
|
||||||
|
|
||||||
esp_alloc::heap_allocator!(72 * 1024);
|
esp_alloc::heap_allocator!(72 * 1024);
|
||||||
|
|
||||||
|
|||||||
@ -50,11 +50,8 @@ const PASSWORD: &str = env!("PASSWORD");
|
|||||||
#[esp_hal_embassy::main]
|
#[esp_hal_embassy::main]
|
||||||
async fn main(spawner: Spawner) -> ! {
|
async fn main(spawner: Spawner) -> ! {
|
||||||
esp_println::logger::init_logger_from_env();
|
esp_println::logger::init_logger_from_env();
|
||||||
let peripherals = esp_hal::init({
|
let config = esp_hal::Config::default().with_cpu_clock(CpuClock::max());
|
||||||
let mut config = esp_hal::Config::default();
|
let peripherals = esp_hal::init(config);
|
||||||
config.cpu_clock = CpuClock::max();
|
|
||||||
config
|
|
||||||
});
|
|
||||||
|
|
||||||
esp_alloc::heap_allocator!(72 * 1024);
|
esp_alloc::heap_allocator!(72 * 1024);
|
||||||
|
|
||||||
|
|||||||
@ -36,11 +36,8 @@ macro_rules! mk_static {
|
|||||||
#[esp_hal_embassy::main]
|
#[esp_hal_embassy::main]
|
||||||
async fn main(_spawner: Spawner) -> ! {
|
async fn main(_spawner: Spawner) -> ! {
|
||||||
esp_println::logger::init_logger_from_env();
|
esp_println::logger::init_logger_from_env();
|
||||||
let peripherals = esp_hal::init({
|
let config = esp_hal::Config::default().with_cpu_clock(CpuClock::max());
|
||||||
let mut config = esp_hal::Config::default();
|
let peripherals = esp_hal::init(config);
|
||||||
config.cpu_clock = CpuClock::max();
|
|
||||||
config
|
|
||||||
});
|
|
||||||
|
|
||||||
esp_alloc::heap_allocator!(72 * 1024);
|
esp_alloc::heap_allocator!(72 * 1024);
|
||||||
|
|
||||||
|
|||||||
@ -36,11 +36,8 @@ macro_rules! mk_static {
|
|||||||
#[esp_hal_embassy::main]
|
#[esp_hal_embassy::main]
|
||||||
async fn main(spawner: Spawner) -> ! {
|
async fn main(spawner: Spawner) -> ! {
|
||||||
esp_println::logger::init_logger_from_env();
|
esp_println::logger::init_logger_from_env();
|
||||||
let peripherals = esp_hal::init({
|
let config = esp_hal::Config::default().with_cpu_clock(CpuClock::max());
|
||||||
let mut config = esp_hal::Config::default();
|
let peripherals = esp_hal::init(config);
|
||||||
config.cpu_clock = CpuClock::max();
|
|
||||||
config
|
|
||||||
});
|
|
||||||
|
|
||||||
esp_alloc::heap_allocator!(72 * 1024);
|
esp_alloc::heap_allocator!(72 * 1024);
|
||||||
|
|
||||||
|
|||||||
@ -44,11 +44,8 @@ macro_rules! mk_static {
|
|||||||
#[esp_hal_embassy::main]
|
#[esp_hal_embassy::main]
|
||||||
async fn main(_s: Spawner) {
|
async fn main(_s: Spawner) {
|
||||||
esp_println::logger::init_logger_from_env();
|
esp_println::logger::init_logger_from_env();
|
||||||
let peripherals = esp_hal::init({
|
let config = esp_hal::Config::default().with_cpu_clock(CpuClock::max());
|
||||||
let mut config = esp_hal::Config::default();
|
let peripherals = esp_hal::init(config);
|
||||||
config.cpu_clock = CpuClock::max();
|
|
||||||
config
|
|
||||||
});
|
|
||||||
|
|
||||||
esp_alloc::heap_allocator!(72 * 1024);
|
esp_alloc::heap_allocator!(72 * 1024);
|
||||||
|
|
||||||
|
|||||||
@ -25,11 +25,8 @@ use esp_wifi::{
|
|||||||
#[entry]
|
#[entry]
|
||||||
fn main() -> ! {
|
fn main() -> ! {
|
||||||
esp_println::logger::init_logger_from_env();
|
esp_println::logger::init_logger_from_env();
|
||||||
let peripherals = esp_hal::init({
|
let config = esp_hal::Config::default().with_cpu_clock(CpuClock::max());
|
||||||
let mut config = esp_hal::Config::default();
|
let peripherals = esp_hal::init(config);
|
||||||
config.cpu_clock = CpuClock::max();
|
|
||||||
config
|
|
||||||
});
|
|
||||||
|
|
||||||
esp_alloc::heap_allocator!(72 * 1024);
|
esp_alloc::heap_allocator!(72 * 1024);
|
||||||
|
|
||||||
|
|||||||
@ -29,11 +29,8 @@ static KNOWN_SSIDS: Mutex<RefCell<BTreeSet<String>>> = Mutex::new(RefCell::new(B
|
|||||||
#[entry]
|
#[entry]
|
||||||
fn main() -> ! {
|
fn main() -> ! {
|
||||||
esp_println::logger::init_logger_from_env();
|
esp_println::logger::init_logger_from_env();
|
||||||
let peripherals = esp_hal::init({
|
let config = esp_hal::Config::default().with_cpu_clock(CpuClock::max());
|
||||||
let mut config = esp_hal::Config::default();
|
let peripherals = esp_hal::init(config);
|
||||||
config.cpu_clock = CpuClock::max();
|
|
||||||
config
|
|
||||||
});
|
|
||||||
|
|
||||||
esp_alloc::heap_allocator!(72 * 1024);
|
esp_alloc::heap_allocator!(72 * 1024);
|
||||||
|
|
||||||
|
|||||||
@ -45,11 +45,8 @@ const GATEWAY_IP: &str = env!("GATEWAY_IP");
|
|||||||
#[entry]
|
#[entry]
|
||||||
fn main() -> ! {
|
fn main() -> ! {
|
||||||
esp_println::logger::init_logger_from_env();
|
esp_println::logger::init_logger_from_env();
|
||||||
let peripherals = esp_hal::init({
|
let config = esp_hal::Config::default().with_cpu_clock(CpuClock::max());
|
||||||
let mut config = esp_hal::Config::default();
|
let peripherals = esp_hal::init(config);
|
||||||
config.cpu_clock = CpuClock::max();
|
|
||||||
config
|
|
||||||
});
|
|
||||||
|
|
||||||
esp_alloc::heap_allocator!(72 * 1024);
|
esp_alloc::heap_allocator!(72 * 1024);
|
||||||
|
|
||||||
|
|||||||
@ -22,11 +22,8 @@ mod tests {
|
|||||||
|
|
||||||
#[init]
|
#[init]
|
||||||
fn init() -> Context<'static> {
|
fn init() -> Context<'static> {
|
||||||
let peripherals = esp_hal::init({
|
let config = esp_hal::Config::default().with_cpu_clock(CpuClock::max());
|
||||||
let mut config = esp_hal::Config::default();
|
let peripherals = esp_hal::init(config);
|
||||||
config.cpu_clock = CpuClock::max();
|
|
||||||
config
|
|
||||||
});
|
|
||||||
let aes = Aes::new(peripherals.AES);
|
let aes = Aes::new(peripherals.AES);
|
||||||
|
|
||||||
Context { aes }
|
Context { aes }
|
||||||
|
|||||||
@ -54,11 +54,8 @@ mod tests {
|
|||||||
|
|
||||||
#[init]
|
#[init]
|
||||||
fn init() -> Context<'static> {
|
fn init() -> Context<'static> {
|
||||||
let peripherals = esp_hal::init({
|
let config = esp_hal::Config::default().with_cpu_clock(CpuClock::max());
|
||||||
let mut config = esp_hal::Config::default();
|
let peripherals = esp_hal::init(config);
|
||||||
config.cpu_clock = CpuClock::max();
|
|
||||||
config
|
|
||||||
});
|
|
||||||
|
|
||||||
let ecc = Ecc::new(peripherals.ECC);
|
let ecc = Ecc::new(peripherals.ECC);
|
||||||
let rng = Rng::new(peripherals.RNG);
|
let rng = Rng::new(peripherals.RNG);
|
||||||
|
|||||||
@ -58,11 +58,8 @@ mod tests {
|
|||||||
fn test_init() -> Peripherals {
|
fn test_init() -> Peripherals {
|
||||||
esp_alloc::heap_allocator!(72 * 1024);
|
esp_alloc::heap_allocator!(72 * 1024);
|
||||||
|
|
||||||
esp_hal::init({
|
let config = esp_hal::Config::default().with_cpu_clock(CpuClock::max());
|
||||||
let mut config = esp_hal::Config::default();
|
esp_hal::init(config)
|
||||||
config.cpu_clock = CpuClock::max();
|
|
||||||
config
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@ -64,11 +64,8 @@ mod tests {
|
|||||||
|
|
||||||
#[init]
|
#[init]
|
||||||
fn init() -> Context {
|
fn init() -> Context {
|
||||||
let peripherals = esp_hal::init({
|
let config = esp_hal::Config::default().with_cpu_clock(CpuClock::max());
|
||||||
let mut config = esp_hal::Config::default();
|
let peripherals = esp_hal::init(config);
|
||||||
config.cpu_clock = CpuClock::max();
|
|
||||||
config
|
|
||||||
});
|
|
||||||
let sw_ints = SoftwareInterruptControl::new(peripherals.SW_INTERRUPT);
|
let sw_ints = SoftwareInterruptControl::new(peripherals.SW_INTERRUPT);
|
||||||
|
|
||||||
cfg_if::cfg_if! {
|
cfg_if::cfg_if! {
|
||||||
|
|||||||
@ -169,8 +169,7 @@ mod tests {
|
|||||||
// FIXME: max speed fails...?
|
// FIXME: max speed fails...?
|
||||||
let config = esp_hal::Config::default();
|
let config = esp_hal::Config::default();
|
||||||
} else {
|
} else {
|
||||||
let mut config = esp_hal::Config::default();
|
let config = esp_hal::Config::default().with_cpu_clock(CpuClock::max());
|
||||||
config.cpu_clock = CpuClock::max();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -55,11 +55,8 @@ static TASK1: TaskStorage<Task1> = TaskStorage::new();
|
|||||||
|
|
||||||
#[esp_hal_embassy::main]
|
#[esp_hal_embassy::main]
|
||||||
async fn main(spawner: Spawner) {
|
async fn main(spawner: Spawner) {
|
||||||
let peripherals = esp_hal::init({
|
let config = esp_hal::Config::default().with_cpu_clock(CpuClock::max());
|
||||||
let mut config = esp_hal::Config::default();
|
let peripherals = esp_hal::init(config);
|
||||||
config.cpu_clock = CLOCK;
|
|
||||||
config
|
|
||||||
});
|
|
||||||
let systimer = SystemTimer::new(peripherals.SYSTIMER);
|
let systimer = SystemTimer::new(peripherals.SYSTIMER);
|
||||||
esp_hal_embassy::init(systimer.alarm0);
|
esp_hal_embassy::init(systimer.alarm0);
|
||||||
println!("Embassy initialized!");
|
println!("Embassy initialized!");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user