@@ -31,8 +31,9 @@ use embassy_executor::Spawner;
3131use embassy_net:: Stack ;
3232use embassy_time:: { Duration , Timer } ;
3333
34- /// The function configures the RP2040 peripherals, then blinks the LED in an
35- /// infinite loop.
34+ /// The function configures the RP2040 peripherals, initializes
35+ /// networking, then blinks the LED in an infinite loop.
36+ /// TODO: add some simple network service
3637#[ entry]
3738fn main ( ) -> ! {
3839 info ! ( "start" ) ;
@@ -89,15 +90,17 @@ fn main() -> ! {
8990 } ) ;
9091}
9192
93+ // TODO documentation
9294unsafe fn forever_mut < T > ( r : & ' _ mut T ) -> & ' static mut T {
9395 core:: mem:: transmute ( r)
9496}
9597
98+ // TODO documentation
9699unsafe fn forever < T > ( r : & ' _ T ) -> & ' static T {
97100 core:: mem:: transmute ( r)
98101}
99102
100- async fn run ( spawner : Spawner , pins : rp_pico_w:: Pins , state : & ' static cyw43:: State ) {
103+ async fn run ( spawner : Spawner , pins : rp_pico_w:: Pins , state : & ' static cyw43:: State ) -> ! {
101104 // These are implicitly used by the spi driver if they are in the correct mode
102105 let mut spi_cs: hal:: gpio:: dynpin:: DynPin = pins. wl_cs . into ( ) ;
103106 // TODO should be high from the beginning :-(
@@ -120,19 +123,8 @@ async fn run(spawner: Spawner, pins: rp_pico_w::Pins, state: &'static cyw43::Sta
120123
121124 let pwr = pins. wl_on . into_push_pull_output ( ) ;
122125
123- #[ cfg( not( feature = "fix_fw" ) ) ]
124- let fw = include_bytes ! ( "firmware/43439A0.bin" ) ;
125- #[ cfg( not( feature = "fix_fw" ) ) ]
126- let clm = include_bytes ! ( "firmware/43439A0_clm.bin" ) ;
127-
128- // To make flashing faster for development, you may want to flash the firmwares independently
129- // at hardcoded addresses, instead of baking them into the program with `include_bytes!`:
130- // probe-rs-cli download 43439A0.bin --format bin --chip RP2040 --base-address 0x10100000
131- // probe-rs-cli download 43439A0.clm_blob --format bin --chip RP2040 --base-address 0x10140000
132- #[ cfg( feature = "fix_fw" ) ]
133- let fw = unsafe { core:: slice:: from_raw_parts ( 0x10100000 as * const u8 , 224190 ) } ;
134- #[ cfg( feature = "fix_fw" ) ]
135- let clm = unsafe { core:: slice:: from_raw_parts ( 0x10140000 as * const u8 , 4752 ) } ;
126+ let fw = cyw43:: firmware:: firmware ( ) ;
127+ let clm = cyw43:: firmware:: clm ( ) ;
136128
137129 use embassy_futures:: yield_now;
138130 yield_now ( ) . await ;
@@ -191,10 +183,10 @@ async fn run(spawner: Spawner, pins: rp_pico_w::Pins, state: &'static cyw43::Sta
191183 loop {
192184 info ! ( "on" ) ;
193185 control. gpio_set ( 0 , true ) . await ;
194- Timer :: after ( Duration :: from_millis ( 200 ) ) . await ;
186+ Timer :: after ( Duration :: from_millis ( 500 ) ) . await ;
195187
196188 info ! ( "off" ) ;
197189 control. gpio_set ( 0 , false ) . await ;
198- Timer :: after ( Duration :: from_millis ( 200 ) ) . await ;
190+ Timer :: after ( Duration :: from_millis ( 500 ) ) . await ;
199191 }
200192}
0 commit comments