aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2022-07-11 00:25:35 +0200
committerDario Nieuwenhuis <[email protected]>2022-07-11 00:25:35 +0200
commit069a57fcf85c725d000e03163716edb4ae3922ca (patch)
treee0b672124cdfc0c8d4a58896d887496f5dec7d1d /examples
parente560415fde967483573d42f628e52501768584e0 (diff)
async ioctls working.
Diffstat (limited to 'examples')
-rw-r--r--examples/rpi-pico-w/src/main.rs21
1 files changed, 15 insertions, 6 deletions
diff --git a/examples/rpi-pico-w/src/main.rs b/examples/rpi-pico-w/src/main.rs
index de8c5a2ba..7545dfde8 100644
--- a/examples/rpi-pico-w/src/main.rs
+++ b/examples/rpi-pico-w/src/main.rs
@@ -6,11 +6,12 @@ use core::slice;
6 6
7use defmt::{assert, assert_eq, panic, *}; 7use defmt::{assert, assert_eq, panic, *};
8use embassy::executor::Spawner; 8use embassy::executor::Spawner;
9use embassy::util::Forever;
9use embassy_rp::gpio::{Flex, Level, Output, Pin}; 10use embassy_rp::gpio::{Flex, Level, Output, Pin};
11use embassy_rp::peripherals::{PIN_23, PIN_24, PIN_25, PIN_29};
10use embassy_rp::Peripherals; 12use embassy_rp::Peripherals;
11use {defmt_rtt as _, panic_probe as _}; 13use {defmt_rtt as _, panic_probe as _};
12 14
13
14macro_rules! forever { 15macro_rules! forever {
15 ($val:expr) => {{ 16 ($val:expr) => {{
16 type T = impl Sized; 17 type T = impl Sized;
@@ -19,21 +20,29 @@ macro_rules! forever {
19 }}; 20 }};
20} 21}
21 22
23#[embassy::task]
24async fn wifi_task(runner: cyw43::Runner<'static, PIN_23, PIN_25, PIN_29, PIN_24>) -> ! {
25 runner.run().await
26}
27
22#[embassy::main] 28#[embassy::main]
23async fn main(_spawner: Spawner, p: Peripherals) { 29async fn main(spawner: Spawner, p: Peripherals) {
24 info!("Hello World!"); 30 info!("Hello World!");
25 31
26 let (pwr, cs, clk, dio) = (p.PIN_23, p.PIN_25, p.PIN_29, p.PIN_24); 32 let (pwr, cs, clk, dio) = (p.PIN_23, p.PIN_25, p.PIN_29, p.PIN_24);
27 //let (pwr, cs, clk, dio) = (p.PIN_23, p.PIN_0, p.PIN_1, p.PIN_2); 33 //let (pwr, cs, clk, dio) = (p.PIN_23, p.PIN_0, p.PIN_1, p.PIN_2);
28 34
29 let mut driver = cyw43::Driver::new( 35 let state = forever!(cyw43::State::new());
36 let (mut control, runner) = cyw43::new(
37 state,
30 Output::new(pwr, Level::Low), 38 Output::new(pwr, Level::Low),
31 Output::new(cs, Level::High), 39 Output::new(cs, Level::High),
32 Output::new(clk, Level::Low), 40 Output::new(clk, Level::Low),
33 Flex::new(dio), 41 Flex::new(dio),
34 ); 42 )
43 .await;
35 44
36 driver.init().await; 45 spawner.spawn(wifi_task(runner)).unwrap();
37 46
38 loop {} 47 control.init().await;
39} 48}