Merge pull request #1999 from KingCol13/rp-wifi-examples-fixes
cyw43: Update examples
This commit is contained in:
		| @@ -52,7 +52,7 @@ async fn main(spawner: Spawner) { | |||||||
|     // at hardcoded addresses, instead of baking them into the program with `include_bytes!`: |     // at hardcoded addresses, instead of baking them into the program with `include_bytes!`: | ||||||
|     //     probe-rs download 43439A0.bin --format bin --chip RP2040 --base-address 0x10100000 |     //     probe-rs download 43439A0.bin --format bin --chip RP2040 --base-address 0x10100000 | ||||||
|     //     probe-rs download 43439A0_clm.bin --format bin --chip RP2040 --base-address 0x10140000 |     //     probe-rs download 43439A0_clm.bin --format bin --chip RP2040 --base-address 0x10140000 | ||||||
|     //let fw = unsafe { core::slice::from_raw_parts(0x10100000 as *const u8, 224190) }; |     //let fw = unsafe { core::slice::from_raw_parts(0x10100000 as *const u8, 230321) }; | ||||||
|     //let clm = unsafe { core::slice::from_raw_parts(0x10140000 as *const u8, 4752) }; |     //let clm = unsafe { core::slice::from_raw_parts(0x10140000 as *const u8, 4752) }; | ||||||
|  |  | ||||||
|     let pwr = Output::new(p.PIN_23, Level::Low); |     let pwr = Output::new(p.PIN_23, Level::Low); | ||||||
|   | |||||||
| @@ -38,7 +38,7 @@ async fn main(spawner: Spawner) { | |||||||
|     // at hardcoded addresses, instead of baking them into the program with `include_bytes!`: |     // at hardcoded addresses, instead of baking them into the program with `include_bytes!`: | ||||||
|     //     probe-rs download 43439A0.bin --format bin --chip RP2040 --base-address 0x10100000 |     //     probe-rs download 43439A0.bin --format bin --chip RP2040 --base-address 0x10100000 | ||||||
|     //     probe-rs download 43439A0_clm.bin --format bin --chip RP2040 --base-address 0x10140000 |     //     probe-rs download 43439A0_clm.bin --format bin --chip RP2040 --base-address 0x10140000 | ||||||
|     //let fw = unsafe { core::slice::from_raw_parts(0x10100000 as *const u8, 224190) }; |     //let fw = unsafe { core::slice::from_raw_parts(0x10100000 as *const u8, 230321) }; | ||||||
|     //let clm = unsafe { core::slice::from_raw_parts(0x10140000 as *const u8, 4752) }; |     //let clm = unsafe { core::slice::from_raw_parts(0x10140000 as *const u8, 4752) }; | ||||||
|  |  | ||||||
|     let pwr = Output::new(p.PIN_23, Level::Low); |     let pwr = Output::new(p.PIN_23, Level::Low); | ||||||
|   | |||||||
| @@ -49,7 +49,7 @@ async fn main(spawner: Spawner) { | |||||||
|     // at hardcoded addresses, instead of baking them into the program with `include_bytes!`: |     // at hardcoded addresses, instead of baking them into the program with `include_bytes!`: | ||||||
|     //     probe-rs download 43439A0.bin --format bin --chip RP2040 --base-address 0x10100000 |     //     probe-rs download 43439A0.bin --format bin --chip RP2040 --base-address 0x10100000 | ||||||
|     //     probe-rs download 43439A0_clm.bin --format bin --chip RP2040 --base-address 0x10140000 |     //     probe-rs download 43439A0_clm.bin --format bin --chip RP2040 --base-address 0x10140000 | ||||||
|     //let fw = unsafe { core::slice::from_raw_parts(0x10100000 as *const u8, 224190) }; |     //let fw = unsafe { core::slice::from_raw_parts(0x10100000 as *const u8, 230321) }; | ||||||
|     //let clm = unsafe { core::slice::from_raw_parts(0x10140000 as *const u8, 4752) }; |     //let clm = unsafe { core::slice::from_raw_parts(0x10140000 as *const u8, 4752) }; | ||||||
|  |  | ||||||
|     let pwr = Output::new(p.PIN_23, Level::Low); |     let pwr = Output::new(p.PIN_23, Level::Low); | ||||||
|   | |||||||
| @@ -18,7 +18,7 @@ use embassy_rp::bind_interrupts; | |||||||
| use embassy_rp::gpio::{Level, Output}; | use embassy_rp::gpio::{Level, Output}; | ||||||
| use embassy_rp::peripherals::{DMA_CH0, PIN_23, PIN_25, PIO0}; | use embassy_rp::peripherals::{DMA_CH0, PIN_23, PIN_25, PIO0}; | ||||||
| use embassy_rp::pio::{InterruptHandler, Pio}; | use embassy_rp::pio::{InterruptHandler, Pio}; | ||||||
| use embassy_time::Duration; | use embassy_time::{Duration, Timer}; | ||||||
| use embedded_io_async::Write; | use embedded_io_async::Write; | ||||||
| use static_cell::make_static; | use static_cell::make_static; | ||||||
| use {defmt_rtt as _, panic_probe as _}; | use {defmt_rtt as _, panic_probe as _}; | ||||||
| @@ -55,7 +55,7 @@ async fn main(spawner: Spawner) { | |||||||
|     // at hardcoded addresses, instead of baking them into the program with `include_bytes!`: |     // at hardcoded addresses, instead of baking them into the program with `include_bytes!`: | ||||||
|     //     probe-rs download 43439A0.bin --format bin --chip RP2040 --base-address 0x10100000 |     //     probe-rs download 43439A0.bin --format bin --chip RP2040 --base-address 0x10100000 | ||||||
|     //     probe-rs download 43439A0_clm.bin --format bin --chip RP2040 --base-address 0x10140000 |     //     probe-rs download 43439A0_clm.bin --format bin --chip RP2040 --base-address 0x10140000 | ||||||
|     //let fw = unsafe { core::slice::from_raw_parts(0x10100000 as *const u8, 224190) }; |     //let fw = unsafe { core::slice::from_raw_parts(0x10100000 as *const u8, 230321) }; | ||||||
|     //let clm = unsafe { core::slice::from_raw_parts(0x10140000 as *const u8, 4752) }; |     //let clm = unsafe { core::slice::from_raw_parts(0x10140000 as *const u8, 4752) }; | ||||||
|  |  | ||||||
|     let pwr = Output::new(p.PIN_23, Level::Low); |     let pwr = Output::new(p.PIN_23, Level::Low); | ||||||
| @@ -102,6 +102,13 @@ async fn main(spawner: Spawner) { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     // Wait for DHCP, not necessary when using static IP | ||||||
|  |     info!("waiting for DHCP..."); | ||||||
|  |     while !stack.is_config_up() { | ||||||
|  |         Timer::after(Duration::from_millis(100)).await; | ||||||
|  |     } | ||||||
|  |     info!("DHCP is now up!"); | ||||||
|  |  | ||||||
|     // And now we can use it! |     // And now we can use it! | ||||||
|  |  | ||||||
|     let mut rx_buffer = [0; 4096]; |     let mut rx_buffer = [0; 4096]; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user