aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.vscode/settings.json1
-rw-r--r--Cargo.toml6
-rw-r--r--cyw43-pio/Cargo.toml13
-rw-r--r--cyw43-pio/src/lib.rs (renamed from examples/rpi-pico-w/src/pio.rs)12
-rw-r--r--examples/rpi-pico-w/Cargo.toml3
-rw-r--r--examples/rpi-pico-w/src/main.rs5
6 files changed, 31 insertions, 9 deletions
diff --git a/.vscode/settings.json b/.vscode/settings.json
index dd479929e..344307695 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -9,6 +9,7 @@
9 "rust-analyzer.check.noDefaultFeatures": true, 9 "rust-analyzer.check.noDefaultFeatures": true,
10 "rust-analyzer.linkedProjects": [ 10 "rust-analyzer.linkedProjects": [
11 "examples/rpi-pico-w/Cargo.toml", 11 "examples/rpi-pico-w/Cargo.toml",
12 "cyw43-pio/Cargo.toml",
12 ], 13 ],
13 "rust-analyzer.server.extraEnv": { 14 "rust-analyzer.server.extraEnv": {
14 "WIFI_NETWORK": "foo", 15 "WIFI_NETWORK": "foo",
diff --git a/Cargo.toml b/Cargo.toml
index a307a6cc3..04a47a3a5 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -32,3 +32,9 @@ embassy-time = { git = "https://github.com/embassy-rs/embassy", rev = "e3f8020c3
32embassy-futures = { git = "https://github.com/embassy-rs/embassy", rev = "e3f8020c3bdf726dfa451b5b190f27191507a18f" } 32embassy-futures = { git = "https://github.com/embassy-rs/embassy", rev = "e3f8020c3bdf726dfa451b5b190f27191507a18f" }
33embassy-sync = { git = "https://github.com/embassy-rs/embassy", rev = "e3f8020c3bdf726dfa451b5b190f27191507a18f" } 33embassy-sync = { git = "https://github.com/embassy-rs/embassy", rev = "e3f8020c3bdf726dfa451b5b190f27191507a18f" }
34embassy-net-driver-channel = { git = "https://github.com/embassy-rs/embassy", rev = "e3f8020c3bdf726dfa451b5b190f27191507a18f" } 34embassy-net-driver-channel = { git = "https://github.com/embassy-rs/embassy", rev = "e3f8020c3bdf726dfa451b5b190f27191507a18f" }
35embassy-rp = { git = "https://github.com/embassy-rs/embassy", rev = "e3f8020c3bdf726dfa451b5b190f27191507a18f" }
36
37[workspace]
38members = ["cyw43-pio"]
39default-members = ["cyw43-pio", "."]
40exclude = ["examples"] \ No newline at end of file
diff --git a/cyw43-pio/Cargo.toml b/cyw43-pio/Cargo.toml
new file mode 100644
index 000000000..2fc6b7591
--- /dev/null
+++ b/cyw43-pio/Cargo.toml
@@ -0,0 +1,13 @@
1[package]
2name = "cyw43-pio"
3version = "0.1.0"
4edition = "2021"
5
6# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7
8[dependencies]
9cyw43 = { path = "../" }
10embassy-rp = { version = "0.1.0", features = ["defmt", "unstable-traits", "nightly", "unstable-pac", "time-driver", "pio"] }
11pio-proc = "0.2"
12pio = "0.2.1"
13defmt = "0.3" \ No newline at end of file
diff --git a/examples/rpi-pico-w/src/pio.rs b/cyw43-pio/src/lib.rs
index 846113060..2159796cd 100644
--- a/examples/rpi-pico-w/src/pio.rs
+++ b/cyw43-pio/src/lib.rs
@@ -1,3 +1,7 @@
1#![no_std]
2#![allow(incomplete_features)]
3#![feature(async_fn_in_trait)]
4
1use core::slice; 5use core::slice;
2 6
3use cyw43::SpiBusCyw43; 7use cyw43::SpiBusCyw43;
@@ -125,7 +129,8 @@ where
125 129
126 self.sm.dma_push(dma.reborrow(), write).await; 130 self.sm.dma_push(dma.reborrow(), write).await;
127 131
128 let status = self.sm.wait_pull().await; 132 let mut status = 0;
133 self.sm.dma_pull(dma.reborrow(), slice::from_mut(&mut status)).await;
129 status 134 status
130 } 135 }
131 136
@@ -145,9 +150,10 @@ where
145 self.sm.set_enable(true); 150 self.sm.set_enable(true);
146 151
147 self.sm.dma_push(dma.reborrow(), slice::from_ref(&cmd)).await; 152 self.sm.dma_push(dma.reborrow(), slice::from_ref(&cmd)).await;
148 self.sm.dma_pull(dma, read).await; 153 self.sm.dma_pull(dma.reborrow(), read).await;
149 154
150 let status = self.sm.wait_pull().await; 155 let mut status = 0;
156 self.sm.dma_pull(dma.reborrow(), slice::from_mut(&mut status)).await;
151 status 157 status
152 } 158 }
153} 159}
diff --git a/examples/rpi-pico-w/Cargo.toml b/examples/rpi-pico-w/Cargo.toml
index 4a531c88c..41ee8a3c4 100644
--- a/examples/rpi-pico-w/Cargo.toml
+++ b/examples/rpi-pico-w/Cargo.toml
@@ -6,6 +6,7 @@ edition = "2021"
6 6
7[dependencies] 7[dependencies]
8cyw43 = { path = "../../", features = ["defmt", "firmware-logs"] } 8cyw43 = { path = "../../", features = ["defmt", "firmware-logs"] }
9cyw43-pio = { path = "../../cyw43-pio" }
9embassy-executor = { version = "0.1.0", features = ["defmt", "integrated-timers"] } 10embassy-executor = { version = "0.1.0", features = ["defmt", "integrated-timers"] }
10embassy-time = { version = "0.1.0", features = ["defmt", "defmt-timestamp-uptime"] } 11embassy-time = { version = "0.1.0", features = ["defmt", "defmt-timestamp-uptime"] }
11embassy-rp = { version = "0.1.0", features = ["defmt", "unstable-traits", "nightly", "unstable-pac", "time-driver", "pio"] } 12embassy-rp = { version = "0.1.0", features = ["defmt", "unstable-traits", "nightly", "unstable-pac", "time-driver", "pio"] }
@@ -20,8 +21,6 @@ panic-probe = { version = "0.3", features = ["print-defmt"] }
20cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] } 21cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] }
21cortex-m-rt = "0.7.0" 22cortex-m-rt = "0.7.0"
22futures = { version = "0.3.17", default-features = false, features = ["async-await", "cfg-target-has-atomic", "unstable"] } 23futures = { version = "0.3.17", default-features = false, features = ["async-await", "cfg-target-has-atomic", "unstable"] }
23pio-proc = "0.2"
24pio = "0.2.1"
25 24
26embedded-io = { version = "0.4.0", features = ["async", "defmt"] } 25embedded-io = { version = "0.4.0", features = ["async", "defmt"] }
27heapless = "0.7.15" 26heapless = "0.7.15"
diff --git a/examples/rpi-pico-w/src/main.rs b/examples/rpi-pico-w/src/main.rs
index e3c59223b..4b1623be7 100644
--- a/examples/rpi-pico-w/src/main.rs
+++ b/examples/rpi-pico-w/src/main.rs
@@ -4,11 +4,10 @@
4#![feature(async_fn_in_trait)] 4#![feature(async_fn_in_trait)]
5#![allow(incomplete_features)] 5#![allow(incomplete_features)]
6 6
7mod pio;
8
9use core::slice; 7use core::slice;
10use core::str::from_utf8; 8use core::str::from_utf8;
11 9
10use cyw43_pio::PioSpi;
12use defmt::*; 11use defmt::*;
13use embassy_executor::Spawner; 12use embassy_executor::Spawner;
14use embassy_net::tcp::TcpSocket; 13use embassy_net::tcp::TcpSocket;
@@ -20,8 +19,6 @@ use embedded_io::asynch::Write;
20use static_cell::StaticCell; 19use static_cell::StaticCell;
21use {defmt_rtt as _, panic_probe as _}; 20use {defmt_rtt as _, panic_probe as _};
22 21
23use crate::pio::PioSpi;
24
25macro_rules! singleton { 22macro_rules! singleton {
26 ($val:expr) => {{ 23 ($val:expr) => {{
27 type T = impl Sized; 24 type T = impl Sized;