diff options
Diffstat (limited to 'examples')
26 files changed, 209 insertions, 63 deletions
diff --git a/examples/boot/application/rp/src/bin/a.rs b/examples/boot/application/rp/src/bin/a.rs index f0dda39d0..15fdaca82 100644 --- a/examples/boot/application/rp/src/bin/a.rs +++ b/examples/boot/application/rp/src/bin/a.rs | |||
| @@ -7,7 +7,7 @@ use core::cell::RefCell; | |||
| 7 | use defmt_rtt as _; | 7 | use defmt_rtt as _; |
| 8 | use embassy_boot_rp::*; | 8 | use embassy_boot_rp::*; |
| 9 | use embassy_executor::Spawner; | 9 | use embassy_executor::Spawner; |
| 10 | use embassy_rp::flash::{self, Flash}; | 10 | use embassy_rp::flash::Flash; |
| 11 | use embassy_rp::gpio::{Level, Output}; | 11 | use embassy_rp::gpio::{Level, Output}; |
| 12 | use embassy_rp::watchdog::Watchdog; | 12 | use embassy_rp::watchdog::Watchdog; |
| 13 | use embassy_sync::blocking_mutex::Mutex; | 13 | use embassy_sync::blocking_mutex::Mutex; |
| @@ -34,7 +34,7 @@ async fn main(_s: Spawner) { | |||
| 34 | let mut watchdog = Watchdog::new(p.WATCHDOG); | 34 | let mut watchdog = Watchdog::new(p.WATCHDOG); |
| 35 | watchdog.start(Duration::from_secs(8)); | 35 | watchdog.start(Duration::from_secs(8)); |
| 36 | 36 | ||
| 37 | let flash = Flash::<_, flash::Blocking, FLASH_SIZE>::new(p.FLASH); | 37 | let flash = Flash::<_, _, FLASH_SIZE>::new_blocking(p.FLASH); |
| 38 | let flash = Mutex::new(RefCell::new(flash)); | 38 | let flash = Mutex::new(RefCell::new(flash)); |
| 39 | 39 | ||
| 40 | let config = FirmwareUpdaterConfig::from_linkerfile_blocking(&flash); | 40 | let config = FirmwareUpdaterConfig::from_linkerfile_blocking(&flash); |
diff --git a/examples/boot/bootloader/nrf/src/main.rs b/examples/boot/bootloader/nrf/src/main.rs index 72c95c02a..74e2e293f 100644 --- a/examples/boot/bootloader/nrf/src/main.rs +++ b/examples/boot/bootloader/nrf/src/main.rs | |||
| @@ -33,9 +33,7 @@ fn main() -> ! { | |||
| 33 | 33 | ||
| 34 | let config = BootLoaderConfig::from_linkerfile_blocking(&flash); | 34 | let config = BootLoaderConfig::from_linkerfile_blocking(&flash); |
| 35 | let active_offset = config.active.offset(); | 35 | let active_offset = config.active.offset(); |
| 36 | let mut bl: BootLoader<_, _, _> = BootLoader::new(config); | 36 | let bl: BootLoader = BootLoader::prepare(config); |
| 37 | |||
| 38 | bl.prepare(); | ||
| 39 | 37 | ||
| 40 | unsafe { bl.load(active_offset) } | 38 | unsafe { bl.load(active_offset) } |
| 41 | } | 39 | } |
diff --git a/examples/boot/bootloader/rp/src/main.rs b/examples/boot/bootloader/rp/src/main.rs index 6a81db804..c0e75d1ea 100644 --- a/examples/boot/bootloader/rp/src/main.rs +++ b/examples/boot/bootloader/rp/src/main.rs | |||
| @@ -29,9 +29,7 @@ fn main() -> ! { | |||
| 29 | 29 | ||
| 30 | let config = BootLoaderConfig::from_linkerfile_blocking(&flash); | 30 | let config = BootLoaderConfig::from_linkerfile_blocking(&flash); |
| 31 | let active_offset = config.active.offset(); | 31 | let active_offset = config.active.offset(); |
| 32 | let mut bl: BootLoader<_, _, _> = BootLoader::new(config); | 32 | let bl: BootLoader = BootLoader::prepare(config); |
| 33 | |||
| 34 | bl.prepare(); | ||
| 35 | 33 | ||
| 36 | unsafe { bl.load(embassy_rp::flash::FLASH_BASE as u32 + active_offset) } | 34 | unsafe { bl.load(embassy_rp::flash::FLASH_BASE as u32 + active_offset) } |
| 37 | } | 35 | } |
diff --git a/examples/boot/bootloader/stm32/src/main.rs b/examples/boot/bootloader/stm32/src/main.rs index 262eed200..5fd9ea588 100644 --- a/examples/boot/bootloader/stm32/src/main.rs +++ b/examples/boot/bootloader/stm32/src/main.rs | |||
| @@ -27,9 +27,7 @@ fn main() -> ! { | |||
| 27 | 27 | ||
| 28 | let config = BootLoaderConfig::from_linkerfile_blocking(&flash); | 28 | let config = BootLoaderConfig::from_linkerfile_blocking(&flash); |
| 29 | let active_offset = config.active.offset(); | 29 | let active_offset = config.active.offset(); |
| 30 | let mut bl: BootLoader<_, _, _, 2048> = BootLoader::new(config); | 30 | let bl = BootLoader::prepare::<_, _, _, 2048>(config); |
| 31 | |||
| 32 | bl.prepare(); | ||
| 33 | 31 | ||
| 34 | unsafe { bl.load(BANK1_REGION.base + active_offset) } | 32 | unsafe { bl.load(BANK1_REGION.base + active_offset) } |
| 35 | } | 33 | } |
diff --git a/examples/nrf52840/Cargo.toml b/examples/nrf52840/Cargo.toml index 15fe22d3a..2ce44b516 100644 --- a/examples/nrf52840/Cargo.toml +++ b/examples/nrf52840/Cargo.toml | |||
| @@ -12,12 +12,14 @@ nightly = [ | |||
| 12 | "embassy-nrf/nightly", | 12 | "embassy-nrf/nightly", |
| 13 | "embassy-net/nightly", | 13 | "embassy-net/nightly", |
| 14 | "embassy-net-esp-hosted", | 14 | "embassy-net-esp-hosted", |
| 15 | "embassy-net-enc28j60", | ||
| 15 | "embassy-nrf/unstable-traits", | 16 | "embassy-nrf/unstable-traits", |
| 16 | "embassy-time/nightly", | 17 | "embassy-time/nightly", |
| 17 | "embassy-time/unstable-traits", | 18 | "embassy-time/unstable-traits", |
| 18 | "static_cell/nightly", | 19 | "static_cell/nightly", |
| 19 | "embassy-usb", | 20 | "embassy-usb", |
| 20 | "embedded-io-async", | 21 | "embedded-io-async", |
| 22 | "embedded-hal-bus/async", | ||
| 21 | "embassy-net", | 23 | "embassy-net", |
| 22 | "embassy-lora", | 24 | "embassy-lora", |
| 23 | "lora-phy", | 25 | "lora-phy", |
| @@ -40,6 +42,7 @@ lora-phy = { version = "1", optional = true } | |||
| 40 | lorawan-device = { version = "0.10.0", default-features = false, features = ["async", "external-lora-phy"], optional = true } | 42 | lorawan-device = { version = "0.10.0", default-features = false, features = ["async", "external-lora-phy"], optional = true } |
| 41 | lorawan = { version = "0.7.3", default-features = false, features = ["default-crypto"], optional = true } | 43 | lorawan = { version = "0.7.3", default-features = false, features = ["default-crypto"], optional = true } |
| 42 | embassy-net-esp-hosted = { version = "0.1.0", path = "../../embassy-net-esp-hosted", features = ["defmt"], optional = true } | 44 | embassy-net-esp-hosted = { version = "0.1.0", path = "../../embassy-net-esp-hosted", features = ["defmt"], optional = true } |
| 45 | embassy-net-enc28j60 = { version = "0.1.0", path = "../../embassy-net-enc28j60", features = ["defmt"], optional = true } | ||
| 43 | 46 | ||
| 44 | defmt = "0.3" | 47 | defmt = "0.3" |
| 45 | defmt-rtt = "0.4" | 48 | defmt-rtt = "0.4" |
| @@ -54,9 +57,14 @@ rand = { version = "0.8.4", default-features = false } | |||
| 54 | embedded-storage = "0.3.0" | 57 | embedded-storage = "0.3.0" |
| 55 | usbd-hid = "0.6.0" | 58 | usbd-hid = "0.6.0" |
| 56 | serde = { version = "1.0.136", default-features = false } | 59 | serde = { version = "1.0.136", default-features = false } |
| 57 | embedded-hal-async = { version = "0.2.0-alpha.2", optional = true } | 60 | embedded-hal = { version = "1.0.0-rc.1" } |
| 61 | embedded-hal-async = { version = "1.0.0-rc.1", optional = true } | ||
| 62 | embedded-hal-bus = { version = "0.1.0-rc.1" } | ||
| 58 | num-integer = { version = "0.1.45", default-features = false } | 63 | num-integer = { version = "0.1.45", default-features = false } |
| 59 | microfft = "0.5.0" | 64 | microfft = "0.5.0" |
| 60 | 65 | ||
| 61 | [profile.release] | 66 | [profile.release] |
| 62 | debug = 2 | 67 | debug = 2 |
| 68 | |||
| 69 | [patch.crates-io] | ||
| 70 | lora-phy = { git = "https://github.com/embassy-rs/lora-phy", rev = "1323eccc1c470d4259f95f4f315d1be830d572a3"} \ No newline at end of file | ||
diff --git a/examples/nrf52840/src/bin/channel.rs b/examples/nrf52840/src/bin/channel.rs index d782a79e7..bd9c909da 100644 --- a/examples/nrf52840/src/bin/channel.rs +++ b/examples/nrf52840/src/bin/channel.rs | |||
| @@ -35,7 +35,7 @@ async fn main(spawner: Spawner) { | |||
| 35 | unwrap!(spawner.spawn(my_task())); | 35 | unwrap!(spawner.spawn(my_task())); |
| 36 | 36 | ||
| 37 | loop { | 37 | loop { |
| 38 | match CHANNEL.recv().await { | 38 | match CHANNEL.receive().await { |
| 39 | LedState::On => led.set_high(), | 39 | LedState::On => led.set_high(), |
| 40 | LedState::Off => led.set_low(), | 40 | LedState::Off => led.set_low(), |
| 41 | } | 41 | } |
diff --git a/examples/nrf52840/src/bin/channel_sender_receiver.rs b/examples/nrf52840/src/bin/channel_sender_receiver.rs index fcccdaed5..ec4f1d800 100644 --- a/examples/nrf52840/src/bin/channel_sender_receiver.rs +++ b/examples/nrf52840/src/bin/channel_sender_receiver.rs | |||
| @@ -33,7 +33,7 @@ async fn recv_task(led: AnyPin, receiver: Receiver<'static, NoopRawMutex, LedSta | |||
| 33 | let mut led = Output::new(led, Level::Low, OutputDrive::Standard); | 33 | let mut led = Output::new(led, Level::Low, OutputDrive::Standard); |
| 34 | 34 | ||
| 35 | loop { | 35 | loop { |
| 36 | match receiver.recv().await { | 36 | match receiver.receive().await { |
| 37 | LedState::On => led.set_high(), | 37 | LedState::On => led.set_high(), |
| 38 | LedState::Off => led.set_low(), | 38 | LedState::Off => led.set_low(), |
| 39 | } | 39 | } |
diff --git a/examples/nrf52840/src/bin/ethernet_enc28j60.rs b/examples/nrf52840/src/bin/ethernet_enc28j60.rs new file mode 100644 index 000000000..d1b796fab --- /dev/null +++ b/examples/nrf52840/src/bin/ethernet_enc28j60.rs | |||
| @@ -0,0 +1,124 @@ | |||
| 1 | #![no_std] | ||
| 2 | #![no_main] | ||
| 3 | #![feature(type_alias_impl_trait)] | ||
| 4 | |||
| 5 | use defmt::*; | ||
| 6 | use embassy_executor::Spawner; | ||
| 7 | use embassy_net::tcp::TcpSocket; | ||
| 8 | use embassy_net::{Stack, StackResources}; | ||
| 9 | use embassy_net_enc28j60::Enc28j60; | ||
| 10 | use embassy_nrf::gpio::{Level, Output, OutputDrive}; | ||
| 11 | use embassy_nrf::rng::Rng; | ||
| 12 | use embassy_nrf::spim::Spim; | ||
| 13 | use embassy_nrf::{bind_interrupts, peripherals, spim}; | ||
| 14 | use embassy_time::Delay; | ||
| 15 | use embedded_hal_bus::spi::ExclusiveDevice; | ||
| 16 | use embedded_io_async::Write; | ||
| 17 | use static_cell::make_static; | ||
| 18 | use {defmt_rtt as _, panic_probe as _}; | ||
| 19 | |||
| 20 | bind_interrupts!(struct Irqs { | ||
| 21 | SPIM3 => spim::InterruptHandler<peripherals::SPI3>; | ||
| 22 | RNG => embassy_nrf::rng::InterruptHandler<peripherals::RNG>; | ||
| 23 | }); | ||
| 24 | |||
| 25 | #[embassy_executor::task] | ||
| 26 | async fn net_task( | ||
| 27 | stack: &'static Stack< | ||
| 28 | Enc28j60< | ||
| 29 | ExclusiveDevice<Spim<'static, peripherals::SPI3>, Output<'static, peripherals::P0_15>, Delay>, | ||
| 30 | Output<'static, peripherals::P0_13>, | ||
| 31 | >, | ||
| 32 | >, | ||
| 33 | ) -> ! { | ||
| 34 | stack.run().await | ||
| 35 | } | ||
| 36 | |||
| 37 | #[embassy_executor::main] | ||
| 38 | async fn main(spawner: Spawner) { | ||
| 39 | let p = embassy_nrf::init(Default::default()); | ||
| 40 | info!("running!"); | ||
| 41 | |||
| 42 | let eth_sck = p.P0_20; | ||
| 43 | let eth_mosi = p.P0_22; | ||
| 44 | let eth_miso = p.P0_24; | ||
| 45 | let eth_cs = p.P0_15; | ||
| 46 | let eth_rst = p.P0_13; | ||
| 47 | let _eth_irq = p.P0_12; | ||
| 48 | |||
| 49 | let mut config = spim::Config::default(); | ||
| 50 | config.frequency = spim::Frequency::M16; | ||
| 51 | let spi = spim::Spim::new(p.SPI3, Irqs, eth_sck, eth_miso, eth_mosi, config); | ||
| 52 | let cs = Output::new(eth_cs, Level::High, OutputDrive::Standard); | ||
| 53 | let spi = ExclusiveDevice::new(spi, cs, Delay); | ||
| 54 | |||
| 55 | let rst = Output::new(eth_rst, Level::High, OutputDrive::Standard); | ||
| 56 | let mac_addr = [2, 3, 4, 5, 6, 7]; | ||
| 57 | let device = Enc28j60::new(spi, Some(rst), mac_addr); | ||
| 58 | |||
| 59 | let config = embassy_net::Config::dhcpv4(Default::default()); | ||
| 60 | // let config = embassy_net::Config::ipv4_static(embassy_net::StaticConfigV4 { | ||
| 61 | // address: Ipv4Cidr::new(Ipv4Address::new(10, 42, 0, 61), 24), | ||
| 62 | // dns_servers: Vec::new(), | ||
| 63 | // gateway: Some(Ipv4Address::new(10, 42, 0, 1)), | ||
| 64 | // }); | ||
| 65 | |||
| 66 | // Generate random seed | ||
| 67 | let mut rng = Rng::new(p.RNG, Irqs); | ||
| 68 | let mut seed = [0; 8]; | ||
| 69 | rng.blocking_fill_bytes(&mut seed); | ||
| 70 | let seed = u64::from_le_bytes(seed); | ||
| 71 | |||
| 72 | // Init network stack | ||
| 73 | let stack = &*make_static!(Stack::new( | ||
| 74 | device, | ||
| 75 | config, | ||
| 76 | make_static!(StackResources::<2>::new()), | ||
| 77 | seed | ||
| 78 | )); | ||
| 79 | |||
| 80 | unwrap!(spawner.spawn(net_task(stack))); | ||
| 81 | |||
| 82 | // And now we can use it! | ||
| 83 | |||
| 84 | let mut rx_buffer = [0; 4096]; | ||
| 85 | let mut tx_buffer = [0; 4096]; | ||
| 86 | let mut buf = [0; 4096]; | ||
| 87 | |||
| 88 | loop { | ||
| 89 | let mut socket = TcpSocket::new(stack, &mut rx_buffer, &mut tx_buffer); | ||
| 90 | socket.set_timeout(Some(embassy_time::Duration::from_secs(10))); | ||
| 91 | |||
| 92 | info!("Listening on TCP:1234..."); | ||
| 93 | if let Err(e) = socket.accept(1234).await { | ||
| 94 | warn!("accept error: {:?}", e); | ||
| 95 | continue; | ||
| 96 | } | ||
| 97 | |||
| 98 | info!("Received connection from {:?}", socket.remote_endpoint()); | ||
| 99 | |||
| 100 | loop { | ||
| 101 | let n = match socket.read(&mut buf).await { | ||
| 102 | Ok(0) => { | ||
| 103 | warn!("read EOF"); | ||
| 104 | break; | ||
| 105 | } | ||
| 106 | Ok(n) => n, | ||
| 107 | Err(e) => { | ||
| 108 | warn!("read error: {:?}", e); | ||
| 109 | break; | ||
| 110 | } | ||
| 111 | }; | ||
| 112 | |||
| 113 | info!("rxd {:02x}", &buf[..n]); | ||
| 114 | |||
| 115 | match socket.write_all(&buf[..n]).await { | ||
| 116 | Ok(()) => {} | ||
| 117 | Err(e) => { | ||
| 118 | warn!("write error: {:?}", e); | ||
| 119 | break; | ||
| 120 | } | ||
| 121 | }; | ||
| 122 | } | ||
| 123 | } | ||
| 124 | } | ||
diff --git a/examples/nrf52840/src/bin/uart_split.rs b/examples/nrf52840/src/bin/uart_split.rs index 9979a1d53..b748bfcd8 100644 --- a/examples/nrf52840/src/bin/uart_split.rs +++ b/examples/nrf52840/src/bin/uart_split.rs | |||
| @@ -46,7 +46,7 @@ async fn main(spawner: Spawner) { | |||
| 46 | // back out the buffer we receive from the read | 46 | // back out the buffer we receive from the read |
| 47 | // task. | 47 | // task. |
| 48 | loop { | 48 | loop { |
| 49 | let buf = CHANNEL.recv().await; | 49 | let buf = CHANNEL.receive().await; |
| 50 | info!("writing..."); | 50 | info!("writing..."); |
| 51 | unwrap!(tx.write(&buf).await); | 51 | unwrap!(tx.write(&buf).await); |
| 52 | } | 52 | } |
diff --git a/examples/nrf52840/src/bin/wifi_esp_hosted.rs b/examples/nrf52840/src/bin/wifi_esp_hosted.rs index e3b80d821..a60822fd9 100644 --- a/examples/nrf52840/src/bin/wifi_esp_hosted.rs +++ b/examples/nrf52840/src/bin/wifi_esp_hosted.rs | |||
| @@ -11,7 +11,7 @@ use embassy_nrf::rng::Rng; | |||
| 11 | use embassy_nrf::spim::{self, Spim}; | 11 | use embassy_nrf::spim::{self, Spim}; |
| 12 | use embassy_nrf::{bind_interrupts, peripherals}; | 12 | use embassy_nrf::{bind_interrupts, peripherals}; |
| 13 | use embassy_time::Delay; | 13 | use embassy_time::Delay; |
| 14 | use embedded_hal_async::spi::ExclusiveDevice; | 14 | use embedded_hal_bus::spi::ExclusiveDevice; |
| 15 | use embedded_io_async::Write; | 15 | use embedded_io_async::Write; |
| 16 | use static_cell::make_static; | 16 | use static_cell::make_static; |
| 17 | use {defmt_rtt as _, embassy_net_esp_hosted as hosted, panic_probe as _}; | 17 | use {defmt_rtt as _, embassy_net_esp_hosted as hosted, panic_probe as _}; |
| @@ -72,8 +72,8 @@ async fn main(spawner: Spawner) { | |||
| 72 | 72 | ||
| 73 | unwrap!(spawner.spawn(wifi_task(runner))); | 73 | unwrap!(spawner.spawn(wifi_task(runner))); |
| 74 | 74 | ||
| 75 | control.init().await; | 75 | unwrap!(control.init().await); |
| 76 | control.join(WIFI_NETWORK, WIFI_PASSWORD).await; | 76 | unwrap!(control.connect(WIFI_NETWORK, WIFI_PASSWORD).await); |
| 77 | 77 | ||
| 78 | let config = embassy_net::Config::dhcpv4(Default::default()); | 78 | let config = embassy_net::Config::dhcpv4(Default::default()); |
| 79 | // let config = embassy_net::Config::ipv4_static(embassy_net::StaticConfigV4 { | 79 | // let config = embassy_net::Config::ipv4_static(embassy_net::StaticConfigV4 { |
diff --git a/examples/rp/Cargo.toml b/examples/rp/Cargo.toml index d83e370df..102611bc0 100644 --- a/examples/rp/Cargo.toml +++ b/examples/rp/Cargo.toml | |||
| @@ -13,7 +13,7 @@ embassy-time = { version = "0.1.2", path = "../../embassy-time", features = ["ni | |||
| 13 | embassy-rp = { version = "0.1.0", path = "../../embassy-rp", features = ["defmt", "unstable-traits", "nightly", "unstable-pac", "time-driver", "critical-section-impl"] } | 13 | embassy-rp = { version = "0.1.0", path = "../../embassy-rp", features = ["defmt", "unstable-traits", "nightly", "unstable-pac", "time-driver", "critical-section-impl"] } |
| 14 | embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = ["defmt"] } | 14 | embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = ["defmt"] } |
| 15 | embassy-net = { version = "0.1.0", path = "../../embassy-net", features = ["defmt", "nightly", "tcp", "udp", "dhcpv4", "medium-ethernet"] } | 15 | embassy-net = { version = "0.1.0", path = "../../embassy-net", features = ["defmt", "nightly", "tcp", "udp", "dhcpv4", "medium-ethernet"] } |
| 16 | embassy-net-w5500 = { version = "0.1.0", path = "../../embassy-net-w5500", features = ["defmt"] } | 16 | embassy-net-wiznet = { version = "0.1.0", path = "../../embassy-net-wiznet", features = ["defmt"] } |
| 17 | embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } | 17 | embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } |
| 18 | embassy-usb-logger = { version = "0.1.0", path = "../../embassy-usb-logger" } | 18 | embassy-usb-logger = { version = "0.1.0", path = "../../embassy-usb-logger" } |
| 19 | embassy-lora = { version = "0.1.0", path = "../../embassy-lora", features = ["time", "defmt"] } | 19 | embassy-lora = { version = "0.1.0", path = "../../embassy-lora", features = ["time", "defmt"] } |
| @@ -42,8 +42,9 @@ smart-leds = "0.3.0" | |||
| 42 | heapless = "0.7.15" | 42 | heapless = "0.7.15" |
| 43 | usbd-hid = "0.6.1" | 43 | usbd-hid = "0.6.1" |
| 44 | 44 | ||
| 45 | embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.11" } | 45 | embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.1" } |
| 46 | embedded-hal-async = "0.2.0-alpha.2" | 46 | embedded-hal-async = "1.0.0-rc.1" |
| 47 | embedded-hal-bus = { version = "0.1.0-rc.1", features = ["async"] } | ||
| 47 | embedded-io-async = { version = "0.5.0", features = ["defmt-03"] } | 48 | embedded-io-async = { version = "0.5.0", features = ["defmt-03"] } |
| 48 | embedded-storage = { version = "0.3" } | 49 | embedded-storage = { version = "0.3" } |
| 49 | static_cell = { version = "1.1", features = ["nightly"]} | 50 | static_cell = { version = "1.1", features = ["nightly"]} |
| @@ -53,4 +54,7 @@ pio = "0.2.1" | |||
| 53 | rand = { version = "0.8.5", default-features = false } | 54 | rand = { version = "0.8.5", default-features = false } |
| 54 | 55 | ||
| 55 | [profile.release] | 56 | [profile.release] |
| 56 | debug = 2 \ No newline at end of file | 57 | debug = 2 |
| 58 | |||
| 59 | [patch.crates-io] | ||
| 60 | lora-phy = { git = "https://github.com/embassy-rs/lora-phy", rev = "1323eccc1c470d4259f95f4f315d1be830d572a3"} \ No newline at end of file | ||
diff --git a/examples/rp/src/bin/ethernet_w5500_multisocket.rs b/examples/rp/src/bin/ethernet_w5500_multisocket.rs index 9f800d0d9..c0fde62ab 100644 --- a/examples/rp/src/bin/ethernet_w5500_multisocket.rs +++ b/examples/rp/src/bin/ethernet_w5500_multisocket.rs | |||
| @@ -10,13 +10,14 @@ use defmt::*; | |||
| 10 | use embassy_executor::Spawner; | 10 | use embassy_executor::Spawner; |
| 11 | use embassy_futures::yield_now; | 11 | use embassy_futures::yield_now; |
| 12 | use embassy_net::{Stack, StackResources}; | 12 | use embassy_net::{Stack, StackResources}; |
| 13 | use embassy_net_w5500::*; | 13 | use embassy_net_wiznet::chip::W5500; |
| 14 | use embassy_net_wiznet::*; | ||
| 14 | use embassy_rp::clocks::RoscRng; | 15 | use embassy_rp::clocks::RoscRng; |
| 15 | use embassy_rp::gpio::{Input, Level, Output, Pull}; | 16 | use embassy_rp::gpio::{Input, Level, Output, Pull}; |
| 16 | use embassy_rp::peripherals::{PIN_17, PIN_20, PIN_21, SPI0}; | 17 | use embassy_rp::peripherals::{PIN_17, PIN_20, PIN_21, SPI0}; |
| 17 | use embassy_rp::spi::{Async, Config as SpiConfig, Spi}; | 18 | use embassy_rp::spi::{Async, Config as SpiConfig, Spi}; |
| 18 | use embassy_time::{Delay, Duration}; | 19 | use embassy_time::{Delay, Duration}; |
| 19 | use embedded_hal_async::spi::ExclusiveDevice; | 20 | use embedded_hal_bus::spi::ExclusiveDevice; |
| 20 | use embedded_io_async::Write; | 21 | use embedded_io_async::Write; |
| 21 | use rand::RngCore; | 22 | use rand::RngCore; |
| 22 | use static_cell::make_static; | 23 | use static_cell::make_static; |
| @@ -26,6 +27,7 @@ use {defmt_rtt as _, panic_probe as _}; | |||
| 26 | async fn ethernet_task( | 27 | async fn ethernet_task( |
| 27 | runner: Runner< | 28 | runner: Runner< |
| 28 | 'static, | 29 | 'static, |
| 30 | W5500, | ||
| 29 | ExclusiveDevice<Spi<'static, SPI0, Async>, Output<'static, PIN_17>, Delay>, | 31 | ExclusiveDevice<Spi<'static, SPI0, Async>, Output<'static, PIN_17>, Delay>, |
| 30 | Input<'static, PIN_21>, | 32 | Input<'static, PIN_21>, |
| 31 | Output<'static, PIN_20>, | 33 | Output<'static, PIN_20>, |
| @@ -54,7 +56,7 @@ async fn main(spawner: Spawner) { | |||
| 54 | 56 | ||
| 55 | let mac_addr = [0x02, 0x00, 0x00, 0x00, 0x00, 0x00]; | 57 | let mac_addr = [0x02, 0x00, 0x00, 0x00, 0x00, 0x00]; |
| 56 | let state = make_static!(State::<8, 8>::new()); | 58 | let state = make_static!(State::<8, 8>::new()); |
| 57 | let (device, runner) = embassy_net_w5500::new( | 59 | let (device, runner) = embassy_net_wiznet::new( |
| 58 | mac_addr, | 60 | mac_addr, |
| 59 | state, | 61 | state, |
| 60 | ExclusiveDevice::new(spi, cs, Delay), | 62 | ExclusiveDevice::new(spi, cs, Delay), |
diff --git a/examples/rp/src/bin/ethernet_w5500_tcp_client.rs b/examples/rp/src/bin/ethernet_w5500_tcp_client.rs index fee84b613..e593acae4 100644 --- a/examples/rp/src/bin/ethernet_w5500_tcp_client.rs +++ b/examples/rp/src/bin/ethernet_w5500_tcp_client.rs | |||
| @@ -12,13 +12,14 @@ use defmt::*; | |||
| 12 | use embassy_executor::Spawner; | 12 | use embassy_executor::Spawner; |
| 13 | use embassy_futures::yield_now; | 13 | use embassy_futures::yield_now; |
| 14 | use embassy_net::{Stack, StackResources}; | 14 | use embassy_net::{Stack, StackResources}; |
| 15 | use embassy_net_w5500::*; | 15 | use embassy_net_wiznet::chip::W5500; |
| 16 | use embassy_net_wiznet::*; | ||
| 16 | use embassy_rp::clocks::RoscRng; | 17 | use embassy_rp::clocks::RoscRng; |
| 17 | use embassy_rp::gpio::{Input, Level, Output, Pull}; | 18 | use embassy_rp::gpio::{Input, Level, Output, Pull}; |
| 18 | use embassy_rp::peripherals::{PIN_17, PIN_20, PIN_21, SPI0}; | 19 | use embassy_rp::peripherals::{PIN_17, PIN_20, PIN_21, SPI0}; |
| 19 | use embassy_rp::spi::{Async, Config as SpiConfig, Spi}; | 20 | use embassy_rp::spi::{Async, Config as SpiConfig, Spi}; |
| 20 | use embassy_time::{Delay, Duration, Timer}; | 21 | use embassy_time::{Delay, Duration, Timer}; |
| 21 | use embedded_hal_async::spi::ExclusiveDevice; | 22 | use embedded_hal_bus::spi::ExclusiveDevice; |
| 22 | use embedded_io_async::Write; | 23 | use embedded_io_async::Write; |
| 23 | use rand::RngCore; | 24 | use rand::RngCore; |
| 24 | use static_cell::make_static; | 25 | use static_cell::make_static; |
| @@ -28,6 +29,7 @@ use {defmt_rtt as _, panic_probe as _}; | |||
| 28 | async fn ethernet_task( | 29 | async fn ethernet_task( |
| 29 | runner: Runner< | 30 | runner: Runner< |
| 30 | 'static, | 31 | 'static, |
| 32 | W5500, | ||
| 31 | ExclusiveDevice<Spi<'static, SPI0, Async>, Output<'static, PIN_17>, Delay>, | 33 | ExclusiveDevice<Spi<'static, SPI0, Async>, Output<'static, PIN_17>, Delay>, |
| 32 | Input<'static, PIN_21>, | 34 | Input<'static, PIN_21>, |
| 33 | Output<'static, PIN_20>, | 35 | Output<'static, PIN_20>, |
| @@ -57,7 +59,7 @@ async fn main(spawner: Spawner) { | |||
| 57 | 59 | ||
| 58 | let mac_addr = [0x02, 0x00, 0x00, 0x00, 0x00, 0x00]; | 60 | let mac_addr = [0x02, 0x00, 0x00, 0x00, 0x00, 0x00]; |
| 59 | let state = make_static!(State::<8, 8>::new()); | 61 | let state = make_static!(State::<8, 8>::new()); |
| 60 | let (device, runner) = embassy_net_w5500::new( | 62 | let (device, runner) = embassy_net_wiznet::new( |
| 61 | mac_addr, | 63 | mac_addr, |
| 62 | state, | 64 | state, |
| 63 | ExclusiveDevice::new(spi, cs, Delay), | 65 | ExclusiveDevice::new(spi, cs, Delay), |
diff --git a/examples/rp/src/bin/ethernet_w5500_tcp_server.rs b/examples/rp/src/bin/ethernet_w5500_tcp_server.rs index 024574267..c62caed7a 100644 --- a/examples/rp/src/bin/ethernet_w5500_tcp_server.rs +++ b/examples/rp/src/bin/ethernet_w5500_tcp_server.rs | |||
| @@ -11,21 +11,24 @@ use defmt::*; | |||
| 11 | use embassy_executor::Spawner; | 11 | use embassy_executor::Spawner; |
| 12 | use embassy_futures::yield_now; | 12 | use embassy_futures::yield_now; |
| 13 | use embassy_net::{Stack, StackResources}; | 13 | use embassy_net::{Stack, StackResources}; |
| 14 | use embassy_net_w5500::*; | 14 | use embassy_net_wiznet::chip::W5500; |
| 15 | use embassy_net_wiznet::*; | ||
| 15 | use embassy_rp::clocks::RoscRng; | 16 | use embassy_rp::clocks::RoscRng; |
| 16 | use embassy_rp::gpio::{Input, Level, Output, Pull}; | 17 | use embassy_rp::gpio::{Input, Level, Output, Pull}; |
| 17 | use embassy_rp::peripherals::{PIN_17, PIN_20, PIN_21, SPI0}; | 18 | use embassy_rp::peripherals::{PIN_17, PIN_20, PIN_21, SPI0}; |
| 18 | use embassy_rp::spi::{Async, Config as SpiConfig, Spi}; | 19 | use embassy_rp::spi::{Async, Config as SpiConfig, Spi}; |
| 19 | use embassy_time::{Delay, Duration}; | 20 | use embassy_time::{Delay, Duration}; |
| 20 | use embedded_hal_async::spi::ExclusiveDevice; | 21 | use embedded_hal_bus::spi::ExclusiveDevice; |
| 21 | use embedded_io_async::Write; | 22 | use embedded_io_async::Write; |
| 22 | use rand::RngCore; | 23 | use rand::RngCore; |
| 23 | use static_cell::make_static; | 24 | use static_cell::make_static; |
| 24 | use {defmt_rtt as _, panic_probe as _}; | 25 | use {defmt_rtt as _, panic_probe as _}; |
| 26 | |||
| 25 | #[embassy_executor::task] | 27 | #[embassy_executor::task] |
| 26 | async fn ethernet_task( | 28 | async fn ethernet_task( |
| 27 | runner: Runner< | 29 | runner: Runner< |
| 28 | 'static, | 30 | 'static, |
| 31 | W5500, | ||
| 29 | ExclusiveDevice<Spi<'static, SPI0, Async>, Output<'static, PIN_17>, Delay>, | 32 | ExclusiveDevice<Spi<'static, SPI0, Async>, Output<'static, PIN_17>, Delay>, |
| 30 | Input<'static, PIN_21>, | 33 | Input<'static, PIN_21>, |
| 31 | Output<'static, PIN_20>, | 34 | Output<'static, PIN_20>, |
| @@ -55,7 +58,7 @@ async fn main(spawner: Spawner) { | |||
| 55 | 58 | ||
| 56 | let mac_addr = [0x02, 0x00, 0x00, 0x00, 0x00, 0x00]; | 59 | let mac_addr = [0x02, 0x00, 0x00, 0x00, 0x00, 0x00]; |
| 57 | let state = make_static!(State::<8, 8>::new()); | 60 | let state = make_static!(State::<8, 8>::new()); |
| 58 | let (device, runner) = embassy_net_w5500::new( | 61 | let (device, runner) = embassy_net_wiznet::new( |
| 59 | mac_addr, | 62 | mac_addr, |
| 60 | state, | 63 | state, |
| 61 | ExclusiveDevice::new(spi, cs, Delay), | 64 | ExclusiveDevice::new(spi, cs, Delay), |
diff --git a/examples/rp/src/bin/ethernet_w5500_udp.rs b/examples/rp/src/bin/ethernet_w5500_udp.rs index 038432b17..76dabce1c 100644 --- a/examples/rp/src/bin/ethernet_w5500_udp.rs +++ b/examples/rp/src/bin/ethernet_w5500_udp.rs | |||
| @@ -11,20 +11,23 @@ use embassy_executor::Spawner; | |||
| 11 | use embassy_futures::yield_now; | 11 | use embassy_futures::yield_now; |
| 12 | use embassy_net::udp::{PacketMetadata, UdpSocket}; | 12 | use embassy_net::udp::{PacketMetadata, UdpSocket}; |
| 13 | use embassy_net::{Stack, StackResources}; | 13 | use embassy_net::{Stack, StackResources}; |
| 14 | use embassy_net_w5500::*; | 14 | use embassy_net_wiznet::chip::W5500; |
| 15 | use embassy_net_wiznet::*; | ||
| 15 | use embassy_rp::clocks::RoscRng; | 16 | use embassy_rp::clocks::RoscRng; |
| 16 | use embassy_rp::gpio::{Input, Level, Output, Pull}; | 17 | use embassy_rp::gpio::{Input, Level, Output, Pull}; |
| 17 | use embassy_rp::peripherals::{PIN_17, PIN_20, PIN_21, SPI0}; | 18 | use embassy_rp::peripherals::{PIN_17, PIN_20, PIN_21, SPI0}; |
| 18 | use embassy_rp::spi::{Async, Config as SpiConfig, Spi}; | 19 | use embassy_rp::spi::{Async, Config as SpiConfig, Spi}; |
| 19 | use embassy_time::Delay; | 20 | use embassy_time::Delay; |
| 20 | use embedded_hal_async::spi::ExclusiveDevice; | 21 | use embedded_hal_bus::spi::ExclusiveDevice; |
| 21 | use rand::RngCore; | 22 | use rand::RngCore; |
| 22 | use static_cell::make_static; | 23 | use static_cell::make_static; |
| 23 | use {defmt_rtt as _, panic_probe as _}; | 24 | use {defmt_rtt as _, panic_probe as _}; |
| 25 | |||
| 24 | #[embassy_executor::task] | 26 | #[embassy_executor::task] |
| 25 | async fn ethernet_task( | 27 | async fn ethernet_task( |
| 26 | runner: Runner< | 28 | runner: Runner< |
| 27 | 'static, | 29 | 'static, |
| 30 | W5500, | ||
| 28 | ExclusiveDevice<Spi<'static, SPI0, Async>, Output<'static, PIN_17>, Delay>, | 31 | ExclusiveDevice<Spi<'static, SPI0, Async>, Output<'static, PIN_17>, Delay>, |
| 29 | Input<'static, PIN_21>, | 32 | Input<'static, PIN_21>, |
| 30 | Output<'static, PIN_20>, | 33 | Output<'static, PIN_20>, |
| @@ -53,7 +56,7 @@ async fn main(spawner: Spawner) { | |||
| 53 | 56 | ||
| 54 | let mac_addr = [0x02, 0x00, 0x00, 0x00, 0x00, 0x00]; | 57 | let mac_addr = [0x02, 0x00, 0x00, 0x00, 0x00, 0x00]; |
| 55 | let state = make_static!(State::<8, 8>::new()); | 58 | let state = make_static!(State::<8, 8>::new()); |
| 56 | let (device, runner) = embassy_net_w5500::new( | 59 | let (device, runner) = embassy_net_wiznet::new( |
| 57 | mac_addr, | 60 | mac_addr, |
| 58 | state, | 61 | state, |
| 59 | ExclusiveDevice::new(spi, cs, Delay), | 62 | ExclusiveDevice::new(spi, cs, Delay), |
diff --git a/examples/rp/src/bin/flash.rs b/examples/rp/src/bin/flash.rs index 88bb931d2..911a657eb 100644 --- a/examples/rp/src/bin/flash.rs +++ b/examples/rp/src/bin/flash.rs | |||
| @@ -28,12 +28,12 @@ async fn main(_spawner: Spawner) { | |||
| 28 | let mut flash = embassy_rp::flash::Flash::<_, Async, FLASH_SIZE>::new(p.FLASH, p.DMA_CH0); | 28 | let mut flash = embassy_rp::flash::Flash::<_, Async, FLASH_SIZE>::new(p.FLASH, p.DMA_CH0); |
| 29 | 29 | ||
| 30 | // Get JEDEC id | 30 | // Get JEDEC id |
| 31 | let jedec = flash.jedec_id().unwrap(); | 31 | let jedec = flash.blocking_jedec_id().unwrap(); |
| 32 | info!("jedec id: 0x{:x}", jedec); | 32 | info!("jedec id: 0x{:x}", jedec); |
| 33 | 33 | ||
| 34 | // Get unique id | 34 | // Get unique id |
| 35 | let mut uid = [0; 8]; | 35 | let mut uid = [0; 8]; |
| 36 | flash.unique_id(&mut uid).unwrap(); | 36 | flash.blocking_unique_id(&mut uid).unwrap(); |
| 37 | info!("unique id: {:?}", uid); | 37 | info!("unique id: {:?}", uid); |
| 38 | 38 | ||
| 39 | erase_write_sector(&mut flash, 0x00); | 39 | erase_write_sector(&mut flash, 0x00); |
| @@ -48,25 +48,25 @@ async fn main(_spawner: Spawner) { | |||
| 48 | fn multiwrite_bytes(flash: &mut embassy_rp::flash::Flash<'_, FLASH, Async, FLASH_SIZE>, offset: u32) { | 48 | fn multiwrite_bytes(flash: &mut embassy_rp::flash::Flash<'_, FLASH, Async, FLASH_SIZE>, offset: u32) { |
| 49 | info!(">>>> [multiwrite_bytes]"); | 49 | info!(">>>> [multiwrite_bytes]"); |
| 50 | let mut read_buf = [0u8; ERASE_SIZE]; | 50 | let mut read_buf = [0u8; ERASE_SIZE]; |
| 51 | defmt::unwrap!(flash.read(ADDR_OFFSET + offset, &mut read_buf)); | 51 | defmt::unwrap!(flash.blocking_read(ADDR_OFFSET + offset, &mut read_buf)); |
| 52 | 52 | ||
| 53 | info!("Addr of flash block is {:x}", ADDR_OFFSET + offset + FLASH_BASE as u32); | 53 | info!("Addr of flash block is {:x}", ADDR_OFFSET + offset + FLASH_BASE as u32); |
| 54 | info!("Contents start with {=[u8]}", read_buf[0..4]); | 54 | info!("Contents start with {=[u8]}", read_buf[0..4]); |
| 55 | 55 | ||
| 56 | defmt::unwrap!(flash.erase(ADDR_OFFSET + offset, ADDR_OFFSET + offset + ERASE_SIZE as u32)); | 56 | defmt::unwrap!(flash.blocking_erase(ADDR_OFFSET + offset, ADDR_OFFSET + offset + ERASE_SIZE as u32)); |
| 57 | 57 | ||
| 58 | defmt::unwrap!(flash.read(ADDR_OFFSET + offset, &mut read_buf)); | 58 | defmt::unwrap!(flash.blocking_read(ADDR_OFFSET + offset, &mut read_buf)); |
| 59 | info!("Contents after erase starts with {=[u8]}", read_buf[0..4]); | 59 | info!("Contents after erase starts with {=[u8]}", read_buf[0..4]); |
| 60 | if read_buf.iter().any(|x| *x != 0xFF) { | 60 | if read_buf.iter().any(|x| *x != 0xFF) { |
| 61 | defmt::panic!("unexpected"); | 61 | defmt::panic!("unexpected"); |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | defmt::unwrap!(flash.write(ADDR_OFFSET + offset, &[0x01])); | 64 | defmt::unwrap!(flash.blocking_write(ADDR_OFFSET + offset, &[0x01])); |
| 65 | defmt::unwrap!(flash.write(ADDR_OFFSET + offset + 1, &[0x02])); | 65 | defmt::unwrap!(flash.blocking_write(ADDR_OFFSET + offset + 1, &[0x02])); |
| 66 | defmt::unwrap!(flash.write(ADDR_OFFSET + offset + 2, &[0x03])); | 66 | defmt::unwrap!(flash.blocking_write(ADDR_OFFSET + offset + 2, &[0x03])); |
| 67 | defmt::unwrap!(flash.write(ADDR_OFFSET + offset + 3, &[0x04])); | 67 | defmt::unwrap!(flash.blocking_write(ADDR_OFFSET + offset + 3, &[0x04])); |
| 68 | 68 | ||
| 69 | defmt::unwrap!(flash.read(ADDR_OFFSET + offset, &mut read_buf)); | 69 | defmt::unwrap!(flash.blocking_read(ADDR_OFFSET + offset, &mut read_buf)); |
| 70 | info!("Contents after write starts with {=[u8]}", read_buf[0..4]); | 70 | info!("Contents after write starts with {=[u8]}", read_buf[0..4]); |
| 71 | if &read_buf[0..4] != &[0x01, 0x02, 0x03, 0x04] { | 71 | if &read_buf[0..4] != &[0x01, 0x02, 0x03, 0x04] { |
| 72 | defmt::panic!("unexpected"); | 72 | defmt::panic!("unexpected"); |
| @@ -76,14 +76,14 @@ fn multiwrite_bytes(flash: &mut embassy_rp::flash::Flash<'_, FLASH, Async, FLASH | |||
| 76 | fn erase_write_sector(flash: &mut embassy_rp::flash::Flash<'_, FLASH, Async, FLASH_SIZE>, offset: u32) { | 76 | fn erase_write_sector(flash: &mut embassy_rp::flash::Flash<'_, FLASH, Async, FLASH_SIZE>, offset: u32) { |
| 77 | info!(">>>> [erase_write_sector]"); | 77 | info!(">>>> [erase_write_sector]"); |
| 78 | let mut buf = [0u8; ERASE_SIZE]; | 78 | let mut buf = [0u8; ERASE_SIZE]; |
| 79 | defmt::unwrap!(flash.read(ADDR_OFFSET + offset, &mut buf)); | 79 | defmt::unwrap!(flash.blocking_read(ADDR_OFFSET + offset, &mut buf)); |
| 80 | 80 | ||
| 81 | info!("Addr of flash block is {:x}", ADDR_OFFSET + offset + FLASH_BASE as u32); | 81 | info!("Addr of flash block is {:x}", ADDR_OFFSET + offset + FLASH_BASE as u32); |
| 82 | info!("Contents start with {=[u8]}", buf[0..4]); | 82 | info!("Contents start with {=[u8]}", buf[0..4]); |
| 83 | 83 | ||
| 84 | defmt::unwrap!(flash.erase(ADDR_OFFSET + offset, ADDR_OFFSET + offset + ERASE_SIZE as u32)); | 84 | defmt::unwrap!(flash.blocking_erase(ADDR_OFFSET + offset, ADDR_OFFSET + offset + ERASE_SIZE as u32)); |
| 85 | 85 | ||
| 86 | defmt::unwrap!(flash.read(ADDR_OFFSET + offset, &mut buf)); | 86 | defmt::unwrap!(flash.blocking_read(ADDR_OFFSET + offset, &mut buf)); |
| 87 | info!("Contents after erase starts with {=[u8]}", buf[0..4]); | 87 | info!("Contents after erase starts with {=[u8]}", buf[0..4]); |
| 88 | if buf.iter().any(|x| *x != 0xFF) { | 88 | if buf.iter().any(|x| *x != 0xFF) { |
| 89 | defmt::panic!("unexpected"); | 89 | defmt::panic!("unexpected"); |
| @@ -93,9 +93,9 @@ fn erase_write_sector(flash: &mut embassy_rp::flash::Flash<'_, FLASH, Async, FLA | |||
| 93 | *b = 0xDA; | 93 | *b = 0xDA; |
| 94 | } | 94 | } |
| 95 | 95 | ||
| 96 | defmt::unwrap!(flash.write(ADDR_OFFSET + offset, &buf)); | 96 | defmt::unwrap!(flash.blocking_write(ADDR_OFFSET + offset, &buf)); |
| 97 | 97 | ||
| 98 | defmt::unwrap!(flash.read(ADDR_OFFSET + offset, &mut buf)); | 98 | defmt::unwrap!(flash.blocking_read(ADDR_OFFSET + offset, &mut buf)); |
| 99 | info!("Contents after write starts with {=[u8]}", buf[0..4]); | 99 | info!("Contents after write starts with {=[u8]}", buf[0..4]); |
| 100 | if buf.iter().any(|x| *x != 0xDA) { | 100 | if buf.iter().any(|x| *x != 0xDA) { |
| 101 | defmt::panic!("unexpected"); | 101 | defmt::panic!("unexpected"); |
| @@ -111,7 +111,7 @@ async fn background_read(flash: &mut embassy_rp::flash::Flash<'_, FLASH, Async, | |||
| 111 | info!("Addr of flash block is {:x}", ADDR_OFFSET + offset + FLASH_BASE as u32); | 111 | info!("Addr of flash block is {:x}", ADDR_OFFSET + offset + FLASH_BASE as u32); |
| 112 | info!("Contents start with {=u32:x}", buf[0]); | 112 | info!("Contents start with {=u32:x}", buf[0]); |
| 113 | 113 | ||
| 114 | defmt::unwrap!(flash.erase(ADDR_OFFSET + offset, ADDR_OFFSET + offset + ERASE_SIZE as u32)); | 114 | defmt::unwrap!(flash.blocking_erase(ADDR_OFFSET + offset, ADDR_OFFSET + offset + ERASE_SIZE as u32)); |
| 115 | 115 | ||
| 116 | defmt::unwrap!(flash.background_read(ADDR_OFFSET + offset, &mut buf)).await; | 116 | defmt::unwrap!(flash.background_read(ADDR_OFFSET + offset, &mut buf)).await; |
| 117 | info!("Contents after erase starts with {=u32:x}", buf[0]); | 117 | info!("Contents after erase starts with {=u32:x}", buf[0]); |
| @@ -123,7 +123,7 @@ async fn background_read(flash: &mut embassy_rp::flash::Flash<'_, FLASH, Async, | |||
| 123 | *b = 0xDABA1234; | 123 | *b = 0xDABA1234; |
| 124 | } | 124 | } |
| 125 | 125 | ||
| 126 | defmt::unwrap!(flash.write(ADDR_OFFSET + offset, unsafe { | 126 | defmt::unwrap!(flash.blocking_write(ADDR_OFFSET + offset, unsafe { |
| 127 | core::slice::from_raw_parts(buf.as_ptr() as *const u8, buf.len() * 4) | 127 | core::slice::from_raw_parts(buf.as_ptr() as *const u8, buf.len() * 4) |
| 128 | })); | 128 | })); |
| 129 | 129 | ||
diff --git a/examples/rp/src/bin/lora_p2p_send_multicore.rs b/examples/rp/src/bin/lora_p2p_send_multicore.rs index 89a62818d..b54cc92f6 100644 --- a/examples/rp/src/bin/lora_p2p_send_multicore.rs +++ b/examples/rp/src/bin/lora_p2p_send_multicore.rs | |||
| @@ -113,7 +113,7 @@ async fn core1_task( | |||
| 113 | }; | 113 | }; |
| 114 | 114 | ||
| 115 | loop { | 115 | loop { |
| 116 | let buffer: [u8; 3] = CHANNEL.recv().await; | 116 | let buffer: [u8; 3] = CHANNEL.receive().await; |
| 117 | match lora.prepare_for_tx(&mdltn_params, 20, false).await { | 117 | match lora.prepare_for_tx(&mdltn_params, 20, false).await { |
| 118 | Ok(()) => {} | 118 | Ok(()) => {} |
| 119 | Err(err) => { | 119 | Err(err) => { |
diff --git a/examples/rp/src/bin/multicore.rs b/examples/rp/src/bin/multicore.rs index 893b724bf..bf017f6a7 100644 --- a/examples/rp/src/bin/multicore.rs +++ b/examples/rp/src/bin/multicore.rs | |||
| @@ -56,7 +56,7 @@ async fn core0_task() { | |||
| 56 | async fn core1_task(mut led: Output<'static, PIN_25>) { | 56 | async fn core1_task(mut led: Output<'static, PIN_25>) { |
| 57 | info!("Hello from core 1"); | 57 | info!("Hello from core 1"); |
| 58 | loop { | 58 | loop { |
| 59 | match CHANNEL.recv().await { | 59 | match CHANNEL.receive().await { |
| 60 | LedState::On => led.set_high(), | 60 | LedState::On => led.set_high(), |
| 61 | LedState::Off => led.set_low(), | 61 | LedState::Off => led.set_low(), |
| 62 | } | 62 | } |
diff --git a/examples/stm32f3/src/bin/button_events.rs b/examples/stm32f3/src/bin/button_events.rs index 02c475f66..8e97e85eb 100644 --- a/examples/stm32f3/src/bin/button_events.rs +++ b/examples/stm32f3/src/bin/button_events.rs | |||
| @@ -49,12 +49,12 @@ impl<'a> Leds<'a> { | |||
| 49 | 49 | ||
| 50 | async fn show(&mut self) { | 50 | async fn show(&mut self) { |
| 51 | self.leds[self.current_led].set_high(); | 51 | self.leds[self.current_led].set_high(); |
| 52 | if let Ok(new_message) = with_timeout(Duration::from_millis(500), CHANNEL.recv()).await { | 52 | if let Ok(new_message) = with_timeout(Duration::from_millis(500), CHANNEL.receive()).await { |
| 53 | self.leds[self.current_led].set_low(); | 53 | self.leds[self.current_led].set_low(); |
| 54 | self.process_event(new_message).await; | 54 | self.process_event(new_message).await; |
| 55 | } else { | 55 | } else { |
| 56 | self.leds[self.current_led].set_low(); | 56 | self.leds[self.current_led].set_low(); |
| 57 | if let Ok(new_message) = with_timeout(Duration::from_millis(200), CHANNEL.recv()).await { | 57 | if let Ok(new_message) = with_timeout(Duration::from_millis(200), CHANNEL.receive()).await { |
| 58 | self.process_event(new_message).await; | 58 | self.process_event(new_message).await; |
| 59 | } | 59 | } |
| 60 | } | 60 | } |
diff --git a/examples/stm32h5/Cargo.toml b/examples/stm32h5/Cargo.toml index 44d0a9574..5d73e435e 100644 --- a/examples/stm32h5/Cargo.toml +++ b/examples/stm32h5/Cargo.toml | |||
| @@ -20,8 +20,8 @@ defmt-rtt = "0.4" | |||
| 20 | cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] } | 20 | cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] } |
| 21 | cortex-m-rt = "0.7.0" | 21 | cortex-m-rt = "0.7.0" |
| 22 | embedded-hal = "0.2.6" | 22 | embedded-hal = "0.2.6" |
| 23 | embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.11" } | 23 | embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.1" } |
| 24 | embedded-hal-async = { version = "=0.2.0-alpha.2" } | 24 | embedded-hal-async = { version = "=1.0.0-rc.1" } |
| 25 | embedded-nal-async = { version = "0.5.0" } | 25 | embedded-nal-async = { version = "0.5.0" } |
| 26 | panic-probe = { version = "0.3", features = ["print-defmt"] } | 26 | panic-probe = { version = "0.3", features = ["print-defmt"] } |
| 27 | futures = { version = "0.3.17", default-features = false, features = ["async-await"] } | 27 | futures = { version = "0.3.17", default-features = false, features = ["async-await"] } |
diff --git a/examples/stm32h5/src/bin/usart_split.rs b/examples/stm32h5/src/bin/usart_split.rs index debd6f454..a6b2e690b 100644 --- a/examples/stm32h5/src/bin/usart_split.rs +++ b/examples/stm32h5/src/bin/usart_split.rs | |||
| @@ -44,7 +44,7 @@ async fn main(spawner: Spawner) -> ! { | |||
| 44 | unwrap!(spawner.spawn(reader(rx))); | 44 | unwrap!(spawner.spawn(reader(rx))); |
| 45 | 45 | ||
| 46 | loop { | 46 | loop { |
| 47 | let buf = CHANNEL.recv().await; | 47 | let buf = CHANNEL.receive().await; |
| 48 | info!("writing..."); | 48 | info!("writing..."); |
| 49 | unwrap!(tx.write(&buf).await); | 49 | unwrap!(tx.write(&buf).await); |
| 50 | } | 50 | } |
diff --git a/examples/stm32h7/Cargo.toml b/examples/stm32h7/Cargo.toml index e2e5f9364..c78c4c602 100644 --- a/examples/stm32h7/Cargo.toml +++ b/examples/stm32h7/Cargo.toml | |||
| @@ -20,8 +20,8 @@ defmt-rtt = "0.4" | |||
| 20 | cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] } | 20 | cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] } |
| 21 | cortex-m-rt = "0.7.0" | 21 | cortex-m-rt = "0.7.0" |
| 22 | embedded-hal = "0.2.6" | 22 | embedded-hal = "0.2.6" |
| 23 | embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.11" } | 23 | embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.1" } |
| 24 | embedded-hal-async = { version = "=0.2.0-alpha.2" } | 24 | embedded-hal-async = { version = "=1.0.0-rc.1" } |
| 25 | embedded-nal-async = { version = "0.5.0" } | 25 | embedded-nal-async = { version = "0.5.0" } |
| 26 | panic-probe = { version = "0.3", features = ["print-defmt"] } | 26 | panic-probe = { version = "0.3", features = ["print-defmt"] } |
| 27 | futures = { version = "0.3.17", default-features = false, features = ["async-await"] } | 27 | futures = { version = "0.3.17", default-features = false, features = ["async-await"] } |
diff --git a/examples/stm32h7/src/bin/usart_split.rs b/examples/stm32h7/src/bin/usart_split.rs index 330d1ce09..aa0753450 100644 --- a/examples/stm32h7/src/bin/usart_split.rs +++ b/examples/stm32h7/src/bin/usart_split.rs | |||
| @@ -44,7 +44,7 @@ async fn main(spawner: Spawner) -> ! { | |||
| 44 | unwrap!(spawner.spawn(reader(rx))); | 44 | unwrap!(spawner.spawn(reader(rx))); |
| 45 | 45 | ||
| 46 | loop { | 46 | loop { |
| 47 | let buf = CHANNEL.recv().await; | 47 | let buf = CHANNEL.receive().await; |
| 48 | info!("writing..."); | 48 | info!("writing..."); |
| 49 | unwrap!(tx.write(&buf).await); | 49 | unwrap!(tx.write(&buf).await); |
| 50 | } | 50 | } |
diff --git a/examples/stm32l0/Cargo.toml b/examples/stm32l0/Cargo.toml index 33aa05e65..332a6c5e5 100644 --- a/examples/stm32l0/Cargo.toml +++ b/examples/stm32l0/Cargo.toml | |||
| @@ -37,3 +37,6 @@ static_cell = "1.1" | |||
| 37 | 37 | ||
| 38 | [profile.release] | 38 | [profile.release] |
| 39 | debug = 2 | 39 | debug = 2 |
| 40 | |||
| 41 | [patch.crates-io] | ||
| 42 | lora-phy = { git = "https://github.com/embassy-rs/lora-phy", rev = "1323eccc1c470d4259f95f4f315d1be830d572a3"} \ No newline at end of file | ||
diff --git a/examples/stm32l4/Cargo.toml b/examples/stm32l4/Cargo.toml index 3b27d8e81..944c8c27b 100644 --- a/examples/stm32l4/Cargo.toml +++ b/examples/stm32l4/Cargo.toml | |||
| @@ -19,8 +19,8 @@ defmt-rtt = "0.4" | |||
| 19 | cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] } | 19 | cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] } |
| 20 | cortex-m-rt = "0.7.0" | 20 | cortex-m-rt = "0.7.0" |
| 21 | embedded-hal = "0.2.6" | 21 | embedded-hal = "0.2.6" |
| 22 | embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.11" } | 22 | embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.1" } |
| 23 | embedded-hal-async = { version = "=0.2.0-alpha.2" } | 23 | embedded-hal-async = { version = "=1.0.0-rc.1" } |
| 24 | panic-probe = { version = "0.3", features = ["print-defmt"] } | 24 | panic-probe = { version = "0.3", features = ["print-defmt"] } |
| 25 | futures = { version = "0.3.17", default-features = false, features = ["async-await"] } | 25 | futures = { version = "0.3.17", default-features = false, features = ["async-await"] } |
| 26 | heapless = { version = "0.7.5", default-features = false } | 26 | heapless = { version = "0.7.5", default-features = false } |
diff --git a/examples/stm32wl/Cargo.toml b/examples/stm32wl/Cargo.toml index 48b69c8d0..5440807f6 100644 --- a/examples/stm32wl/Cargo.toml +++ b/examples/stm32wl/Cargo.toml | |||
| @@ -30,3 +30,6 @@ chrono = { version = "^0.4", default-features = false } | |||
| 30 | 30 | ||
| 31 | [profile.release] | 31 | [profile.release] |
| 32 | debug = 2 | 32 | debug = 2 |
| 33 | |||
| 34 | [patch.crates-io] | ||
| 35 | lora-phy = { git = "https://github.com/embassy-rs/lora-phy", rev = "1323eccc1c470d4259f95f4f315d1be830d572a3"} \ No newline at end of file | ||
