diff options
| author | everdrone <[email protected]> | 2025-11-11 15:48:56 +0100 |
|---|---|---|
| committer | everdrone <[email protected]> | 2025-11-11 15:48:56 +0100 |
| commit | cede7216861a82b0db55f5a88afb3acf2ace6c4b (patch) | |
| tree | d92fb578897c77f51317318c5b180931b7b25c63 /tests | |
| parent | cf55b39f9a54cf3ed01f52c0565a36a444174235 (diff) | |
| parent | 3d1f09597335d3681699ba09a77da4b39ed984fd (diff) | |
Merge branch main into n6
Diffstat (limited to 'tests')
36 files changed, 107 insertions, 78 deletions
diff --git a/tests/mspm0/Cargo.toml b/tests/mspm0/Cargo.toml index 227d898d5..df52b538d 100644 --- a/tests/mspm0/Cargo.toml +++ b/tests/mspm0/Cargo.toml | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | [package] | 1 | [package] |
| 2 | edition = "2021" | 2 | edition = "2024" |
| 3 | name = "embassy-mspm0-tests" | 3 | name = "embassy-mspm0-tests" |
| 4 | version = "0.1.0" | 4 | version = "0.1.0" |
| 5 | license = "MIT OR Apache-2.0" | 5 | license = "MIT OR Apache-2.0" |
diff --git a/tests/mspm0/src/bin/dma.rs b/tests/mspm0/src/bin/dma.rs index 6fd973a18..9c56acadc 100644 --- a/tests/mspm0/src/bin/dma.rs +++ b/tests/mspm0/src/bin/dma.rs | |||
| @@ -11,8 +11,8 @@ use core::slice; | |||
| 11 | 11 | ||
| 12 | use defmt::{assert, assert_eq, *}; | 12 | use defmt::{assert, assert_eq, *}; |
| 13 | use embassy_executor::Spawner; | 13 | use embassy_executor::Spawner; |
| 14 | use embassy_mspm0::dma::{Channel, Transfer, TransferMode, TransferOptions, Word}; | ||
| 15 | use embassy_mspm0::Peri; | 14 | use embassy_mspm0::Peri; |
| 15 | use embassy_mspm0::dma::{Channel, Transfer, TransferMode, TransferOptions, Word}; | ||
| 16 | use {defmt_rtt as _, panic_probe as _}; | 16 | use {defmt_rtt as _, panic_probe as _}; |
| 17 | 17 | ||
| 18 | #[embassy_executor::main] | 18 | #[embassy_executor::main] |
diff --git a/tests/nrf/.cargo/config.toml b/tests/nrf/.cargo/config.toml index 8f9bccbc0..0192c10ae 100644 --- a/tests/nrf/.cargo/config.toml +++ b/tests/nrf/.cargo/config.toml | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | [target.'cfg(all(target_arch = "arm", target_os = "none"))'] | 1 | [target.'cfg(all(target_arch = "arm", target_os = "none"))'] |
| 2 | #runner = "teleprobe local run --chip nRF52840_xxAA --elf" | 2 | runner = "teleprobe local run --chip nRF52840_xxAA --elf" |
| 3 | runner = "teleprobe client run" | 3 | #runner = "teleprobe client run" |
| 4 | 4 | ||
| 5 | [build] | 5 | [build] |
| 6 | #target = "thumbv6m-none-eabi" | 6 | #target = "thumbv6m-none-eabi" |
diff --git a/tests/nrf/Cargo.toml b/tests/nrf/Cargo.toml index efc297ccf..3a9b86cef 100644 --- a/tests/nrf/Cargo.toml +++ b/tests/nrf/Cargo.toml | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | [package] | 1 | [package] |
| 2 | edition = "2021" | 2 | edition = "2024" |
| 3 | name = "embassy-nrf-examples" | 3 | name = "embassy-nrf-examples" |
| 4 | version = "0.1.0" | 4 | version = "0.1.0" |
| 5 | license = "MIT OR Apache-2.0" | 5 | license = "MIT OR Apache-2.0" |
| @@ -12,7 +12,7 @@ embassy-futures = { version = "0.1.2", path = "../../embassy-futures" } | |||
| 12 | embassy-sync = { version = "0.7.2", path = "../../embassy-sync", features = ["defmt", ] } | 12 | embassy-sync = { version = "0.7.2", path = "../../embassy-sync", features = ["defmt", ] } |
| 13 | embassy-executor = { version = "0.9.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt"] } | 13 | embassy-executor = { version = "0.9.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt"] } |
| 14 | embassy-time = { version = "0.5.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] } | 14 | embassy-time = { version = "0.5.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] } |
| 15 | embassy-nrf = { version = "0.7.0", path = "../../embassy-nrf", features = ["defmt", "time-driver-rtc1", "gpiote", "unstable-pac"] } | 15 | embassy-nrf = { version = "0.8.0", path = "../../embassy-nrf", features = ["defmt", "time-driver-rtc1", "gpiote", "unstable-pac"] } |
| 16 | embedded-io-async = { version = "0.6.1", features = ["defmt-03"] } | 16 | embedded-io-async = { version = "0.6.1", features = ["defmt-03"] } |
| 17 | embassy-net = { version = "0.7.1", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", ] } | 17 | embassy-net = { version = "0.7.1", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", ] } |
| 18 | embassy-net-esp-hosted = { version = "0.2.1", path = "../../embassy-net-esp-hosted", features = ["defmt"] } | 18 | embassy-net-esp-hosted = { version = "0.2.1", path = "../../embassy-net-esp-hosted", features = ["defmt"] } |
diff --git a/tests/nrf/src/bin/buffered_uart_spam.rs b/tests/nrf/src/bin/buffered_uart_spam.rs index 24ddd06f3..6d862e19d 100644 --- a/tests/nrf/src/bin/buffered_uart_spam.rs +++ b/tests/nrf/src/bin/buffered_uart_spam.rs | |||
| @@ -55,14 +55,14 @@ async fn main(_spawner: Spawner) { | |||
| 55 | static mut TX_BUF: [u8; NSPAM] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; | 55 | static mut TX_BUF: [u8; NSPAM] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; |
| 56 | let _spam = UarteTx::new(peri!(p, UART1), irqs!(UART1), peri!(p, PIN_A), config.clone()); | 56 | let _spam = UarteTx::new(peri!(p, UART1), irqs!(UART1), peri!(p, PIN_A), config.clone()); |
| 57 | let spam_peri = pac::UARTE1; | 57 | let spam_peri = pac::UARTE1; |
| 58 | let event = unsafe { Event::new_unchecked(NonNull::new_unchecked(spam_peri.events_endtx().as_ptr())) }; | 58 | let event = unsafe { Event::new_unchecked(NonNull::new_unchecked(spam_peri.events_dma().tx().end().as_ptr())) }; |
| 59 | let task = unsafe { Task::new_unchecked(NonNull::new_unchecked(spam_peri.tasks_starttx().as_ptr())) }; | 59 | let task = unsafe { Task::new_unchecked(NonNull::new_unchecked(spam_peri.tasks_dma().tx().start().as_ptr())) }; |
| 60 | let mut spam_ppi = Ppi::new_one_to_one(p.PPI_CH2, event, task); | 60 | let mut spam_ppi = Ppi::new_one_to_one(p.PPI_CH2, event, task); |
| 61 | spam_ppi.enable(); | 61 | spam_ppi.enable(); |
| 62 | let p = (&raw mut TX_BUF) as *mut u8; | 62 | let p = (&raw mut TX_BUF) as *mut u8; |
| 63 | spam_peri.txd().ptr().write_value(p as u32); | 63 | spam_peri.dma().tx().ptr().write_value(p as u32); |
| 64 | spam_peri.txd().maxcnt().write(|w| w.set_maxcnt(NSPAM as _)); | 64 | spam_peri.dma().tx().maxcnt().write(|w| w.set_maxcnt(NSPAM as _)); |
| 65 | spam_peri.tasks_starttx().write_value(1); | 65 | spam_peri.tasks_dma().tx().start().write_value(1); |
| 66 | 66 | ||
| 67 | let mut i = 0; | 67 | let mut i = 0; |
| 68 | let mut total = 0; | 68 | let mut total = 0; |
diff --git a/tests/nrf/src/bin/ethernet_enc28j60_perf.rs b/tests/nrf/src/bin/ethernet_enc28j60_perf.rs index 5f3fa1fd3..bd6a2effd 100644 --- a/tests/nrf/src/bin/ethernet_enc28j60_perf.rs +++ b/tests/nrf/src/bin/ethernet_enc28j60_perf.rs | |||
| @@ -22,7 +22,7 @@ bind_interrupts!(struct Irqs { | |||
| 22 | RNG => embassy_nrf::rng::InterruptHandler<peripherals::RNG>; | 22 | RNG => embassy_nrf::rng::InterruptHandler<peripherals::RNG>; |
| 23 | }); | 23 | }); |
| 24 | 24 | ||
| 25 | type MyDriver = Enc28j60<ExclusiveDevice<Spim<'static, peripherals::SPI3>, Output<'static>, Delay>, Output<'static>>; | 25 | type MyDriver = Enc28j60<ExclusiveDevice<Spim<'static>, Output<'static>, Delay>, Output<'static>>; |
| 26 | 26 | ||
| 27 | #[embassy_executor::task] | 27 | #[embassy_executor::task] |
| 28 | async fn net_task(mut runner: embassy_net::Runner<'static, MyDriver>) -> ! { | 28 | async fn net_task(mut runner: embassy_net::Runner<'static, MyDriver>) -> ! { |
diff --git a/tests/nrf/src/bin/wifi_esp_hosted_perf.rs b/tests/nrf/src/bin/wifi_esp_hosted_perf.rs index 34c33a4ad..ac082dbb8 100644 --- a/tests/nrf/src/bin/wifi_esp_hosted_perf.rs +++ b/tests/nrf/src/bin/wifi_esp_hosted_perf.rs | |||
| @@ -29,8 +29,7 @@ const WIFI_PASSWORD: &str = "V8YxhKt5CdIAJFud"; | |||
| 29 | async fn wifi_task( | 29 | async fn wifi_task( |
| 30 | runner: hosted::Runner< | 30 | runner: hosted::Runner< |
| 31 | 'static, | 31 | 'static, |
| 32 | ExclusiveDevice<Spim<'static, peripherals::SPI3>, Output<'static>, Delay>, | 32 | hosted::SpiInterface<ExclusiveDevice<Spim<'static>, Output<'static>, Delay>, Input<'static>>, |
| 33 | Input<'static>, | ||
| 34 | Output<'static>, | 33 | Output<'static>, |
| 35 | >, | 34 | >, |
| 36 | ) -> ! { | 35 | ) -> ! { |
| @@ -64,15 +63,11 @@ async fn main(spawner: Spawner) { | |||
| 64 | let spi = spim::Spim::new(p.SPI3, Irqs, sck, miso, mosi, config); | 63 | let spi = spim::Spim::new(p.SPI3, Irqs, sck, miso, mosi, config); |
| 65 | let spi = ExclusiveDevice::new(spi, cs, Delay); | 64 | let spi = ExclusiveDevice::new(spi, cs, Delay); |
| 66 | 65 | ||
| 66 | let iface = hosted::SpiInterface::new(spi, handshake, ready); | ||
| 67 | |||
| 67 | static STATE: StaticCell<embassy_net_esp_hosted::State> = StaticCell::new(); | 68 | static STATE: StaticCell<embassy_net_esp_hosted::State> = StaticCell::new(); |
| 68 | let (device, mut control, runner) = embassy_net_esp_hosted::new( | 69 | let (device, mut control, runner) = |
| 69 | STATE.init(embassy_net_esp_hosted::State::new()), | 70 | embassy_net_esp_hosted::new(STATE.init(embassy_net_esp_hosted::State::new()), iface, reset).await; |
| 70 | spi, | ||
| 71 | handshake, | ||
| 72 | ready, | ||
| 73 | reset, | ||
| 74 | ) | ||
| 75 | .await; | ||
| 76 | 71 | ||
| 77 | spawner.spawn(unwrap!(wifi_task(runner))); | 72 | spawner.spawn(unwrap!(wifi_task(runner))); |
| 78 | 73 | ||
diff --git a/tests/perf-client/Cargo.toml b/tests/perf-client/Cargo.toml index 581b60d6f..3756046fa 100644 --- a/tests/perf-client/Cargo.toml +++ b/tests/perf-client/Cargo.toml | |||
| @@ -1,7 +1,8 @@ | |||
| 1 | [package] | 1 | [package] |
| 2 | name = "perf-client" | 2 | name = "perf-client" |
| 3 | version = "0.1.0" | 3 | version = "0.1.0" |
| 4 | edition = "2021" | 4 | edition = "2024" |
| 5 | license = "MIT OR Apache-2.0" | ||
| 5 | publish = false | 6 | publish = false |
| 6 | 7 | ||
| 7 | [dependencies] | 8 | [dependencies] |
diff --git a/tests/perf-client/src/lib.rs b/tests/perf-client/src/lib.rs index 4bd9e5674..1ba071e8d 100644 --- a/tests/perf-client/src/lib.rs +++ b/tests/perf-client/src/lib.rs | |||
| @@ -4,7 +4,7 @@ use defmt::{assert, *}; | |||
| 4 | use embassy_futures::join::join; | 4 | use embassy_futures::join::join; |
| 5 | use embassy_net::tcp::TcpSocket; | 5 | use embassy_net::tcp::TcpSocket; |
| 6 | use embassy_net::{Ipv4Address, Stack}; | 6 | use embassy_net::{Ipv4Address, Stack}; |
| 7 | use embassy_time::{with_timeout, Duration, Timer}; | 7 | use embassy_time::{Duration, Timer, with_timeout}; |
| 8 | 8 | ||
| 9 | pub struct Expected { | 9 | pub struct Expected { |
| 10 | pub down_kbps: usize, | 10 | pub down_kbps: usize, |
diff --git a/tests/perf-server/Cargo.toml b/tests/perf-server/Cargo.toml index 22614a33a..72f92ed8d 100644 --- a/tests/perf-server/Cargo.toml +++ b/tests/perf-server/Cargo.toml | |||
| @@ -1,7 +1,8 @@ | |||
| 1 | [package] | 1 | [package] |
| 2 | name = "perf-server" | 2 | name = "perf-server" |
| 3 | version = "0.1.0" | 3 | version = "0.1.0" |
| 4 | edition = "2021" | 4 | edition = "2024" |
| 5 | license = "MIT OR Apache-2.0" | ||
| 5 | publish = false | 6 | publish = false |
| 6 | 7 | ||
| 7 | [dependencies] | 8 | [dependencies] |
diff --git a/tests/riscv32/Cargo.toml b/tests/riscv32/Cargo.toml index c441e8ed3..935c6a2ee 100644 --- a/tests/riscv32/Cargo.toml +++ b/tests/riscv32/Cargo.toml | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | [package] | 1 | [package] |
| 2 | edition = "2021" | 2 | edition = "2024" |
| 3 | name = "embassy-riscv-tests" | 3 | name = "embassy-riscv-tests" |
| 4 | version = "0.1.0" | 4 | version = "0.1.0" |
| 5 | license = "MIT OR Apache-2.0" | 5 | license = "MIT OR Apache-2.0" |
diff --git a/tests/rp/Cargo.toml b/tests/rp/Cargo.toml index 19461520a..640e58f11 100644 --- a/tests/rp/Cargo.toml +++ b/tests/rp/Cargo.toml | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | [package] | 1 | [package] |
| 2 | edition = "2021" | 2 | edition = "2024" |
| 3 | name = "embassy-rp-tests" | 3 | name = "embassy-rp-tests" |
| 4 | version = "0.1.0" | 4 | version = "0.1.0" |
| 5 | license = "MIT OR Apache-2.0" | 5 | license = "MIT OR Apache-2.0" |
diff --git a/tests/rp/src/bin/cyw43-perf.rs b/tests/rp/src/bin/cyw43-perf.rs index 555134ffd..9487f5e1a 100644 --- a/tests/rp/src/bin/cyw43-perf.rs +++ b/tests/rp/src/bin/cyw43-perf.rs | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | teleprobe_meta::target!(b"rpi-pico"); | 3 | teleprobe_meta::target!(b"rpi-pico"); |
| 4 | 4 | ||
| 5 | use cyw43::JoinOptions; | 5 | use cyw43::JoinOptions; |
| 6 | use cyw43_pio::{PioSpi, DEFAULT_CLOCK_DIVIDER}; | 6 | use cyw43_pio::{DEFAULT_CLOCK_DIVIDER, PioSpi}; |
| 7 | use defmt::{panic, *}; | 7 | use defmt::{panic, *}; |
| 8 | use embassy_executor::Spawner; | 8 | use embassy_executor::Spawner; |
| 9 | use embassy_net::{Config, StackResources}; | 9 | use embassy_net::{Config, StackResources}; |
diff --git a/tests/rp/src/bin/gpio_multicore.rs b/tests/rp/src/bin/gpio_multicore.rs index f48dd207b..6abcba590 100644 --- a/tests/rp/src/bin/gpio_multicore.rs +++ b/tests/rp/src/bin/gpio_multicore.rs | |||
| @@ -7,10 +7,10 @@ teleprobe_meta::target!(b"pimoroni-pico-plus-2"); | |||
| 7 | 7 | ||
| 8 | use defmt::{info, unwrap}; | 8 | use defmt::{info, unwrap}; |
| 9 | use embassy_executor::Executor; | 9 | use embassy_executor::Executor; |
| 10 | use embassy_rp::Peri; | ||
| 10 | use embassy_rp::gpio::{Input, Level, Output, Pull}; | 11 | use embassy_rp::gpio::{Input, Level, Output, Pull}; |
| 11 | use embassy_rp::multicore::{spawn_core1, Stack}; | 12 | use embassy_rp::multicore::{Stack, spawn_core1}; |
| 12 | use embassy_rp::peripherals::{PIN_0, PIN_1}; | 13 | use embassy_rp::peripherals::{PIN_0, PIN_1}; |
| 13 | use embassy_rp::Peri; | ||
| 14 | use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; | 14 | use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; |
| 15 | use embassy_sync::channel::Channel; | 15 | use embassy_sync::channel::Channel; |
| 16 | use static_cell::StaticCell; | 16 | use static_cell::StaticCell; |
diff --git a/tests/rp/src/bin/multicore.rs b/tests/rp/src/bin/multicore.rs index 11b03cfea..7e34bc778 100644 --- a/tests/rp/src/bin/multicore.rs +++ b/tests/rp/src/bin/multicore.rs | |||
| @@ -7,7 +7,7 @@ teleprobe_meta::target!(b"pimoroni-pico-plus-2"); | |||
| 7 | 7 | ||
| 8 | use defmt::{info, unwrap}; | 8 | use defmt::{info, unwrap}; |
| 9 | use embassy_executor::Executor; | 9 | use embassy_executor::Executor; |
| 10 | use embassy_rp::multicore::{spawn_core1, Stack}; | 10 | use embassy_rp::multicore::{Stack, spawn_core1}; |
| 11 | use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; | 11 | use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; |
| 12 | use embassy_sync::channel::Channel; | 12 | use embassy_sync::channel::Channel; |
| 13 | use static_cell::StaticCell; | 13 | use static_cell::StaticCell; |
diff --git a/tests/rp/src/bin/overclock.rs b/tests/rp/src/bin/overclock.rs index 167a26eb2..87a03b5e2 100644 --- a/tests/rp/src/bin/overclock.rs +++ b/tests/rp/src/bin/overclock.rs | |||
| @@ -8,7 +8,7 @@ teleprobe_meta::target!(b"pimoroni-pico-plus-2"); | |||
| 8 | 8 | ||
| 9 | use defmt::info; | 9 | use defmt::info; |
| 10 | use embassy_executor::Spawner; | 10 | use embassy_executor::Spawner; |
| 11 | use embassy_rp::clocks::{clk_sys_freq, core_voltage, ClockConfig, CoreVoltage}; | 11 | use embassy_rp::clocks::{ClockConfig, CoreVoltage, clk_sys_freq, core_voltage}; |
| 12 | use embassy_rp::config::Config; | 12 | use embassy_rp::config::Config; |
| 13 | use embassy_time::Instant; | 13 | use embassy_time::Instant; |
| 14 | use {defmt_rtt as _, panic_probe as _}; | 14 | use {defmt_rtt as _, panic_probe as _}; |
diff --git a/tests/rp/src/bin/pio_multi_load.rs b/tests/rp/src/bin/pio_multi_load.rs index aca476d56..82bbab272 100644 --- a/tests/rp/src/bin/pio_multi_load.rs +++ b/tests/rp/src/bin/pio_multi_load.rs | |||
| @@ -57,7 +57,9 @@ async fn main(_spawner: Spawner) { | |||
| 57 | assert_eq!(loaded2.wrap.target, 14); | 57 | assert_eq!(loaded2.wrap.target, 14); |
| 58 | 58 | ||
| 59 | // wrapping around the end of program space automatically works | 59 | // wrapping around the end of program space automatically works |
| 60 | let prg3 = pio_asm!("nop", "nop", "nop", "nop", "nop", "nop", "nop", "nop", "nop", "nop", "nop", "irq 2",); | 60 | let prg3 = pio_asm!( |
| 61 | "nop", "nop", "nop", "nop", "nop", "nop", "nop", "nop", "nop", "nop", "nop", "irq 2", | ||
| 62 | ); | ||
| 61 | let loaded3 = common.load_program(&prg3.program); | 63 | let loaded3 = common.load_program(&prg3.program); |
| 62 | assert_eq!(loaded3.origin, 24); | 64 | assert_eq!(loaded3.origin, 24); |
| 63 | assert_eq!(loaded3.wrap.source, 3); | 65 | assert_eq!(loaded3.wrap.source, 3); |
diff --git a/tests/rp/src/bin/rtc.rs b/tests/rp/src/bin/rtc.rs index c66981d95..e1def7b5b 100644 --- a/tests/rp/src/bin/rtc.rs +++ b/tests/rp/src/bin/rtc.rs | |||
| @@ -5,7 +5,7 @@ teleprobe_meta::target!(b"rpi-pico"); | |||
| 5 | 5 | ||
| 6 | use defmt::{assert, *}; | 6 | use defmt::{assert, *}; |
| 7 | use embassy_executor::Spawner; | 7 | use embassy_executor::Spawner; |
| 8 | use embassy_futures::select::{select, Either}; | 8 | use embassy_futures::select::{Either, select}; |
| 9 | use embassy_rp::bind_interrupts; | 9 | use embassy_rp::bind_interrupts; |
| 10 | use embassy_rp::rtc::{DateTime, DateTimeFilter, DayOfWeek, Rtc}; | 10 | use embassy_rp::rtc::{DateTime, DateTimeFilter, DayOfWeek, Rtc}; |
| 11 | use embassy_time::{Duration, Instant, Timer}; | 11 | use embassy_time::{Duration, Instant, Timer}; |
diff --git a/tests/rp/src/bin/spinlock_mutex_multicore.rs b/tests/rp/src/bin/spinlock_mutex_multicore.rs index c56d43ade..25c4faf37 100644 --- a/tests/rp/src/bin/spinlock_mutex_multicore.rs +++ b/tests/rp/src/bin/spinlock_mutex_multicore.rs | |||
| @@ -7,7 +7,7 @@ teleprobe_meta::target!(b"pimoroni-pico-plus-2"); | |||
| 7 | 7 | ||
| 8 | use defmt::{info, unwrap}; | 8 | use defmt::{info, unwrap}; |
| 9 | use embassy_executor::Executor; | 9 | use embassy_executor::Executor; |
| 10 | use embassy_rp::multicore::{spawn_core1, Stack}; | 10 | use embassy_rp::multicore::{Stack, spawn_core1}; |
| 11 | use embassy_rp::spinlock_mutex::SpinlockRawMutex; | 11 | use embassy_rp::spinlock_mutex::SpinlockRawMutex; |
| 12 | use embassy_sync::channel::Channel; | 12 | use embassy_sync::channel::Channel; |
| 13 | use static_cell::StaticCell; | 13 | use static_cell::StaticCell; |
diff --git a/tests/stm32/Cargo.toml b/tests/stm32/Cargo.toml index 891ec93fd..b92b47be2 100644 --- a/tests/stm32/Cargo.toml +++ b/tests/stm32/Cargo.toml | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | [package] | 1 | [package] |
| 2 | edition = "2021" | 2 | edition = "2024" |
| 3 | name = "embassy-stm32-tests" | 3 | name = "embassy-stm32-tests" |
| 4 | version = "0.1.0" | 4 | version = "0.1.0" |
| 5 | license = "MIT OR Apache-2.0" | 5 | license = "MIT OR Apache-2.0" |
| @@ -73,7 +73,7 @@ teleprobe-meta = "1" | |||
| 73 | embassy-sync = { version = "0.7.2", path = "../../embassy-sync", features = ["defmt"] } | 73 | embassy-sync = { version = "0.7.2", path = "../../embassy-sync", features = ["defmt"] } |
| 74 | embassy-executor = { version = "0.9.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt"] } | 74 | embassy-executor = { version = "0.9.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt"] } |
| 75 | embassy-time = { version = "0.5.0", path = "../../embassy-time", features = ["defmt", "tick-hz-131_072", "defmt-timestamp-uptime"] } | 75 | embassy-time = { version = "0.5.0", path = "../../embassy-time", features = ["defmt", "tick-hz-131_072", "defmt-timestamp-uptime"] } |
| 76 | embassy-stm32 = { version = "0.4.0", path = "../../embassy-stm32", features = [ "defmt", "unstable-pac", "memory-x", "time-driver-any"] } | 76 | embassy-stm32 = { version = "0.4.0", path = "../../embassy-stm32", features = [ "defmt", "unstable-pac", "memory-x", "time-driver-any", "_allow-disable-rtc"] } |
| 77 | embassy-futures = { version = "0.1.2", path = "../../embassy-futures" } | 77 | embassy-futures = { version = "0.1.2", path = "../../embassy-futures" } |
| 78 | embassy-stm32-wpan = { version = "0.1.0", path = "../../embassy-stm32-wpan", optional = true, features = ["defmt", "stm32wb55rg", "ble"] } | 78 | embassy-stm32-wpan = { version = "0.1.0", path = "../../embassy-stm32-wpan", optional = true, features = ["defmt", "stm32wb55rg", "ble"] } |
| 79 | embassy-net = { version = "0.7.1", path = "../../embassy-net", features = ["defmt", "tcp", "udp", "dhcpv4", "medium-ethernet"] } | 79 | embassy-net = { version = "0.7.1", path = "../../embassy-net", features = ["defmt", "tcp", "udp", "dhcpv4", "medium-ethernet"] } |
| @@ -94,6 +94,7 @@ rand_core = { version = "0.9.1", default-features = false } | |||
| 94 | rand_chacha = { version = "0.9.0", default-features = false } | 94 | rand_chacha = { version = "0.9.0", default-features = false } |
| 95 | static_cell = "2" | 95 | static_cell = "2" |
| 96 | portable-atomic = { version = "1.5", features = [] } | 96 | portable-atomic = { version = "1.5", features = [] } |
| 97 | critical-section = "1.1" | ||
| 97 | 98 | ||
| 98 | chrono = { version = "^0.4", default-features = false, optional = true} | 99 | chrono = { version = "^0.4", default-features = false, optional = true} |
| 99 | sha2 = { version = "0.10.8", default-features = false } | 100 | sha2 = { version = "0.10.8", default-features = false } |
diff --git a/tests/stm32/src/bin/afio.rs b/tests/stm32/src/bin/afio.rs index cc44dc59c..d88765717 100644 --- a/tests/stm32/src/bin/afio.rs +++ b/tests/stm32/src/bin/afio.rs | |||
| @@ -12,10 +12,11 @@ use embassy_stm32::time::khz; | |||
| 12 | use embassy_stm32::timer::complementary_pwm::{ComplementaryPwm, ComplementaryPwmPin}; | 12 | use embassy_stm32::timer::complementary_pwm::{ComplementaryPwm, ComplementaryPwmPin}; |
| 13 | use embassy_stm32::timer::input_capture::{CapturePin, InputCapture}; | 13 | use embassy_stm32::timer::input_capture::{CapturePin, InputCapture}; |
| 14 | use embassy_stm32::timer::pwm_input::PwmInput; | 14 | use embassy_stm32::timer::pwm_input::PwmInput; |
| 15 | use embassy_stm32::timer::qei::{Qei, QeiPin}; | 15 | use embassy_stm32::timer::qei::Qei; |
| 16 | use embassy_stm32::timer::simple_pwm::{PwmPin, SimplePwm}; | 16 | use embassy_stm32::timer::simple_pwm::{PwmPin, SimplePwm}; |
| 17 | use embassy_stm32::timer::{Ch1, Ch2}; | ||
| 17 | use embassy_stm32::usart::{Uart, UartRx, UartTx}; | 18 | use embassy_stm32::usart::{Uart, UartRx, UartTx}; |
| 18 | use embassy_stm32::{bind_interrupts, Peripherals}; | 19 | use embassy_stm32::{Peripherals, bind_interrupts}; |
| 19 | 20 | ||
| 20 | #[cfg(not(feature = "afio-connectivity-line"))] | 21 | #[cfg(not(feature = "afio-connectivity-line"))] |
| 21 | bind_interrupts!(struct Irqs { | 22 | bind_interrupts!(struct Irqs { |
| @@ -258,10 +259,11 @@ async fn main(_spawner: Spawner) { | |||
| 258 | { | 259 | { |
| 259 | // partial remap | 260 | // partial remap |
| 260 | reset_afio_registers(); | 261 | reset_afio_registers(); |
| 261 | Qei::new::<AfioRemap<1>>( | 262 | Qei::new::<Ch1, Ch2, AfioRemap<1>>( |
| 262 | p.TIM1.reborrow(), | 263 | p.TIM1.reborrow(), |
| 263 | QeiPin::new(p.PA8.reborrow()), | 264 | p.PA8.reborrow(), |
| 264 | QeiPin::new(p.PA9.reborrow()), | 265 | p.PA9.reborrow(), |
| 266 | Default::default(), | ||
| 265 | ); | 267 | ); |
| 266 | defmt::assert_eq!(AFIO.mapr().read().tim1_remap(), 1); | 268 | defmt::assert_eq!(AFIO.mapr().read().tim1_remap(), 1); |
| 267 | } | 269 | } |
diff --git a/tests/stm32/src/bin/cryp.rs b/tests/stm32/src/bin/cryp.rs index f54c99cc3..640de50e3 100644 --- a/tests/stm32/src/bin/cryp.rs +++ b/tests/stm32/src/bin/cryp.rs | |||
| @@ -5,9 +5,9 @@ | |||
| 5 | #[path = "../common.rs"] | 5 | #[path = "../common.rs"] |
| 6 | mod common; | 6 | mod common; |
| 7 | 7 | ||
| 8 | use aes_gcm::Aes128Gcm; | ||
| 8 | use aes_gcm::aead::heapless::Vec; | 9 | use aes_gcm::aead::heapless::Vec; |
| 9 | use aes_gcm::aead::{AeadInPlace, KeyInit}; | 10 | use aes_gcm::aead::{AeadInPlace, KeyInit}; |
| 10 | use aes_gcm::Aes128Gcm; | ||
| 11 | use common::*; | 11 | use common::*; |
| 12 | use embassy_executor::Spawner; | 12 | use embassy_executor::Spawner; |
| 13 | use embassy_stm32::cryp::{self, *}; | 13 | use embassy_stm32::cryp::{self, *}; |
diff --git a/tests/stm32/src/bin/dac.rs b/tests/stm32/src/bin/dac.rs index d34bbb255..747b11e7f 100644 --- a/tests/stm32/src/bin/dac.rs +++ b/tests/stm32/src/bin/dac.rs | |||
| @@ -10,7 +10,7 @@ use core::f32::consts::PI; | |||
| 10 | use common::*; | 10 | use common::*; |
| 11 | use defmt::assert; | 11 | use defmt::assert; |
| 12 | use embassy_executor::Spawner; | 12 | use embassy_executor::Spawner; |
| 13 | use embassy_stm32::adc::Adc; | 13 | use embassy_stm32::adc::{Adc, SampleTime}; |
| 14 | use embassy_stm32::dac::{DacCh1, Value}; | 14 | use embassy_stm32::dac::{DacCh1, Value}; |
| 15 | use embassy_time::Timer; | 15 | use embassy_time::Timer; |
| 16 | use micromath::F32Ext; | 16 | use micromath::F32Ext; |
| @@ -37,7 +37,7 @@ async fn main(_spawner: Spawner) { | |||
| 37 | dac.set(Value::Bit8(0)); | 37 | dac.set(Value::Bit8(0)); |
| 38 | // Now wait a little to obtain a stable value | 38 | // Now wait a little to obtain a stable value |
| 39 | Timer::after_millis(30).await; | 39 | Timer::after_millis(30).await; |
| 40 | let offset = adc.blocking_read(&mut adc_pin); | 40 | let offset = adc.blocking_read(&mut adc_pin, SampleTime::from_bits(0)); |
| 41 | 41 | ||
| 42 | for v in 0..=255 { | 42 | for v in 0..=255 { |
| 43 | // First set the DAC output value | 43 | // First set the DAC output value |
| @@ -48,7 +48,10 @@ async fn main(_spawner: Spawner) { | |||
| 48 | Timer::after_millis(30).await; | 48 | Timer::after_millis(30).await; |
| 49 | 49 | ||
| 50 | // Need to steal the peripherals here because PA4 is obviously in use already | 50 | // Need to steal the peripherals here because PA4 is obviously in use already |
| 51 | let measured = adc.blocking_read(&mut unsafe { embassy_stm32::Peripherals::steal() }.PA4); | 51 | let measured = adc.blocking_read( |
| 52 | &mut unsafe { embassy_stm32::Peripherals::steal() }.PA4, | ||
| 53 | SampleTime::from_bits(0), | ||
| 54 | ); | ||
| 52 | // Calibrate and normalize the measurement to get close to the dac_output_val | 55 | // Calibrate and normalize the measurement to get close to the dac_output_val |
| 53 | let measured_normalized = ((measured as i32 - offset as i32) / normalization_factor) as i16; | 56 | let measured_normalized = ((measured as i32 - offset as i32) / normalization_factor) as i16; |
| 54 | 57 | ||
diff --git a/tests/stm32/src/bin/dac_l1.rs b/tests/stm32/src/bin/dac_l1.rs index e6400f28e..2fe0cf1f1 100644 --- a/tests/stm32/src/bin/dac_l1.rs +++ b/tests/stm32/src/bin/dac_l1.rs | |||
| @@ -10,7 +10,7 @@ use core::f32::consts::PI; | |||
| 10 | use common::*; | 10 | use common::*; |
| 11 | use defmt::assert; | 11 | use defmt::assert; |
| 12 | use embassy_executor::Spawner; | 12 | use embassy_executor::Spawner; |
| 13 | use embassy_stm32::adc::Adc; | 13 | use embassy_stm32::adc::{Adc, SampleTime}; |
| 14 | use embassy_stm32::dac::{DacCh1, Value}; | 14 | use embassy_stm32::dac::{DacCh1, Value}; |
| 15 | use embassy_stm32::{bind_interrupts, peripherals}; | 15 | use embassy_stm32::{bind_interrupts, peripherals}; |
| 16 | use embassy_time::Timer; | 16 | use embassy_time::Timer; |
| @@ -47,7 +47,7 @@ async fn main(_spawner: Spawner) { | |||
| 47 | dac.set(Value::Bit8(0)); | 47 | dac.set(Value::Bit8(0)); |
| 48 | // Now wait a little to obtain a stable value | 48 | // Now wait a little to obtain a stable value |
| 49 | Timer::after_millis(30).await; | 49 | Timer::after_millis(30).await; |
| 50 | let offset = adc.read(&mut adc_pin).await; | 50 | let offset = adc.read(&mut adc_pin, SampleTime::from_bits(0)).await; |
| 51 | 51 | ||
| 52 | for v in 0..=255 { | 52 | for v in 0..=255 { |
| 53 | // First set the DAC output value | 53 | // First set the DAC output value |
| @@ -58,7 +58,12 @@ async fn main(_spawner: Spawner) { | |||
| 58 | Timer::after_millis(30).await; | 58 | Timer::after_millis(30).await; |
| 59 | 59 | ||
| 60 | // Need to steal the peripherals here because PA4 is obviously in use already | 60 | // Need to steal the peripherals here because PA4 is obviously in use already |
| 61 | let measured = adc.read(&mut unsafe { embassy_stm32::Peripherals::steal() }.PA4).await; | 61 | let measured = adc |
| 62 | .read( | ||
| 63 | &mut unsafe { embassy_stm32::Peripherals::steal() }.PA4, | ||
| 64 | SampleTime::from_bits(0), | ||
| 65 | ) | ||
| 66 | .await; | ||
| 62 | // Calibrate and normalize the measurement to get close to the dac_output_val | 67 | // Calibrate and normalize the measurement to get close to the dac_output_val |
| 63 | let measured_normalized = ((measured as i32 - offset as i32) / normalization_factor) as i16; | 68 | let measured_normalized = ((measured as i32 - offset as i32) / normalization_factor) as i16; |
| 64 | 69 | ||
diff --git a/tests/stm32/src/bin/fdcan.rs b/tests/stm32/src/bin/fdcan.rs index c2a1a7bb8..d97f493df 100644 --- a/tests/stm32/src/bin/fdcan.rs +++ b/tests/stm32/src/bin/fdcan.rs | |||
| @@ -8,7 +8,7 @@ mod common; | |||
| 8 | use common::*; | 8 | use common::*; |
| 9 | use embassy_executor::Spawner; | 9 | use embassy_executor::Spawner; |
| 10 | use embassy_stm32::peripherals::*; | 10 | use embassy_stm32::peripherals::*; |
| 11 | use embassy_stm32::{bind_interrupts, can, Config}; | 11 | use embassy_stm32::{Config, bind_interrupts, can}; |
| 12 | use embassy_time::Duration; | 12 | use embassy_time::Duration; |
| 13 | use {defmt_rtt as _, panic_probe as _}; | 13 | use {defmt_rtt as _, panic_probe as _}; |
| 14 | 14 | ||
diff --git a/tests/stm32/src/bin/rtc.rs b/tests/stm32/src/bin/rtc.rs index 5fe98d807..eb27af4ca 100644 --- a/tests/stm32/src/bin/rtc.rs +++ b/tests/stm32/src/bin/rtc.rs | |||
| @@ -10,13 +10,19 @@ use common::*; | |||
| 10 | use defmt::assert; | 10 | use defmt::assert; |
| 11 | use embassy_executor::Spawner; | 11 | use embassy_executor::Spawner; |
| 12 | use embassy_stm32::rcc::LsConfig; | 12 | use embassy_stm32::rcc::LsConfig; |
| 13 | #[cfg(feature = "stop")] | ||
| 14 | use embassy_stm32::rtc::Rtc; | ||
| 15 | #[cfg(not(feature = "stop"))] | ||
| 13 | use embassy_stm32::rtc::{Rtc, RtcConfig}; | 16 | use embassy_stm32::rtc::{Rtc, RtcConfig}; |
| 14 | use embassy_time::Timer; | 17 | use embassy_time::Timer; |
| 15 | |||
| 16 | #[embassy_executor::main] | 18 | #[embassy_executor::main] |
| 17 | async fn main(_spawner: Spawner) { | 19 | async fn main(_spawner: Spawner) { |
| 18 | let mut config = config(); | 20 | let mut config = config(); |
| 19 | config.rcc.ls = LsConfig::default_lse(); | 21 | config.rcc.ls = LsConfig::default_lse(); |
| 22 | #[cfg(feature = "stop")] | ||
| 23 | { | ||
| 24 | config.rtc._disable_rtc = false; | ||
| 25 | } | ||
| 20 | 26 | ||
| 21 | let p = init_with_config(config); | 27 | let p = init_with_config(config); |
| 22 | info!("Hello World!"); | 28 | info!("Hello World!"); |
| @@ -26,14 +32,25 @@ async fn main(_spawner: Spawner) { | |||
| 26 | .and_hms_opt(10, 30, 15) | 32 | .and_hms_opt(10, 30, 15) |
| 27 | .unwrap(); | 33 | .unwrap(); |
| 28 | 34 | ||
| 29 | let mut rtc = Rtc::new(p.RTC, RtcConfig::default()); | 35 | #[cfg(not(feature = "stop"))] |
| 36 | let (mut rtc, time_provider) = Rtc::new(p.RTC, RtcConfig::default()); | ||
| 37 | |||
| 38 | #[cfg(feature = "stop")] | ||
| 39 | let (rtc, time_provider) = Rtc::new(p.RTC); | ||
| 30 | 40 | ||
| 41 | #[cfg(not(feature = "stop"))] | ||
| 31 | rtc.set_datetime(now.into()).expect("datetime not set"); | 42 | rtc.set_datetime(now.into()).expect("datetime not set"); |
| 32 | 43 | ||
| 44 | #[cfg(feature = "stop")] | ||
| 45 | critical_section::with(|cs| { | ||
| 46 | rtc.borrow_mut(cs).set_datetime(now.into()).expect("datetime not set"); | ||
| 47 | }); | ||
| 48 | |||
| 33 | info!("Waiting 5 seconds"); | 49 | info!("Waiting 5 seconds"); |
| 34 | Timer::after_millis(5000).await; | 50 | Timer::after_millis(5000).await; |
| 35 | 51 | ||
| 36 | let then: NaiveDateTime = rtc.now().unwrap().into(); | 52 | let then: NaiveDateTime = time_provider.now().unwrap().into(); |
| 53 | |||
| 37 | let seconds = (then - now).num_seconds(); | 54 | let seconds = (then - now).num_seconds(); |
| 38 | 55 | ||
| 39 | info!("measured = {}", seconds); | 56 | info!("measured = {}", seconds); |
diff --git a/tests/stm32/src/bin/spi.rs b/tests/stm32/src/bin/spi.rs index e8310866a..cedff772c 100644 --- a/tests/stm32/src/bin/spi.rs +++ b/tests/stm32/src/bin/spi.rs | |||
| @@ -8,6 +8,7 @@ use defmt::assert_eq; | |||
| 8 | use embassy_executor::Spawner; | 8 | use embassy_executor::Spawner; |
| 9 | use embassy_stm32::gpio::{Level, Output, Speed}; | 9 | use embassy_stm32::gpio::{Level, Output, Speed}; |
| 10 | use embassy_stm32::mode::Blocking; | 10 | use embassy_stm32::mode::Blocking; |
| 11 | use embassy_stm32::spi::mode::Master; | ||
| 11 | use embassy_stm32::spi::{self, Spi, Word}; | 12 | use embassy_stm32::spi::{self, Spi, Word}; |
| 12 | use embassy_stm32::time::Hertz; | 13 | use embassy_stm32::time::Hertz; |
| 13 | 14 | ||
| @@ -65,7 +66,7 @@ async fn main(_spawner: Spawner) { | |||
| 65 | cortex_m::asm::bkpt(); | 66 | cortex_m::asm::bkpt(); |
| 66 | } | 67 | } |
| 67 | 68 | ||
| 68 | fn test_txrx<W: Word + From<u8> + defmt::Format + Eq>(spi: &mut Spi<'_, Blocking>) | 69 | fn test_txrx<W: Word + From<u8> + defmt::Format + Eq>(spi: &mut Spi<'_, Blocking, Master>) |
| 69 | where | 70 | where |
| 70 | W: core::ops::Not<Output = W>, | 71 | W: core::ops::Not<Output = W>, |
| 71 | { | 72 | { |
| @@ -109,7 +110,7 @@ where | |||
| 109 | spi.blocking_write::<u8>(&[]).unwrap(); | 110 | spi.blocking_write::<u8>(&[]).unwrap(); |
| 110 | } | 111 | } |
| 111 | 112 | ||
| 112 | fn test_rx<W: Word + From<u8> + defmt::Format + Eq>(spi: &mut Spi<'_, Blocking>, mosi_out: &mut Output<'_>) | 113 | fn test_rx<W: Word + From<u8> + defmt::Format + Eq>(spi: &mut Spi<'_, Blocking, Master>, mosi_out: &mut Output<'_>) |
| 113 | where | 114 | where |
| 114 | W: core::ops::Not<Output = W>, | 115 | W: core::ops::Not<Output = W>, |
| 115 | { | 116 | { |
| @@ -125,7 +126,7 @@ where | |||
| 125 | spi.blocking_read::<u8>(&mut []).unwrap(); | 126 | spi.blocking_read::<u8>(&mut []).unwrap(); |
| 126 | } | 127 | } |
| 127 | 128 | ||
| 128 | fn test_tx<W: Word + From<u8> + defmt::Format + Eq>(spi: &mut Spi<'_, Blocking>) | 129 | fn test_tx<W: Word + From<u8> + defmt::Format + Eq>(spi: &mut Spi<'_, Blocking, Master>) |
| 129 | where | 130 | where |
| 130 | W: core::ops::Not<Output = W>, | 131 | W: core::ops::Not<Output = W>, |
| 131 | { | 132 | { |
diff --git a/tests/stm32/src/bin/spi_dma.rs b/tests/stm32/src/bin/spi_dma.rs index b4fdb8faa..c8cd92401 100644 --- a/tests/stm32/src/bin/spi_dma.rs +++ b/tests/stm32/src/bin/spi_dma.rs | |||
| @@ -8,6 +8,7 @@ use defmt::assert_eq; | |||
| 8 | use embassy_executor::Spawner; | 8 | use embassy_executor::Spawner; |
| 9 | use embassy_stm32::gpio::{Level, Output, Speed}; | 9 | use embassy_stm32::gpio::{Level, Output, Speed}; |
| 10 | use embassy_stm32::mode::Async; | 10 | use embassy_stm32::mode::Async; |
| 11 | use embassy_stm32::spi::mode::Master; | ||
| 11 | use embassy_stm32::spi::{self, Spi, Word}; | 12 | use embassy_stm32::spi::{self, Spi, Word}; |
| 12 | use embassy_stm32::time::Hertz; | 13 | use embassy_stm32::time::Hertz; |
| 13 | 14 | ||
| @@ -78,7 +79,7 @@ async fn main(_spawner: Spawner) { | |||
| 78 | cortex_m::asm::bkpt(); | 79 | cortex_m::asm::bkpt(); |
| 79 | } | 80 | } |
| 80 | 81 | ||
| 81 | async fn test_txrx<W: Word + From<u8> + defmt::Format + Eq>(spi: &mut Spi<'_, Async>) | 82 | async fn test_txrx<W: Word + From<u8> + defmt::Format + Eq>(spi: &mut Spi<'_, Async, Master>) |
| 82 | where | 83 | where |
| 83 | W: core::ops::Not<Output = W>, | 84 | W: core::ops::Not<Output = W>, |
| 84 | { | 85 | { |
| @@ -142,7 +143,7 @@ where | |||
| 142 | spi.write(&buf).await.unwrap(); | 143 | spi.write(&buf).await.unwrap(); |
| 143 | } | 144 | } |
| 144 | 145 | ||
| 145 | async fn test_rx<W: Word + From<u8> + defmt::Format + Eq>(spi: &mut Spi<'_, Async>, mosi_out: &mut Output<'_>) | 146 | async fn test_rx<W: Word + From<u8> + defmt::Format + Eq>(spi: &mut Spi<'_, Async, Master>, mosi_out: &mut Output<'_>) |
| 146 | where | 147 | where |
| 147 | W: core::ops::Not<Output = W>, | 148 | W: core::ops::Not<Output = W>, |
| 148 | { | 149 | { |
| @@ -168,7 +169,7 @@ where | |||
| 168 | spi.blocking_read::<u8>(&mut []).unwrap(); | 169 | spi.blocking_read::<u8>(&mut []).unwrap(); |
| 169 | } | 170 | } |
| 170 | 171 | ||
| 171 | async fn test_tx<W: Word + From<u8> + defmt::Format + Eq>(spi: &mut Spi<'_, Async>) | 172 | async fn test_tx<W: Word + From<u8> + defmt::Format + Eq>(spi: &mut Spi<'_, Async, Master>) |
| 172 | where | 173 | where |
| 173 | W: core::ops::Not<Output = W>, | 174 | W: core::ops::Not<Output = W>, |
| 174 | { | 175 | { |
diff --git a/tests/stm32/src/bin/stop.rs b/tests/stm32/src/bin/stop.rs index 8119c1f39..1fe65d867 100644 --- a/tests/stm32/src/bin/stop.rs +++ b/tests/stm32/src/bin/stop.rs | |||
| @@ -9,12 +9,11 @@ use chrono::NaiveDate; | |||
| 9 | use common::*; | 9 | use common::*; |
| 10 | use cortex_m_rt::entry; | 10 | use cortex_m_rt::entry; |
| 11 | use embassy_executor::Spawner; | 11 | use embassy_executor::Spawner; |
| 12 | use embassy_stm32::low_power::{stop_ready, stop_with_rtc, Executor, StopMode}; | ||
| 13 | use embassy_stm32::rcc::LsConfig; | ||
| 14 | use embassy_stm32::rtc::{Rtc, RtcConfig}; | ||
| 15 | use embassy_stm32::Config; | 12 | use embassy_stm32::Config; |
| 13 | use embassy_stm32::low_power::{Executor, StopMode, stop_ready}; | ||
| 14 | use embassy_stm32::rcc::LsConfig; | ||
| 15 | use embassy_stm32::rtc::Rtc; | ||
| 16 | use embassy_time::Timer; | 16 | use embassy_time::Timer; |
| 17 | use static_cell::StaticCell; | ||
| 18 | 17 | ||
| 19 | #[entry] | 18 | #[entry] |
| 20 | fn main() -> ! { | 19 | fn main() -> ! { |
| @@ -50,6 +49,7 @@ async fn async_main(spawner: Spawner) { | |||
| 50 | 49 | ||
| 51 | let mut config = Config::default(); | 50 | let mut config = Config::default(); |
| 52 | config.rcc.ls = LsConfig::default_lse(); | 51 | config.rcc.ls = LsConfig::default_lse(); |
| 52 | config.rtc._disable_rtc = false; | ||
| 53 | 53 | ||
| 54 | // System Clock seems cannot be greater than 16 MHz | 54 | // System Clock seems cannot be greater than 16 MHz |
| 55 | #[cfg(any(feature = "stm32h563zi", feature = "stm32h503rb"))] | 55 | #[cfg(any(feature = "stm32h563zi", feature = "stm32h503rb"))] |
| @@ -66,14 +66,11 @@ async fn async_main(spawner: Spawner) { | |||
| 66 | .and_hms_opt(10, 30, 15) | 66 | .and_hms_opt(10, 30, 15) |
| 67 | .unwrap(); | 67 | .unwrap(); |
| 68 | 68 | ||
| 69 | let mut rtc = Rtc::new(p.RTC, RtcConfig::default()); | 69 | let (rtc, _time_provider) = Rtc::new(p.RTC); |
| 70 | |||
| 71 | rtc.set_datetime(now.into()).expect("datetime not set"); | ||
| 72 | 70 | ||
| 73 | static RTC: StaticCell<Rtc> = StaticCell::new(); | 71 | critical_section::with(|cs| { |
| 74 | let rtc = RTC.init(rtc); | 72 | rtc.borrow_mut(cs).set_datetime(now.into()).expect("datetime not set"); |
| 75 | 73 | }); | |
| 76 | stop_with_rtc(rtc); | ||
| 77 | 74 | ||
| 78 | spawner.spawn(task_1().unwrap()); | 75 | spawner.spawn(task_1().unwrap()); |
| 79 | spawner.spawn(task_2().unwrap()); | 76 | spawner.spawn(task_2().unwrap()); |
diff --git a/tests/stm32/src/bin/ucpd.rs b/tests/stm32/src/bin/ucpd.rs index 97aefe1a0..c794afff8 100644 --- a/tests/stm32/src/bin/ucpd.rs +++ b/tests/stm32/src/bin/ucpd.rs | |||
| @@ -9,7 +9,7 @@ use defmt::{assert, assert_eq}; | |||
| 9 | use embassy_executor::Spawner; | 9 | use embassy_executor::Spawner; |
| 10 | use embassy_futures::join::join; | 10 | use embassy_futures::join::join; |
| 11 | use embassy_stm32::ucpd::{self, CcPhy, CcPull, CcSel, CcVState, RxError, Ucpd}; | 11 | use embassy_stm32::ucpd::{self, CcPhy, CcPull, CcSel, CcVState, RxError, Ucpd}; |
| 12 | use embassy_stm32::{bind_interrupts, peripherals, Peri}; | 12 | use embassy_stm32::{Peri, bind_interrupts, peripherals}; |
| 13 | use embassy_time::Timer; | 13 | use embassy_time::Timer; |
| 14 | 14 | ||
| 15 | bind_interrupts!(struct Irqs { | 15 | bind_interrupts!(struct Irqs { |
diff --git a/tests/stm32/src/bin/usart.rs b/tests/stm32/src/bin/usart.rs index 129c7b692..0b98d3eeb 100644 --- a/tests/stm32/src/bin/usart.rs +++ b/tests/stm32/src/bin/usart.rs | |||
| @@ -7,7 +7,7 @@ use common::*; | |||
| 7 | use defmt::{assert, assert_eq, unreachable}; | 7 | use defmt::{assert, assert_eq, unreachable}; |
| 8 | use embassy_executor::Spawner; | 8 | use embassy_executor::Spawner; |
| 9 | use embassy_stm32::usart::{Config, ConfigError, Error, Uart}; | 9 | use embassy_stm32::usart::{Config, ConfigError, Error, Uart}; |
| 10 | use embassy_time::{block_for, Duration, Instant}; | 10 | use embassy_time::{Duration, Instant, block_for}; |
| 11 | 11 | ||
| 12 | #[embassy_executor::main] | 12 | #[embassy_executor::main] |
| 13 | async fn main(_spawner: Spawner) { | 13 | async fn main(_spawner: Spawner) { |
diff --git a/tests/stm32/src/bin/wpan_ble.rs b/tests/stm32/src/bin/wpan_ble.rs index 8957bfc04..0f396b848 100644 --- a/tests/stm32/src/bin/wpan_ble.rs +++ b/tests/stm32/src/bin/wpan_ble.rs | |||
| @@ -12,16 +12,16 @@ use embassy_executor::Spawner; | |||
| 12 | use embassy_stm32::bind_interrupts; | 12 | use embassy_stm32::bind_interrupts; |
| 13 | use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler}; | 13 | use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler}; |
| 14 | use embassy_stm32::rcc::WPAN_DEFAULT; | 14 | use embassy_stm32::rcc::WPAN_DEFAULT; |
| 15 | use embassy_stm32_wpan::TlMbox; | ||
| 16 | use embassy_stm32_wpan::hci::BdAddr; | ||
| 15 | use embassy_stm32_wpan::hci::host::uart::UartHci; | 17 | use embassy_stm32_wpan::hci::host::uart::UartHci; |
| 16 | use embassy_stm32_wpan::hci::host::{AdvertisingFilterPolicy, EncryptionKey, HostHci, OwnAddressType}; | 18 | use embassy_stm32_wpan::hci::host::{AdvertisingFilterPolicy, EncryptionKey, HostHci, OwnAddressType}; |
| 17 | use embassy_stm32_wpan::hci::types::AdvertisingType; | 19 | use embassy_stm32_wpan::hci::types::AdvertisingType; |
| 18 | use embassy_stm32_wpan::hci::vendor::command::gap::{AdvertisingDataType, DiscoverableParameters, GapCommands, Role}; | 20 | use embassy_stm32_wpan::hci::vendor::command::gap::{AdvertisingDataType, DiscoverableParameters, GapCommands, Role}; |
| 19 | use embassy_stm32_wpan::hci::vendor::command::gatt::GattCommands; | 21 | use embassy_stm32_wpan::hci::vendor::command::gatt::GattCommands; |
| 20 | use embassy_stm32_wpan::hci::vendor::command::hal::{ConfigData, HalCommands, PowerLevel}; | 22 | use embassy_stm32_wpan::hci::vendor::command::hal::{ConfigData, HalCommands, PowerLevel}; |
| 21 | use embassy_stm32_wpan::hci::BdAddr; | ||
| 22 | use embassy_stm32_wpan::lhci::LhciC1DeviceInformationCcrp; | 23 | use embassy_stm32_wpan::lhci::LhciC1DeviceInformationCcrp; |
| 23 | use embassy_stm32_wpan::sub::mm; | 24 | use embassy_stm32_wpan::sub::mm; |
| 24 | use embassy_stm32_wpan::TlMbox; | ||
| 25 | use {defmt_rtt as _, panic_probe as _}; | 25 | use {defmt_rtt as _, panic_probe as _}; |
| 26 | 26 | ||
| 27 | bind_interrupts!(struct Irqs{ | 27 | bind_interrupts!(struct Irqs{ |
diff --git a/tests/stm32/src/bin/wpan_mac.rs b/tests/stm32/src/bin/wpan_mac.rs index 79e13d524..f27146c44 100644 --- a/tests/stm32/src/bin/wpan_mac.rs +++ b/tests/stm32/src/bin/wpan_mac.rs | |||
| @@ -10,13 +10,13 @@ use embassy_executor::Spawner; | |||
| 10 | use embassy_stm32::bind_interrupts; | 10 | use embassy_stm32::bind_interrupts; |
| 11 | use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler}; | 11 | use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler}; |
| 12 | use embassy_stm32::rcc::WPAN_DEFAULT; | 12 | use embassy_stm32::rcc::WPAN_DEFAULT; |
| 13 | use embassy_stm32_wpan::TlMbox; | ||
| 13 | use embassy_stm32_wpan::mac::commands::{AssociateRequest, GetRequest, ResetRequest, SetRequest}; | 14 | use embassy_stm32_wpan::mac::commands::{AssociateRequest, GetRequest, ResetRequest, SetRequest}; |
| 14 | use embassy_stm32_wpan::mac::event::MacEvent; | 15 | use embassy_stm32_wpan::mac::event::MacEvent; |
| 15 | use embassy_stm32_wpan::mac::typedefs::{ | 16 | use embassy_stm32_wpan::mac::typedefs::{ |
| 16 | AddressMode, Capabilities, KeyIdMode, MacAddress, MacChannel, PanId, PibId, SecurityLevel, | 17 | AddressMode, Capabilities, KeyIdMode, MacAddress, MacChannel, PanId, PibId, SecurityLevel, |
| 17 | }; | 18 | }; |
| 18 | use embassy_stm32_wpan::sub::mm; | 19 | use embassy_stm32_wpan::sub::mm; |
| 19 | use embassy_stm32_wpan::TlMbox; | ||
| 20 | use {defmt_rtt as _, panic_probe as _}; | 20 | use {defmt_rtt as _, panic_probe as _}; |
| 21 | 21 | ||
| 22 | bind_interrupts!(struct Irqs{ | 22 | bind_interrupts!(struct Irqs{ |
diff --git a/tests/stm32/src/common.rs b/tests/stm32/src/common.rs index f800769ab..096cce947 100644 --- a/tests/stm32/src/common.rs +++ b/tests/stm32/src/common.rs | |||
| @@ -1,11 +1,11 @@ | |||
| 1 | #![macro_use] | 1 | #![macro_use] |
| 2 | 2 | ||
| 3 | pub use defmt::*; | 3 | pub use defmt::*; |
| 4 | use embassy_stm32::Config; | ||
| 4 | #[allow(unused)] | 5 | #[allow(unused)] |
| 5 | use embassy_stm32::rcc::*; | 6 | use embassy_stm32::rcc::*; |
| 6 | #[allow(unused)] | 7 | #[allow(unused)] |
| 7 | use embassy_stm32::time::Hertz; | 8 | use embassy_stm32::time::Hertz; |
| 8 | use embassy_stm32::Config; | ||
| 9 | use {defmt_rtt as _, panic_probe as _}; | 9 | use {defmt_rtt as _, panic_probe as _}; |
| 10 | 10 | ||
| 11 | #[cfg(feature = "stm32f103c8")] | 11 | #[cfg(feature = "stm32f103c8")] |
| @@ -468,6 +468,8 @@ pub fn config() -> Config { | |||
| 468 | config.rcc.apb3_pre = APBPrescaler::DIV1; | 468 | config.rcc.apb3_pre = APBPrescaler::DIV1; |
| 469 | config.rcc.sys = Sysclk::PLL1_P; | 469 | config.rcc.sys = Sysclk::PLL1_P; |
| 470 | config.rcc.voltage_scale = VoltageScale::Scale0; | 470 | config.rcc.voltage_scale = VoltageScale::Scale0; |
| 471 | |||
| 472 | config.rtc._disable_rtc = true; | ||
| 471 | } | 473 | } |
| 472 | 474 | ||
| 473 | #[cfg(feature = "stm32h503rb")] | 475 | #[cfg(feature = "stm32h503rb")] |
diff --git a/tests/utils/Cargo.toml b/tests/utils/Cargo.toml index f76feaa20..da04a1f5d 100644 --- a/tests/utils/Cargo.toml +++ b/tests/utils/Cargo.toml | |||
| @@ -1,7 +1,8 @@ | |||
| 1 | [package] | 1 | [package] |
| 2 | name = "test-utils" | 2 | name = "test-utils" |
| 3 | version = "0.1.0" | 3 | version = "0.1.0" |
| 4 | edition = "2021" | 4 | edition = "2024" |
| 5 | license = "MIT OR Apache-2.0" | ||
| 5 | publish = false | 6 | publish = false |
| 6 | 7 | ||
| 7 | [dependencies] | 8 | [dependencies] |
diff --git a/tests/utils/src/bin/saturate_serial.rs b/tests/utils/src/bin/saturate_serial.rs index 85676b106..1c8a8b322 100644 --- a/tests/utils/src/bin/saturate_serial.rs +++ b/tests/utils/src/bin/saturate_serial.rs | |||
| @@ -2,7 +2,7 @@ use std::path::Path; | |||
| 2 | use std::time::Duration; | 2 | use std::time::Duration; |
| 3 | use std::{env, io, process, thread}; | 3 | use std::{env, io, process, thread}; |
| 4 | 4 | ||
| 5 | use rand::{rng, Rng}; | 5 | use rand::{Rng, rng}; |
| 6 | use serial::SerialPort; | 6 | use serial::SerialPort; |
| 7 | 7 | ||
| 8 | pub fn main() { | 8 | pub fn main() { |
