diff options
| author | sodo <[email protected]> | 2024-01-02 01:37:00 +0900 |
|---|---|---|
| committer | sodo <[email protected]> | 2024-01-02 13:34:22 +0900 |
| commit | 6ee153a3e2eec284c0d9d87f31801265c0604f74 (patch) | |
| tree | 8b801cbd15f9ad5052d5942c731e75736dc9d7eb /examples/rp/src/bin | |
| parent | b7cd7952c890f585ff876c622482534e5d58d4a4 (diff) | |
| parent | 0be9b0599aaf2e425d76ec7852ff4b3535defddf (diff) | |
Merge remote-tracking branch 'origin'
Diffstat (limited to 'examples/rp/src/bin')
44 files changed, 78 insertions, 92 deletions
diff --git a/examples/rp/src/bin/adc.rs b/examples/rp/src/bin/adc.rs index a579be139..1bb7c2249 100644 --- a/examples/rp/src/bin/adc.rs +++ b/examples/rp/src/bin/adc.rs | |||
| @@ -3,7 +3,6 @@ | |||
| 3 | 3 | ||
| 4 | #![no_std] | 4 | #![no_std] |
| 5 | #![no_main] | 5 | #![no_main] |
| 6 | #![feature(type_alias_impl_trait)] | ||
| 7 | 6 | ||
| 8 | use defmt::*; | 7 | use defmt::*; |
| 9 | use embassy_executor::Spawner; | 8 | use embassy_executor::Spawner; |
diff --git a/examples/rp/src/bin/blinky.rs b/examples/rp/src/bin/blinky.rs index 66c8773fa..60fc45a70 100644 --- a/examples/rp/src/bin/blinky.rs +++ b/examples/rp/src/bin/blinky.rs | |||
| @@ -4,7 +4,6 @@ | |||
| 4 | 4 | ||
| 5 | #![no_std] | 5 | #![no_std] |
| 6 | #![no_main] | 6 | #![no_main] |
| 7 | #![feature(type_alias_impl_trait)] | ||
| 8 | 7 | ||
| 9 | use defmt::*; | 8 | use defmt::*; |
| 10 | use embassy_executor::Spawner; | 9 | use embassy_executor::Spawner; |
diff --git a/examples/rp/src/bin/button.rs b/examples/rp/src/bin/button.rs index d7aa89410..e9054fd48 100644 --- a/examples/rp/src/bin/button.rs +++ b/examples/rp/src/bin/button.rs | |||
| @@ -4,7 +4,6 @@ | |||
| 4 | 4 | ||
| 5 | #![no_std] | 5 | #![no_std] |
| 6 | #![no_main] | 6 | #![no_main] |
| 7 | #![feature(type_alias_impl_trait)] | ||
| 8 | 7 | ||
| 9 | use embassy_executor::Spawner; | 8 | use embassy_executor::Spawner; |
| 10 | use embassy_rp::gpio::{Input, Level, Output, Pull}; | 9 | use embassy_rp::gpio::{Input, Level, Output, Pull}; |
| @@ -17,7 +16,7 @@ async fn main(_spawner: Spawner) { | |||
| 17 | 16 | ||
| 18 | // Use PIN_28, Pin34 on J0 for RP Pico, as a input. | 17 | // Use PIN_28, Pin34 on J0 for RP Pico, as a input. |
| 19 | // You need to add your own button. | 18 | // You need to add your own button. |
| 20 | let button = Input::new(p.PIN_28, Pull::Up); | 19 | let mut button = Input::new(p.PIN_28, Pull::Up); |
| 21 | 20 | ||
| 22 | loop { | 21 | loop { |
| 23 | if button.is_high() { | 22 | if button.is_high() { |
diff --git a/examples/rp/src/bin/ethernet_w5500_multisocket.rs b/examples/rp/src/bin/ethernet_w5500_multisocket.rs index c0fde62ab..a16ea0007 100644 --- a/examples/rp/src/bin/ethernet_w5500_multisocket.rs +++ b/examples/rp/src/bin/ethernet_w5500_multisocket.rs | |||
| @@ -4,7 +4,6 @@ | |||
| 4 | 4 | ||
| 5 | #![no_std] | 5 | #![no_std] |
| 6 | #![no_main] | 6 | #![no_main] |
| 7 | #![feature(type_alias_impl_trait)] | ||
| 8 | 7 | ||
| 9 | use defmt::*; | 8 | use defmt::*; |
| 10 | use embassy_executor::Spawner; | 9 | use embassy_executor::Spawner; |
| @@ -20,7 +19,7 @@ use embassy_time::{Delay, Duration}; | |||
| 20 | use embedded_hal_bus::spi::ExclusiveDevice; | 19 | use embedded_hal_bus::spi::ExclusiveDevice; |
| 21 | use embedded_io_async::Write; | 20 | use embedded_io_async::Write; |
| 22 | use rand::RngCore; | 21 | use rand::RngCore; |
| 23 | use static_cell::make_static; | 22 | use static_cell::StaticCell; |
| 24 | use {defmt_rtt as _, panic_probe as _}; | 23 | use {defmt_rtt as _, panic_probe as _}; |
| 25 | 24 | ||
| 26 | #[embassy_executor::task] | 25 | #[embassy_executor::task] |
| @@ -55,7 +54,8 @@ async fn main(spawner: Spawner) { | |||
| 55 | let w5500_reset = Output::new(p.PIN_20, Level::High); | 54 | let w5500_reset = Output::new(p.PIN_20, Level::High); |
| 56 | 55 | ||
| 57 | let mac_addr = [0x02, 0x00, 0x00, 0x00, 0x00, 0x00]; | 56 | let mac_addr = [0x02, 0x00, 0x00, 0x00, 0x00, 0x00]; |
| 58 | let state = make_static!(State::<8, 8>::new()); | 57 | static STATE: StaticCell<State<8, 8>> = StaticCell::new(); |
| 58 | let state = STATE.init(State::<8, 8>::new()); | ||
| 59 | let (device, runner) = embassy_net_wiznet::new( | 59 | let (device, runner) = embassy_net_wiznet::new( |
| 60 | mac_addr, | 60 | mac_addr, |
| 61 | state, | 61 | state, |
| @@ -70,11 +70,13 @@ async fn main(spawner: Spawner) { | |||
| 70 | let seed = rng.next_u64(); | 70 | let seed = rng.next_u64(); |
| 71 | 71 | ||
| 72 | // Init network stack | 72 | // Init network stack |
| 73 | let stack = &*make_static!(Stack::new( | 73 | static STACK: StaticCell<Stack<Device<'static>>> = StaticCell::new(); |
| 74 | static RESOURCES: StaticCell<StackResources<3>> = StaticCell::new(); | ||
| 75 | let stack = &*STACK.init(Stack::new( | ||
| 74 | device, | 76 | device, |
| 75 | embassy_net::Config::dhcpv4(Default::default()), | 77 | embassy_net::Config::dhcpv4(Default::default()), |
| 76 | make_static!(StackResources::<3>::new()), | 78 | RESOURCES.init(StackResources::<3>::new()), |
| 77 | seed | 79 | seed, |
| 78 | )); | 80 | )); |
| 79 | 81 | ||
| 80 | // Launch network task | 82 | // Launch network task |
diff --git a/examples/rp/src/bin/ethernet_w5500_tcp_client.rs b/examples/rp/src/bin/ethernet_w5500_tcp_client.rs index b19362fc1..975b3d385 100644 --- a/examples/rp/src/bin/ethernet_w5500_tcp_client.rs +++ b/examples/rp/src/bin/ethernet_w5500_tcp_client.rs | |||
| @@ -4,7 +4,6 @@ | |||
| 4 | 4 | ||
| 5 | #![no_std] | 5 | #![no_std] |
| 6 | #![no_main] | 6 | #![no_main] |
| 7 | #![feature(type_alias_impl_trait)] | ||
| 8 | 7 | ||
| 9 | use core::str::FromStr; | 8 | use core::str::FromStr; |
| 10 | 9 | ||
| @@ -22,7 +21,7 @@ use embassy_time::{Delay, Duration, Timer}; | |||
| 22 | use embedded_hal_bus::spi::ExclusiveDevice; | 21 | use embedded_hal_bus::spi::ExclusiveDevice; |
| 23 | use embedded_io_async::Write; | 22 | use embedded_io_async::Write; |
| 24 | use rand::RngCore; | 23 | use rand::RngCore; |
| 25 | use static_cell::make_static; | 24 | use static_cell::StaticCell; |
| 26 | use {defmt_rtt as _, panic_probe as _}; | 25 | use {defmt_rtt as _, panic_probe as _}; |
| 27 | 26 | ||
| 28 | #[embassy_executor::task] | 27 | #[embassy_executor::task] |
| @@ -58,7 +57,8 @@ async fn main(spawner: Spawner) { | |||
| 58 | let w5500_reset = Output::new(p.PIN_20, Level::High); | 57 | let w5500_reset = Output::new(p.PIN_20, Level::High); |
| 59 | 58 | ||
| 60 | let mac_addr = [0x02, 0x00, 0x00, 0x00, 0x00, 0x00]; | 59 | let mac_addr = [0x02, 0x00, 0x00, 0x00, 0x00, 0x00]; |
| 61 | let state = make_static!(State::<8, 8>::new()); | 60 | static STATE: StaticCell<State<8, 8>> = StaticCell::new(); |
| 61 | let state = STATE.init(State::<8, 8>::new()); | ||
| 62 | let (device, runner) = embassy_net_wiznet::new( | 62 | let (device, runner) = embassy_net_wiznet::new( |
| 63 | mac_addr, | 63 | mac_addr, |
| 64 | state, | 64 | state, |
| @@ -73,11 +73,13 @@ async fn main(spawner: Spawner) { | |||
| 73 | let seed = rng.next_u64(); | 73 | let seed = rng.next_u64(); |
| 74 | 74 | ||
| 75 | // Init network stack | 75 | // Init network stack |
| 76 | let stack = &*make_static!(Stack::new( | 76 | static STACK: StaticCell<Stack<Device<'static>>> = StaticCell::new(); |
| 77 | static RESOURCES: StaticCell<StackResources<2>> = StaticCell::new(); | ||
| 78 | let stack = &*STACK.init(Stack::new( | ||
| 77 | device, | 79 | device, |
| 78 | embassy_net::Config::dhcpv4(Default::default()), | 80 | embassy_net::Config::dhcpv4(Default::default()), |
| 79 | make_static!(StackResources::<2>::new()), | 81 | RESOURCES.init(StackResources::<2>::new()), |
| 80 | seed | 82 | seed, |
| 81 | )); | 83 | )); |
| 82 | 84 | ||
| 83 | // Launch network task | 85 | // Launch network task |
diff --git a/examples/rp/src/bin/ethernet_w5500_tcp_server.rs b/examples/rp/src/bin/ethernet_w5500_tcp_server.rs index c62caed7a..489af2c76 100644 --- a/examples/rp/src/bin/ethernet_w5500_tcp_server.rs +++ b/examples/rp/src/bin/ethernet_w5500_tcp_server.rs | |||
| @@ -5,7 +5,6 @@ | |||
| 5 | 5 | ||
| 6 | #![no_std] | 6 | #![no_std] |
| 7 | #![no_main] | 7 | #![no_main] |
| 8 | #![feature(type_alias_impl_trait)] | ||
| 9 | 8 | ||
| 10 | use defmt::*; | 9 | use defmt::*; |
| 11 | use embassy_executor::Spawner; | 10 | use embassy_executor::Spawner; |
| @@ -21,7 +20,7 @@ use embassy_time::{Delay, Duration}; | |||
| 21 | use embedded_hal_bus::spi::ExclusiveDevice; | 20 | use embedded_hal_bus::spi::ExclusiveDevice; |
| 22 | use embedded_io_async::Write; | 21 | use embedded_io_async::Write; |
| 23 | use rand::RngCore; | 22 | use rand::RngCore; |
| 24 | use static_cell::make_static; | 23 | use static_cell::StaticCell; |
| 25 | use {defmt_rtt as _, panic_probe as _}; | 24 | use {defmt_rtt as _, panic_probe as _}; |
| 26 | 25 | ||
| 27 | #[embassy_executor::task] | 26 | #[embassy_executor::task] |
| @@ -57,7 +56,8 @@ async fn main(spawner: Spawner) { | |||
| 57 | let w5500_reset = Output::new(p.PIN_20, Level::High); | 56 | let w5500_reset = Output::new(p.PIN_20, Level::High); |
| 58 | 57 | ||
| 59 | let mac_addr = [0x02, 0x00, 0x00, 0x00, 0x00, 0x00]; | 58 | let mac_addr = [0x02, 0x00, 0x00, 0x00, 0x00, 0x00]; |
| 60 | let state = make_static!(State::<8, 8>::new()); | 59 | static STATE: StaticCell<State<8, 8>> = StaticCell::new(); |
| 60 | let state = STATE.init(State::<8, 8>::new()); | ||
| 61 | let (device, runner) = embassy_net_wiznet::new( | 61 | let (device, runner) = embassy_net_wiznet::new( |
| 62 | mac_addr, | 62 | mac_addr, |
| 63 | state, | 63 | state, |
| @@ -72,11 +72,13 @@ async fn main(spawner: Spawner) { | |||
| 72 | let seed = rng.next_u64(); | 72 | let seed = rng.next_u64(); |
| 73 | 73 | ||
| 74 | // Init network stack | 74 | // Init network stack |
| 75 | let stack = &*make_static!(Stack::new( | 75 | static STACK: StaticCell<Stack<Device<'static>>> = StaticCell::new(); |
| 76 | static RESOURCES: StaticCell<StackResources<2>> = StaticCell::new(); | ||
| 77 | let stack = &*STACK.init(Stack::new( | ||
| 76 | device, | 78 | device, |
| 77 | embassy_net::Config::dhcpv4(Default::default()), | 79 | embassy_net::Config::dhcpv4(Default::default()), |
| 78 | make_static!(StackResources::<2>::new()), | 80 | RESOURCES.init(StackResources::<2>::new()), |
| 79 | seed | 81 | seed, |
| 80 | )); | 82 | )); |
| 81 | 83 | ||
| 82 | // Launch network task | 84 | // Launch network task |
diff --git a/examples/rp/src/bin/ethernet_w5500_udp.rs b/examples/rp/src/bin/ethernet_w5500_udp.rs index 76dabce1c..41bd7d077 100644 --- a/examples/rp/src/bin/ethernet_w5500_udp.rs +++ b/examples/rp/src/bin/ethernet_w5500_udp.rs | |||
| @@ -4,7 +4,6 @@ | |||
| 4 | 4 | ||
| 5 | #![no_std] | 5 | #![no_std] |
| 6 | #![no_main] | 6 | #![no_main] |
| 7 | #![feature(type_alias_impl_trait)] | ||
| 8 | 7 | ||
| 9 | use defmt::*; | 8 | use defmt::*; |
| 10 | use embassy_executor::Spawner; | 9 | use embassy_executor::Spawner; |
| @@ -20,7 +19,7 @@ use embassy_rp::spi::{Async, Config as SpiConfig, Spi}; | |||
| 20 | use embassy_time::Delay; | 19 | use embassy_time::Delay; |
| 21 | use embedded_hal_bus::spi::ExclusiveDevice; | 20 | use embedded_hal_bus::spi::ExclusiveDevice; |
| 22 | use rand::RngCore; | 21 | use rand::RngCore; |
| 23 | use static_cell::make_static; | 22 | use static_cell::StaticCell; |
| 24 | use {defmt_rtt as _, panic_probe as _}; | 23 | use {defmt_rtt as _, panic_probe as _}; |
| 25 | 24 | ||
| 26 | #[embassy_executor::task] | 25 | #[embassy_executor::task] |
| @@ -55,7 +54,8 @@ async fn main(spawner: Spawner) { | |||
| 55 | let w5500_reset = Output::new(p.PIN_20, Level::High); | 54 | let w5500_reset = Output::new(p.PIN_20, Level::High); |
| 56 | 55 | ||
| 57 | let mac_addr = [0x02, 0x00, 0x00, 0x00, 0x00, 0x00]; | 56 | let mac_addr = [0x02, 0x00, 0x00, 0x00, 0x00, 0x00]; |
| 58 | let state = make_static!(State::<8, 8>::new()); | 57 | static STATE: StaticCell<State<8, 8>> = StaticCell::new(); |
| 58 | let state = STATE.init(State::<8, 8>::new()); | ||
| 59 | let (device, runner) = embassy_net_wiznet::new( | 59 | let (device, runner) = embassy_net_wiznet::new( |
| 60 | mac_addr, | 60 | mac_addr, |
| 61 | state, | 61 | state, |
| @@ -70,11 +70,13 @@ async fn main(spawner: Spawner) { | |||
| 70 | let seed = rng.next_u64(); | 70 | let seed = rng.next_u64(); |
| 71 | 71 | ||
| 72 | // Init network stack | 72 | // Init network stack |
| 73 | let stack = &*make_static!(Stack::new( | 73 | static STACK: StaticCell<Stack<Device<'static>>> = StaticCell::new(); |
| 74 | static RESOURCES: StaticCell<StackResources<2>> = StaticCell::new(); | ||
| 75 | let stack = &*STACK.init(Stack::new( | ||
| 74 | device, | 76 | device, |
| 75 | embassy_net::Config::dhcpv4(Default::default()), | 77 | embassy_net::Config::dhcpv4(Default::default()), |
| 76 | make_static!(StackResources::<2>::new()), | 78 | RESOURCES.init(StackResources::<2>::new()), |
| 77 | seed | 79 | seed, |
| 78 | )); | 80 | )); |
| 79 | 81 | ||
| 80 | // Launch network task | 82 | // Launch network task |
diff --git a/examples/rp/src/bin/flash.rs b/examples/rp/src/bin/flash.rs index 129a8497f..eb3e6a2b9 100644 --- a/examples/rp/src/bin/flash.rs +++ b/examples/rp/src/bin/flash.rs | |||
| @@ -2,7 +2,6 @@ | |||
| 2 | 2 | ||
| 3 | #![no_std] | 3 | #![no_std] |
| 4 | #![no_main] | 4 | #![no_main] |
| 5 | #![feature(type_alias_impl_trait)] | ||
| 6 | 5 | ||
| 7 | use defmt::*; | 6 | use defmt::*; |
| 8 | use embassy_executor::Spawner; | 7 | use embassy_executor::Spawner; |
diff --git a/examples/rp/src/bin/gpio_async.rs b/examples/rp/src/bin/gpio_async.rs index 98209fe41..b79fb2a15 100644 --- a/examples/rp/src/bin/gpio_async.rs +++ b/examples/rp/src/bin/gpio_async.rs | |||
| @@ -4,7 +4,6 @@ | |||
| 4 | 4 | ||
| 5 | #![no_std] | 5 | #![no_std] |
| 6 | #![no_main] | 6 | #![no_main] |
| 7 | #![feature(type_alias_impl_trait)] | ||
| 8 | 7 | ||
| 9 | use defmt::*; | 8 | use defmt::*; |
| 10 | use embassy_executor::Spawner; | 9 | use embassy_executor::Spawner; |
diff --git a/examples/rp/src/bin/gpout.rs b/examples/rp/src/bin/gpout.rs index 896cc15ee..011359253 100644 --- a/examples/rp/src/bin/gpout.rs +++ b/examples/rp/src/bin/gpout.rs | |||
| @@ -4,7 +4,6 @@ | |||
| 4 | 4 | ||
| 5 | #![no_std] | 5 | #![no_std] |
| 6 | #![no_main] | 6 | #![no_main] |
| 7 | #![feature(type_alias_impl_trait)] | ||
| 8 | 7 | ||
| 9 | use defmt::*; | 8 | use defmt::*; |
| 10 | use embassy_executor::Spawner; | 9 | use embassy_executor::Spawner; |
diff --git a/examples/rp/src/bin/i2c_async.rs b/examples/rp/src/bin/i2c_async.rs index 7b53aae72..e31cc894c 100644 --- a/examples/rp/src/bin/i2c_async.rs +++ b/examples/rp/src/bin/i2c_async.rs | |||
| @@ -5,7 +5,6 @@ | |||
| 5 | 5 | ||
| 6 | #![no_std] | 6 | #![no_std] |
| 7 | #![no_main] | 7 | #![no_main] |
| 8 | #![feature(type_alias_impl_trait)] | ||
| 9 | 8 | ||
| 10 | use defmt::*; | 9 | use defmt::*; |
| 11 | use embassy_executor::Spawner; | 10 | use embassy_executor::Spawner; |
diff --git a/examples/rp/src/bin/i2c_blocking.rs b/examples/rp/src/bin/i2c_blocking.rs index 9ddb48d69..c9c8a2760 100644 --- a/examples/rp/src/bin/i2c_blocking.rs +++ b/examples/rp/src/bin/i2c_blocking.rs | |||
| @@ -5,7 +5,6 @@ | |||
| 5 | 5 | ||
| 6 | #![no_std] | 6 | #![no_std] |
| 7 | #![no_main] | 7 | #![no_main] |
| 8 | #![feature(type_alias_impl_trait)] | ||
| 9 | 8 | ||
| 10 | use defmt::*; | 9 | use defmt::*; |
| 11 | use embassy_executor::Spawner; | 10 | use embassy_executor::Spawner; |
diff --git a/examples/rp/src/bin/i2c_slave.rs b/examples/rp/src/bin/i2c_slave.rs index 151b083a4..479f9a16a 100644 --- a/examples/rp/src/bin/i2c_slave.rs +++ b/examples/rp/src/bin/i2c_slave.rs | |||
| @@ -1,7 +1,6 @@ | |||
| 1 | //! This example shows how to use the 2040 as an i2c slave. | 1 | //! This example shows how to use the 2040 as an i2c slave. |
| 2 | #![no_std] | 2 | #![no_std] |
| 3 | #![no_main] | 3 | #![no_main] |
| 4 | #![feature(type_alias_impl_trait)] | ||
| 5 | 4 | ||
| 6 | use defmt::*; | 5 | use defmt::*; |
| 7 | use embassy_executor::Spawner; | 6 | use embassy_executor::Spawner; |
diff --git a/examples/rp/src/bin/multicore.rs b/examples/rp/src/bin/multicore.rs index 43eaf8b0a..a1678d99a 100644 --- a/examples/rp/src/bin/multicore.rs +++ b/examples/rp/src/bin/multicore.rs | |||
| @@ -4,7 +4,6 @@ | |||
| 4 | 4 | ||
| 5 | #![no_std] | 5 | #![no_std] |
| 6 | #![no_main] | 6 | #![no_main] |
| 7 | #![feature(type_alias_impl_trait)] | ||
| 8 | 7 | ||
| 9 | use defmt::*; | 8 | use defmt::*; |
| 10 | use embassy_executor::Executor; | 9 | use embassy_executor::Executor; |
diff --git a/examples/rp/src/bin/multiprio.rs b/examples/rp/src/bin/multiprio.rs index 28f621437..26b80c11d 100644 --- a/examples/rp/src/bin/multiprio.rs +++ b/examples/rp/src/bin/multiprio.rs | |||
| @@ -55,7 +55,6 @@ | |||
| 55 | 55 | ||
| 56 | #![no_std] | 56 | #![no_std] |
| 57 | #![no_main] | 57 | #![no_main] |
| 58 | #![feature(type_alias_impl_trait)] | ||
| 59 | 58 | ||
| 60 | use cortex_m_rt::entry; | 59 | use cortex_m_rt::entry; |
| 61 | use defmt::{info, unwrap}; | 60 | use defmt::{info, unwrap}; |
diff --git a/examples/rp/src/bin/pio_async.rs b/examples/rp/src/bin/pio_async.rs index a6d6144be..ee248591b 100644 --- a/examples/rp/src/bin/pio_async.rs +++ b/examples/rp/src/bin/pio_async.rs | |||
| @@ -2,7 +2,6 @@ | |||
| 2 | 2 | ||
| 3 | #![no_std] | 3 | #![no_std] |
| 4 | #![no_main] | 4 | #![no_main] |
| 5 | #![feature(type_alias_impl_trait)] | ||
| 6 | use defmt::info; | 5 | use defmt::info; |
| 7 | use embassy_executor::Spawner; | 6 | use embassy_executor::Spawner; |
| 8 | use embassy_rp::bind_interrupts; | 7 | use embassy_rp::bind_interrupts; |
diff --git a/examples/rp/src/bin/pio_dma.rs b/examples/rp/src/bin/pio_dma.rs index 86e5017ac..02700269c 100644 --- a/examples/rp/src/bin/pio_dma.rs +++ b/examples/rp/src/bin/pio_dma.rs | |||
| @@ -2,7 +2,6 @@ | |||
| 2 | 2 | ||
| 3 | #![no_std] | 3 | #![no_std] |
| 4 | #![no_main] | 4 | #![no_main] |
| 5 | #![feature(type_alias_impl_trait)] | ||
| 6 | use defmt::info; | 5 | use defmt::info; |
| 7 | use embassy_executor::Spawner; | 6 | use embassy_executor::Spawner; |
| 8 | use embassy_futures::join::join; | 7 | use embassy_futures::join::join; |
diff --git a/examples/rp/src/bin/pio_hd44780.rs b/examples/rp/src/bin/pio_hd44780.rs index 5e5a6f9a3..3fab7b5f2 100644 --- a/examples/rp/src/bin/pio_hd44780.rs +++ b/examples/rp/src/bin/pio_hd44780.rs | |||
| @@ -3,7 +3,6 @@ | |||
| 3 | 3 | ||
| 4 | #![no_std] | 4 | #![no_std] |
| 5 | #![no_main] | 5 | #![no_main] |
| 6 | #![feature(type_alias_impl_trait)] | ||
| 7 | 6 | ||
| 8 | use core::fmt::Write; | 7 | use core::fmt::Write; |
| 9 | 8 | ||
diff --git a/examples/rp/src/bin/pio_rotary_encoder.rs b/examples/rp/src/bin/pio_rotary_encoder.rs index 6d9d59df6..58bdadbc0 100644 --- a/examples/rp/src/bin/pio_rotary_encoder.rs +++ b/examples/rp/src/bin/pio_rotary_encoder.rs | |||
| @@ -2,7 +2,6 @@ | |||
| 2 | 2 | ||
| 3 | #![no_std] | 3 | #![no_std] |
| 4 | #![no_main] | 4 | #![no_main] |
| 5 | #![feature(type_alias_impl_trait)] | ||
| 6 | 5 | ||
| 7 | use defmt::info; | 6 | use defmt::info; |
| 8 | use embassy_executor::Spawner; | 7 | use embassy_executor::Spawner; |
diff --git a/examples/rp/src/bin/pio_stepper.rs b/examples/rp/src/bin/pio_stepper.rs index 02fb20699..ab9ecf623 100644 --- a/examples/rp/src/bin/pio_stepper.rs +++ b/examples/rp/src/bin/pio_stepper.rs | |||
| @@ -3,7 +3,6 @@ | |||
| 3 | 3 | ||
| 4 | #![no_std] | 4 | #![no_std] |
| 5 | #![no_main] | 5 | #![no_main] |
| 6 | #![feature(type_alias_impl_trait)] | ||
| 7 | use core::mem::{self, MaybeUninit}; | 6 | use core::mem::{self, MaybeUninit}; |
| 8 | 7 | ||
| 9 | use defmt::info; | 8 | use defmt::info; |
diff --git a/examples/rp/src/bin/pio_uart.rs b/examples/rp/src/bin/pio_uart.rs index c0ea23607..a07f1c180 100644 --- a/examples/rp/src/bin/pio_uart.rs +++ b/examples/rp/src/bin/pio_uart.rs | |||
| @@ -8,7 +8,6 @@ | |||
| 8 | 8 | ||
| 9 | #![no_std] | 9 | #![no_std] |
| 10 | #![no_main] | 10 | #![no_main] |
| 11 | #![feature(type_alias_impl_trait)] | ||
| 12 | #![allow(async_fn_in_trait)] | 11 | #![allow(async_fn_in_trait)] |
| 13 | 12 | ||
| 14 | use defmt::{info, panic, trace}; | 13 | use defmt::{info, panic, trace}; |
diff --git a/examples/rp/src/bin/pio_ws2812.rs b/examples/rp/src/bin/pio_ws2812.rs index 7b3259538..9a97cb8a7 100644 --- a/examples/rp/src/bin/pio_ws2812.rs +++ b/examples/rp/src/bin/pio_ws2812.rs | |||
| @@ -3,7 +3,6 @@ | |||
| 3 | 3 | ||
| 4 | #![no_std] | 4 | #![no_std] |
| 5 | #![no_main] | 5 | #![no_main] |
| 6 | #![feature(type_alias_impl_trait)] | ||
| 7 | 6 | ||
| 8 | use defmt::*; | 7 | use defmt::*; |
| 9 | use embassy_executor::Spawner; | 8 | use embassy_executor::Spawner; |
diff --git a/examples/rp/src/bin/pwm.rs b/examples/rp/src/bin/pwm.rs index a99e88003..4fb62546d 100644 --- a/examples/rp/src/bin/pwm.rs +++ b/examples/rp/src/bin/pwm.rs | |||
| @@ -4,7 +4,6 @@ | |||
| 4 | 4 | ||
| 5 | #![no_std] | 5 | #![no_std] |
| 6 | #![no_main] | 6 | #![no_main] |
| 7 | #![feature(type_alias_impl_trait)] | ||
| 8 | 7 | ||
| 9 | use defmt::*; | 8 | use defmt::*; |
| 10 | use embassy_executor::Spawner; | 9 | use embassy_executor::Spawner; |
diff --git a/examples/rp/src/bin/pwm_input.rs b/examples/rp/src/bin/pwm_input.rs index 0fc2e40c3..e7bcbfbd4 100644 --- a/examples/rp/src/bin/pwm_input.rs +++ b/examples/rp/src/bin/pwm_input.rs | |||
| @@ -2,7 +2,6 @@ | |||
| 2 | 2 | ||
| 3 | #![no_std] | 3 | #![no_std] |
| 4 | #![no_main] | 4 | #![no_main] |
| 5 | #![feature(type_alias_impl_trait)] | ||
| 6 | 5 | ||
| 7 | use defmt::*; | 6 | use defmt::*; |
| 8 | use embassy_executor::Spawner; | 7 | use embassy_executor::Spawner; |
diff --git a/examples/rp/src/bin/rosc.rs b/examples/rp/src/bin/rosc.rs index f841043b6..942b72319 100644 --- a/examples/rp/src/bin/rosc.rs +++ b/examples/rp/src/bin/rosc.rs | |||
| @@ -4,7 +4,6 @@ | |||
| 4 | 4 | ||
| 5 | #![no_std] | 5 | #![no_std] |
| 6 | #![no_main] | 6 | #![no_main] |
| 7 | #![feature(type_alias_impl_trait)] | ||
| 8 | 7 | ||
| 9 | use defmt::*; | 8 | use defmt::*; |
| 10 | use embassy_executor::Spawner; | 9 | use embassy_executor::Spawner; |
diff --git a/examples/rp/src/bin/rtc.rs b/examples/rp/src/bin/rtc.rs index 667876db5..e9a5e43a8 100644 --- a/examples/rp/src/bin/rtc.rs +++ b/examples/rp/src/bin/rtc.rs | |||
| @@ -2,7 +2,6 @@ | |||
| 2 | 2 | ||
| 3 | #![no_std] | 3 | #![no_std] |
| 4 | #![no_main] | 4 | #![no_main] |
| 5 | #![feature(type_alias_impl_trait)] | ||
| 6 | 5 | ||
| 7 | use defmt::*; | 6 | use defmt::*; |
| 8 | use embassy_executor::Spawner; | 7 | use embassy_executor::Spawner; |
diff --git a/examples/rp/src/bin/spi.rs b/examples/rp/src/bin/spi.rs index 602348f7a..4cc4f5210 100644 --- a/examples/rp/src/bin/spi.rs +++ b/examples/rp/src/bin/spi.rs | |||
| @@ -4,7 +4,6 @@ | |||
| 4 | 4 | ||
| 5 | #![no_std] | 5 | #![no_std] |
| 6 | #![no_main] | 6 | #![no_main] |
| 7 | #![feature(type_alias_impl_trait)] | ||
| 8 | 7 | ||
| 9 | use defmt::*; | 8 | use defmt::*; |
| 10 | use embassy_executor::Spawner; | 9 | use embassy_executor::Spawner; |
diff --git a/examples/rp/src/bin/spi_async.rs b/examples/rp/src/bin/spi_async.rs index f5a2d334e..266584efc 100644 --- a/examples/rp/src/bin/spi_async.rs +++ b/examples/rp/src/bin/spi_async.rs | |||
| @@ -3,7 +3,6 @@ | |||
| 3 | 3 | ||
| 4 | #![no_std] | 4 | #![no_std] |
| 5 | #![no_main] | 5 | #![no_main] |
| 6 | #![feature(type_alias_impl_trait)] | ||
| 7 | 6 | ||
| 8 | use defmt::*; | 7 | use defmt::*; |
| 9 | use embassy_executor::Spawner; | 8 | use embassy_executor::Spawner; |
diff --git a/examples/rp/src/bin/spi_display.rs b/examples/rp/src/bin/spi_display.rs index 26c258e1c..e937b9d0a 100644 --- a/examples/rp/src/bin/spi_display.rs +++ b/examples/rp/src/bin/spi_display.rs | |||
| @@ -5,7 +5,6 @@ | |||
| 5 | 5 | ||
| 6 | #![no_std] | 6 | #![no_std] |
| 7 | #![no_main] | 7 | #![no_main] |
| 8 | #![feature(type_alias_impl_trait)] | ||
| 9 | 8 | ||
| 10 | use core::cell::RefCell; | 9 | use core::cell::RefCell; |
| 11 | 10 | ||
diff --git a/examples/rp/src/bin/uart.rs b/examples/rp/src/bin/uart.rs index 451c3c396..6a2816cd0 100644 --- a/examples/rp/src/bin/uart.rs +++ b/examples/rp/src/bin/uart.rs | |||
| @@ -6,7 +6,6 @@ | |||
| 6 | 6 | ||
| 7 | #![no_std] | 7 | #![no_std] |
| 8 | #![no_main] | 8 | #![no_main] |
| 9 | #![feature(type_alias_impl_trait)] | ||
| 10 | 9 | ||
| 11 | use embassy_executor::Spawner; | 10 | use embassy_executor::Spawner; |
| 12 | use embassy_rp::uart; | 11 | use embassy_rp::uart; |
diff --git a/examples/rp/src/bin/uart_buffered_split.rs b/examples/rp/src/bin/uart_buffered_split.rs index 14e8810a4..fac61aa04 100644 --- a/examples/rp/src/bin/uart_buffered_split.rs +++ b/examples/rp/src/bin/uart_buffered_split.rs | |||
| @@ -6,7 +6,6 @@ | |||
| 6 | 6 | ||
| 7 | #![no_std] | 7 | #![no_std] |
| 8 | #![no_main] | 8 | #![no_main] |
| 9 | #![feature(type_alias_impl_trait)] | ||
| 10 | 9 | ||
| 11 | use defmt::*; | 10 | use defmt::*; |
| 12 | use embassy_executor::Spawner; | 11 | use embassy_executor::Spawner; |
| @@ -15,7 +14,7 @@ use embassy_rp::peripherals::UART0; | |||
| 15 | use embassy_rp::uart::{BufferedInterruptHandler, BufferedUart, BufferedUartRx, Config}; | 14 | use embassy_rp::uart::{BufferedInterruptHandler, BufferedUart, BufferedUartRx, Config}; |
| 16 | use embassy_time::Timer; | 15 | use embassy_time::Timer; |
| 17 | use embedded_io_async::{Read, Write}; | 16 | use embedded_io_async::{Read, Write}; |
| 18 | use static_cell::make_static; | 17 | use static_cell::StaticCell; |
| 19 | use {defmt_rtt as _, panic_probe as _}; | 18 | use {defmt_rtt as _, panic_probe as _}; |
| 20 | 19 | ||
| 21 | bind_interrupts!(struct Irqs { | 20 | bind_interrupts!(struct Irqs { |
| @@ -27,8 +26,10 @@ async fn main(spawner: Spawner) { | |||
| 27 | let p = embassy_rp::init(Default::default()); | 26 | let p = embassy_rp::init(Default::default()); |
| 28 | let (tx_pin, rx_pin, uart) = (p.PIN_0, p.PIN_1, p.UART0); | 27 | let (tx_pin, rx_pin, uart) = (p.PIN_0, p.PIN_1, p.UART0); |
| 29 | 28 | ||
| 30 | let tx_buf = &mut make_static!([0u8; 16])[..]; | 29 | static TX_BUF: StaticCell<[u8; 16]> = StaticCell::new(); |
| 31 | let rx_buf = &mut make_static!([0u8; 16])[..]; | 30 | let tx_buf = &mut TX_BUF.init([0; 16])[..]; |
| 31 | static RX_BUF: StaticCell<[u8; 16]> = StaticCell::new(); | ||
| 32 | let rx_buf = &mut RX_BUF.init([0; 16])[..]; | ||
| 32 | let uart = BufferedUart::new(uart, Irqs, tx_pin, rx_pin, tx_buf, rx_buf, Config::default()); | 33 | let uart = BufferedUart::new(uart, Irqs, tx_pin, rx_pin, tx_buf, rx_buf, Config::default()); |
| 33 | let (rx, mut tx) = uart.split(); | 34 | let (rx, mut tx) = uart.split(); |
| 34 | 35 | ||
diff --git a/examples/rp/src/bin/uart_unidir.rs b/examples/rp/src/bin/uart_unidir.rs index 42c8b432e..a45f40756 100644 --- a/examples/rp/src/bin/uart_unidir.rs +++ b/examples/rp/src/bin/uart_unidir.rs | |||
| @@ -7,7 +7,6 @@ | |||
| 7 | 7 | ||
| 8 | #![no_std] | 8 | #![no_std] |
| 9 | #![no_main] | 9 | #![no_main] |
| 10 | #![feature(type_alias_impl_trait)] | ||
| 11 | 10 | ||
| 12 | use defmt::*; | 11 | use defmt::*; |
| 13 | use embassy_executor::Spawner; | 12 | use embassy_executor::Spawner; |
diff --git a/examples/rp/src/bin/usb_ethernet.rs b/examples/rp/src/bin/usb_ethernet.rs index cc63029fb..01f0d5967 100644 --- a/examples/rp/src/bin/usb_ethernet.rs +++ b/examples/rp/src/bin/usb_ethernet.rs | |||
| @@ -4,7 +4,6 @@ | |||
| 4 | 4 | ||
| 5 | #![no_std] | 5 | #![no_std] |
| 6 | #![no_main] | 6 | #![no_main] |
| 7 | #![feature(type_alias_impl_trait)] | ||
| 8 | 7 | ||
| 9 | use defmt::*; | 8 | use defmt::*; |
| 10 | use embassy_executor::Spawner; | 9 | use embassy_executor::Spawner; |
| @@ -17,7 +16,7 @@ use embassy_usb::class::cdc_ncm::embassy_net::{Device, Runner, State as NetState | |||
| 17 | use embassy_usb::class::cdc_ncm::{CdcNcmClass, State}; | 16 | use embassy_usb::class::cdc_ncm::{CdcNcmClass, State}; |
| 18 | use embassy_usb::{Builder, Config, UsbDevice}; | 17 | use embassy_usb::{Builder, Config, UsbDevice}; |
| 19 | use embedded_io_async::Write; | 18 | use embedded_io_async::Write; |
| 20 | use static_cell::make_static; | 19 | use static_cell::StaticCell; |
| 21 | use {defmt_rtt as _, panic_probe as _}; | 20 | use {defmt_rtt as _, panic_probe as _}; |
| 22 | 21 | ||
| 23 | bind_interrupts!(struct Irqs { | 22 | bind_interrupts!(struct Irqs { |
| @@ -65,14 +64,18 @@ async fn main(spawner: Spawner) { | |||
| 65 | config.device_protocol = 0x01; | 64 | config.device_protocol = 0x01; |
| 66 | 65 | ||
| 67 | // Create embassy-usb DeviceBuilder using the driver and config. | 66 | // Create embassy-usb DeviceBuilder using the driver and config. |
| 67 | static DEVICE_DESC: StaticCell<[u8; 256]> = StaticCell::new(); | ||
| 68 | static CONFIG_DESC: StaticCell<[u8; 256]> = StaticCell::new(); | ||
| 69 | static BOS_DESC: StaticCell<[u8; 256]> = StaticCell::new(); | ||
| 70 | static CONTROL_BUF: StaticCell<[u8; 128]> = StaticCell::new(); | ||
| 68 | let mut builder = Builder::new( | 71 | let mut builder = Builder::new( |
| 69 | driver, | 72 | driver, |
| 70 | config, | 73 | config, |
| 71 | &mut make_static!([0; 256])[..], | 74 | &mut DEVICE_DESC.init([0; 256])[..], |
| 72 | &mut make_static!([0; 256])[..], | 75 | &mut CONFIG_DESC.init([0; 256])[..], |
| 73 | &mut make_static!([0; 256])[..], | 76 | &mut BOS_DESC.init([0; 256])[..], |
| 74 | &mut [], // no msos descriptors | 77 | &mut [], // no msos descriptors |
| 75 | &mut make_static!([0; 128])[..], | 78 | &mut CONTROL_BUF.init([0; 128])[..], |
| 76 | ); | 79 | ); |
| 77 | 80 | ||
| 78 | // Our MAC addr. | 81 | // Our MAC addr. |
| @@ -81,14 +84,16 @@ async fn main(spawner: Spawner) { | |||
| 81 | let host_mac_addr = [0x88, 0x88, 0x88, 0x88, 0x88, 0x88]; | 84 | let host_mac_addr = [0x88, 0x88, 0x88, 0x88, 0x88, 0x88]; |
| 82 | 85 | ||
| 83 | // Create classes on the builder. | 86 | // Create classes on the builder. |
| 84 | let class = CdcNcmClass::new(&mut builder, make_static!(State::new()), host_mac_addr, 64); | 87 | static STATE: StaticCell<State> = StaticCell::new(); |
| 88 | let class = CdcNcmClass::new(&mut builder, STATE.init(State::new()), host_mac_addr, 64); | ||
| 85 | 89 | ||
| 86 | // Build the builder. | 90 | // Build the builder. |
| 87 | let usb = builder.build(); | 91 | let usb = builder.build(); |
| 88 | 92 | ||
| 89 | unwrap!(spawner.spawn(usb_task(usb))); | 93 | unwrap!(spawner.spawn(usb_task(usb))); |
| 90 | 94 | ||
| 91 | let (runner, device) = class.into_embassy_net_device::<MTU, 4, 4>(make_static!(NetState::new()), our_mac_addr); | 95 | static NET_STATE: StaticCell<NetState<MTU, 4, 4>> = StaticCell::new(); |
| 96 | let (runner, device) = class.into_embassy_net_device::<MTU, 4, 4>(NET_STATE.init(NetState::new()), our_mac_addr); | ||
| 92 | unwrap!(spawner.spawn(usb_ncm_task(runner))); | 97 | unwrap!(spawner.spawn(usb_ncm_task(runner))); |
| 93 | 98 | ||
| 94 | let config = embassy_net::Config::dhcpv4(Default::default()); | 99 | let config = embassy_net::Config::dhcpv4(Default::default()); |
| @@ -102,11 +107,13 @@ async fn main(spawner: Spawner) { | |||
| 102 | let seed = 1234; // guaranteed random, chosen by a fair dice roll | 107 | let seed = 1234; // guaranteed random, chosen by a fair dice roll |
| 103 | 108 | ||
| 104 | // Init network stack | 109 | // Init network stack |
| 105 | let stack = &*make_static!(Stack::new( | 110 | static STACK: StaticCell<Stack<Device<'static, MTU>>> = StaticCell::new(); |
| 111 | static RESOURCES: StaticCell<StackResources<2>> = StaticCell::new(); | ||
| 112 | let stack = &*STACK.init(Stack::new( | ||
| 106 | device, | 113 | device, |
| 107 | config, | 114 | config, |
| 108 | make_static!(StackResources::<2>::new()), | 115 | RESOURCES.init(StackResources::<2>::new()), |
| 109 | seed | 116 | seed, |
| 110 | )); | 117 | )); |
| 111 | 118 | ||
| 112 | unwrap!(spawner.spawn(net_task(stack))); | 119 | unwrap!(spawner.spawn(net_task(stack))); |
diff --git a/examples/rp/src/bin/usb_hid_keyboard.rs b/examples/rp/src/bin/usb_hid_keyboard.rs index 569c9b12b..b5ac16245 100644 --- a/examples/rp/src/bin/usb_hid_keyboard.rs +++ b/examples/rp/src/bin/usb_hid_keyboard.rs | |||
| @@ -1,6 +1,5 @@ | |||
| 1 | #![no_std] | 1 | #![no_std] |
| 2 | #![no_main] | 2 | #![no_main] |
| 3 | #![feature(type_alias_impl_trait)] | ||
| 4 | 3 | ||
| 5 | use core::sync::atomic::{AtomicBool, Ordering}; | 4 | use core::sync::atomic::{AtomicBool, Ordering}; |
| 6 | 5 | ||
diff --git a/examples/rp/src/bin/usb_logger.rs b/examples/rp/src/bin/usb_logger.rs index 791f15e56..af401ed63 100644 --- a/examples/rp/src/bin/usb_logger.rs +++ b/examples/rp/src/bin/usb_logger.rs | |||
| @@ -4,7 +4,6 @@ | |||
| 4 | 4 | ||
| 5 | #![no_std] | 5 | #![no_std] |
| 6 | #![no_main] | 6 | #![no_main] |
| 7 | #![feature(type_alias_impl_trait)] | ||
| 8 | 7 | ||
| 9 | use embassy_executor::Spawner; | 8 | use embassy_executor::Spawner; |
| 10 | use embassy_rp::bind_interrupts; | 9 | use embassy_rp::bind_interrupts; |
diff --git a/examples/rp/src/bin/usb_midi.rs b/examples/rp/src/bin/usb_midi.rs index d5cdae319..95306a35c 100644 --- a/examples/rp/src/bin/usb_midi.rs +++ b/examples/rp/src/bin/usb_midi.rs | |||
| @@ -4,7 +4,6 @@ | |||
| 4 | 4 | ||
| 5 | #![no_std] | 5 | #![no_std] |
| 6 | #![no_main] | 6 | #![no_main] |
| 7 | #![feature(type_alias_impl_trait)] | ||
| 8 | 7 | ||
| 9 | use defmt::{info, panic}; | 8 | use defmt::{info, panic}; |
| 10 | use embassy_executor::Spawner; | 9 | use embassy_executor::Spawner; |
diff --git a/examples/rp/src/bin/usb_raw.rs b/examples/rp/src/bin/usb_raw.rs index f59262e5c..a6c8a5b2e 100644 --- a/examples/rp/src/bin/usb_raw.rs +++ b/examples/rp/src/bin/usb_raw.rs | |||
| @@ -48,7 +48,6 @@ | |||
| 48 | 48 | ||
| 49 | #![no_std] | 49 | #![no_std] |
| 50 | #![no_main] | 50 | #![no_main] |
| 51 | #![feature(type_alias_impl_trait)] | ||
| 52 | 51 | ||
| 53 | use defmt::info; | 52 | use defmt::info; |
| 54 | use embassy_executor::Spawner; | 53 | use embassy_executor::Spawner; |
diff --git a/examples/rp/src/bin/usb_raw_bulk.rs b/examples/rp/src/bin/usb_raw_bulk.rs index 288be5a4e..0dc8e9f72 100644 --- a/examples/rp/src/bin/usb_raw_bulk.rs +++ b/examples/rp/src/bin/usb_raw_bulk.rs | |||
| @@ -26,7 +26,6 @@ | |||
| 26 | 26 | ||
| 27 | #![no_std] | 27 | #![no_std] |
| 28 | #![no_main] | 28 | #![no_main] |
| 29 | #![feature(type_alias_impl_trait)] | ||
| 30 | 29 | ||
| 31 | use defmt::info; | 30 | use defmt::info; |
| 32 | use embassy_executor::Spawner; | 31 | use embassy_executor::Spawner; |
diff --git a/examples/rp/src/bin/usb_serial.rs b/examples/rp/src/bin/usb_serial.rs index 30347d920..ab24a994c 100644 --- a/examples/rp/src/bin/usb_serial.rs +++ b/examples/rp/src/bin/usb_serial.rs | |||
| @@ -4,7 +4,6 @@ | |||
| 4 | 4 | ||
| 5 | #![no_std] | 5 | #![no_std] |
| 6 | #![no_main] | 6 | #![no_main] |
| 7 | #![feature(type_alias_impl_trait)] | ||
| 8 | 7 | ||
| 9 | use defmt::{info, panic}; | 8 | use defmt::{info, panic}; |
| 10 | use embassy_executor::Spawner; | 9 | use embassy_executor::Spawner; |
diff --git a/examples/rp/src/bin/watchdog.rs b/examples/rp/src/bin/watchdog.rs index b6af518af..b9d4ef22f 100644 --- a/examples/rp/src/bin/watchdog.rs +++ b/examples/rp/src/bin/watchdog.rs | |||
| @@ -4,7 +4,6 @@ | |||
| 4 | 4 | ||
| 5 | #![no_std] | 5 | #![no_std] |
| 6 | #![no_main] | 6 | #![no_main] |
| 7 | #![feature(type_alias_impl_trait)] | ||
| 8 | 7 | ||
| 9 | use defmt::info; | 8 | use defmt::info; |
| 10 | use embassy_executor::Spawner; | 9 | use embassy_executor::Spawner; |
diff --git a/examples/rp/src/bin/wifi_ap_tcp_server.rs b/examples/rp/src/bin/wifi_ap_tcp_server.rs index ad1fa6462..1bd75607e 100644 --- a/examples/rp/src/bin/wifi_ap_tcp_server.rs +++ b/examples/rp/src/bin/wifi_ap_tcp_server.rs | |||
| @@ -3,7 +3,6 @@ | |||
| 3 | 3 | ||
| 4 | #![no_std] | 4 | #![no_std] |
| 5 | #![no_main] | 5 | #![no_main] |
| 6 | #![feature(type_alias_impl_trait)] | ||
| 7 | #![allow(async_fn_in_trait)] | 6 | #![allow(async_fn_in_trait)] |
| 8 | 7 | ||
| 9 | use core::str::from_utf8; | 8 | use core::str::from_utf8; |
| @@ -19,7 +18,7 @@ use embassy_rp::peripherals::{DMA_CH0, PIN_23, PIN_25, PIO0}; | |||
| 19 | use embassy_rp::pio::{InterruptHandler, Pio}; | 18 | use embassy_rp::pio::{InterruptHandler, Pio}; |
| 20 | use embassy_time::Duration; | 19 | use embassy_time::Duration; |
| 21 | use embedded_io_async::Write; | 20 | use embedded_io_async::Write; |
| 22 | use static_cell::make_static; | 21 | use static_cell::StaticCell; |
| 23 | use {defmt_rtt as _, panic_probe as _}; | 22 | use {defmt_rtt as _, panic_probe as _}; |
| 24 | 23 | ||
| 25 | bind_interrupts!(struct Irqs { | 24 | bind_interrupts!(struct Irqs { |
| @@ -59,7 +58,8 @@ async fn main(spawner: Spawner) { | |||
| 59 | let mut pio = Pio::new(p.PIO0, Irqs); | 58 | let mut pio = Pio::new(p.PIO0, Irqs); |
| 60 | let spi = PioSpi::new(&mut pio.common, pio.sm0, pio.irq0, cs, p.PIN_24, p.PIN_29, p.DMA_CH0); | 59 | let spi = PioSpi::new(&mut pio.common, pio.sm0, pio.irq0, cs, p.PIN_24, p.PIN_29, p.DMA_CH0); |
| 61 | 60 | ||
| 62 | let state = make_static!(cyw43::State::new()); | 61 | static STATE: StaticCell<cyw43::State> = StaticCell::new(); |
| 62 | let state = STATE.init(cyw43::State::new()); | ||
| 63 | let (net_device, mut control, runner) = cyw43::new(state, pwr, spi, fw).await; | 63 | let (net_device, mut control, runner) = cyw43::new(state, pwr, spi, fw).await; |
| 64 | unwrap!(spawner.spawn(wifi_task(runner))); | 64 | unwrap!(spawner.spawn(wifi_task(runner))); |
| 65 | 65 | ||
| @@ -79,11 +79,13 @@ async fn main(spawner: Spawner) { | |||
| 79 | let seed = 0x0123_4567_89ab_cdef; // chosen by fair dice roll. guarenteed to be random. | 79 | let seed = 0x0123_4567_89ab_cdef; // chosen by fair dice roll. guarenteed to be random. |
| 80 | 80 | ||
| 81 | // Init network stack | 81 | // Init network stack |
| 82 | let stack = &*make_static!(Stack::new( | 82 | static STACK: StaticCell<Stack<cyw43::NetDriver<'static>>> = StaticCell::new(); |
| 83 | static RESOURCES: StaticCell<StackResources<2>> = StaticCell::new(); | ||
| 84 | let stack = &*STACK.init(Stack::new( | ||
| 83 | net_device, | 85 | net_device, |
| 84 | config, | 86 | config, |
| 85 | make_static!(StackResources::<2>::new()), | 87 | RESOURCES.init(StackResources::<2>::new()), |
| 86 | seed | 88 | seed, |
| 87 | )); | 89 | )); |
| 88 | 90 | ||
| 89 | unwrap!(spawner.spawn(net_task(stack))); | 91 | unwrap!(spawner.spawn(net_task(stack))); |
diff --git a/examples/rp/src/bin/wifi_blinky.rs b/examples/rp/src/bin/wifi_blinky.rs index 14ace74e9..1ed74993c 100644 --- a/examples/rp/src/bin/wifi_blinky.rs +++ b/examples/rp/src/bin/wifi_blinky.rs | |||
| @@ -4,7 +4,6 @@ | |||
| 4 | 4 | ||
| 5 | #![no_std] | 5 | #![no_std] |
| 6 | #![no_main] | 6 | #![no_main] |
| 7 | #![feature(type_alias_impl_trait)] | ||
| 8 | 7 | ||
| 9 | use cyw43_pio::PioSpi; | 8 | use cyw43_pio::PioSpi; |
| 10 | use defmt::*; | 9 | use defmt::*; |
| @@ -14,7 +13,7 @@ use embassy_rp::gpio::{Level, Output}; | |||
| 14 | use embassy_rp::peripherals::{DMA_CH0, PIN_23, PIN_25, PIO0}; | 13 | use embassy_rp::peripherals::{DMA_CH0, PIN_23, PIN_25, PIO0}; |
| 15 | use embassy_rp::pio::{InterruptHandler, Pio}; | 14 | use embassy_rp::pio::{InterruptHandler, Pio}; |
| 16 | use embassy_time::{Duration, Timer}; | 15 | use embassy_time::{Duration, Timer}; |
| 17 | use static_cell::make_static; | 16 | use static_cell::StaticCell; |
| 18 | use {defmt_rtt as _, panic_probe as _}; | 17 | use {defmt_rtt as _, panic_probe as _}; |
| 19 | 18 | ||
| 20 | bind_interrupts!(struct Irqs { | 19 | bind_interrupts!(struct Irqs { |
| @@ -46,7 +45,8 @@ async fn main(spawner: Spawner) { | |||
| 46 | let mut pio = Pio::new(p.PIO0, Irqs); | 45 | let mut pio = Pio::new(p.PIO0, Irqs); |
| 47 | let spi = PioSpi::new(&mut pio.common, pio.sm0, pio.irq0, cs, p.PIN_24, p.PIN_29, p.DMA_CH0); | 46 | let spi = PioSpi::new(&mut pio.common, pio.sm0, pio.irq0, cs, p.PIN_24, p.PIN_29, p.DMA_CH0); |
| 48 | 47 | ||
| 49 | let state = make_static!(cyw43::State::new()); | 48 | static STATE: StaticCell<cyw43::State> = StaticCell::new(); |
| 49 | let state = STATE.init(cyw43::State::new()); | ||
| 50 | let (_net_device, mut control, runner) = cyw43::new(state, pwr, spi, fw).await; | 50 | let (_net_device, mut control, runner) = cyw43::new(state, pwr, spi, fw).await; |
| 51 | unwrap!(spawner.spawn(wifi_task(runner))); | 51 | unwrap!(spawner.spawn(wifi_task(runner))); |
| 52 | 52 | ||
diff --git a/examples/rp/src/bin/wifi_scan.rs b/examples/rp/src/bin/wifi_scan.rs index 7adf52b88..45bb5b76c 100644 --- a/examples/rp/src/bin/wifi_scan.rs +++ b/examples/rp/src/bin/wifi_scan.rs | |||
| @@ -3,7 +3,6 @@ | |||
| 3 | 3 | ||
| 4 | #![no_std] | 4 | #![no_std] |
| 5 | #![no_main] | 5 | #![no_main] |
| 6 | #![feature(type_alias_impl_trait)] | ||
| 7 | #![allow(async_fn_in_trait)] | 6 | #![allow(async_fn_in_trait)] |
| 8 | 7 | ||
| 9 | use core::str; | 8 | use core::str; |
| @@ -16,7 +15,7 @@ use embassy_rp::bind_interrupts; | |||
| 16 | use embassy_rp::gpio::{Level, Output}; | 15 | use embassy_rp::gpio::{Level, Output}; |
| 17 | use embassy_rp::peripherals::{DMA_CH0, PIN_23, PIN_25, PIO0}; | 16 | use embassy_rp::peripherals::{DMA_CH0, PIN_23, PIN_25, PIO0}; |
| 18 | use embassy_rp::pio::{InterruptHandler, Pio}; | 17 | use embassy_rp::pio::{InterruptHandler, Pio}; |
| 19 | use static_cell::make_static; | 18 | use static_cell::StaticCell; |
| 20 | use {defmt_rtt as _, panic_probe as _}; | 19 | use {defmt_rtt as _, panic_probe as _}; |
| 21 | 20 | ||
| 22 | bind_interrupts!(struct Irqs { | 21 | bind_interrupts!(struct Irqs { |
| @@ -56,7 +55,8 @@ async fn main(spawner: Spawner) { | |||
| 56 | let mut pio = Pio::new(p.PIO0, Irqs); | 55 | let mut pio = Pio::new(p.PIO0, Irqs); |
| 57 | let spi = PioSpi::new(&mut pio.common, pio.sm0, pio.irq0, cs, p.PIN_24, p.PIN_29, p.DMA_CH0); | 56 | let spi = PioSpi::new(&mut pio.common, pio.sm0, pio.irq0, cs, p.PIN_24, p.PIN_29, p.DMA_CH0); |
| 58 | 57 | ||
| 59 | let state = make_static!(cyw43::State::new()); | 58 | static STATE: StaticCell<cyw43::State> = StaticCell::new(); |
| 59 | let state = STATE.init(cyw43::State::new()); | ||
| 60 | let (_net_device, mut control, runner) = cyw43::new(state, pwr, spi, fw).await; | 60 | let (_net_device, mut control, runner) = cyw43::new(state, pwr, spi, fw).await; |
| 61 | unwrap!(spawner.spawn(wifi_task(runner))); | 61 | unwrap!(spawner.spawn(wifi_task(runner))); |
| 62 | 62 | ||
diff --git a/examples/rp/src/bin/wifi_tcp_server.rs b/examples/rp/src/bin/wifi_tcp_server.rs index ec6b4ee74..c346f1ded 100644 --- a/examples/rp/src/bin/wifi_tcp_server.rs +++ b/examples/rp/src/bin/wifi_tcp_server.rs | |||
| @@ -3,7 +3,6 @@ | |||
| 3 | 3 | ||
| 4 | #![no_std] | 4 | #![no_std] |
| 5 | #![no_main] | 5 | #![no_main] |
| 6 | #![feature(type_alias_impl_trait)] | ||
| 7 | #![allow(async_fn_in_trait)] | 6 | #![allow(async_fn_in_trait)] |
| 8 | 7 | ||
| 9 | use core::str::from_utf8; | 8 | use core::str::from_utf8; |
| @@ -19,7 +18,7 @@ use embassy_rp::peripherals::{DMA_CH0, PIN_23, PIN_25, PIO0}; | |||
| 19 | use embassy_rp::pio::{InterruptHandler, Pio}; | 18 | use embassy_rp::pio::{InterruptHandler, Pio}; |
| 20 | use embassy_time::{Duration, Timer}; | 19 | use embassy_time::{Duration, Timer}; |
| 21 | use embedded_io_async::Write; | 20 | use embedded_io_async::Write; |
| 22 | use static_cell::make_static; | 21 | use static_cell::StaticCell; |
| 23 | use {defmt_rtt as _, panic_probe as _}; | 22 | use {defmt_rtt as _, panic_probe as _}; |
| 24 | 23 | ||
| 25 | bind_interrupts!(struct Irqs { | 24 | bind_interrupts!(struct Irqs { |
| @@ -62,7 +61,8 @@ async fn main(spawner: Spawner) { | |||
| 62 | let mut pio = Pio::new(p.PIO0, Irqs); | 61 | let mut pio = Pio::new(p.PIO0, Irqs); |
| 63 | let spi = PioSpi::new(&mut pio.common, pio.sm0, pio.irq0, cs, p.PIN_24, p.PIN_29, p.DMA_CH0); | 62 | let spi = PioSpi::new(&mut pio.common, pio.sm0, pio.irq0, cs, p.PIN_24, p.PIN_29, p.DMA_CH0); |
| 64 | 63 | ||
| 65 | let state = make_static!(cyw43::State::new()); | 64 | static STATE: StaticCell<cyw43::State> = StaticCell::new(); |
| 65 | let state = STATE.init(cyw43::State::new()); | ||
| 66 | let (net_device, mut control, runner) = cyw43::new(state, pwr, spi, fw).await; | 66 | let (net_device, mut control, runner) = cyw43::new(state, pwr, spi, fw).await; |
| 67 | unwrap!(spawner.spawn(wifi_task(runner))); | 67 | unwrap!(spawner.spawn(wifi_task(runner))); |
| 68 | 68 | ||
| @@ -82,11 +82,13 @@ async fn main(spawner: Spawner) { | |||
| 82 | let seed = 0x0123_4567_89ab_cdef; // chosen by fair dice roll. guarenteed to be random. | 82 | let seed = 0x0123_4567_89ab_cdef; // chosen by fair dice roll. guarenteed to be random. |
| 83 | 83 | ||
| 84 | // Init network stack | 84 | // Init network stack |
| 85 | let stack = &*make_static!(Stack::new( | 85 | static STACK: StaticCell<Stack<cyw43::NetDriver<'static>>> = StaticCell::new(); |
| 86 | static RESOURCES: StaticCell<StackResources<2>> = StaticCell::new(); | ||
| 87 | let stack = &*STACK.init(Stack::new( | ||
| 86 | net_device, | 88 | net_device, |
| 87 | config, | 89 | config, |
| 88 | make_static!(StackResources::<2>::new()), | 90 | RESOURCES.init(StackResources::<2>::new()), |
| 89 | seed | 91 | seed, |
| 90 | )); | 92 | )); |
| 91 | 93 | ||
| 92 | unwrap!(spawner.spawn(net_task(stack))); | 94 | unwrap!(spawner.spawn(net_task(stack))); |
