aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerzain Mata <[email protected]>2025-07-27 15:57:55 -0700
committerGerzain Mata <[email protected]>2025-07-27 16:40:25 -0700
commit00f94972d7293b946e4bf7de2722ea55dca6b0db (patch)
treecf371c517ac02218aabfd3dae20960440d353fc9
parent1d3c48cf4539fe1959f25918a6fa3521a5678837 (diff)
parent4e4a1c0054fe1245426798166b3bf51e8a0300d3 (diff)
Merge branch 'main' into feat/stm32wba-usb-example
-rwxr-xr-x.github/ci/book.sh2
-rwxr-xr-x.github/ci/doc.sh1
-rw-r--r--embassy-net/src/lib.rs6
-rw-r--r--examples/rp/src/bin/wifi_tcp_server.rs27
-rw-r--r--examples/rp/src/bin/wifi_webrequest.rs33
-rw-r--r--examples/stm32wba/.cargo/config.toml2
-rw-r--r--examples/stm32wba/Cargo.toml7
-rw-r--r--examples/stm32wba/src/bin/pwm.rs10
8 files changed, 37 insertions, 51 deletions
diff --git a/.github/ci/book.sh b/.github/ci/book.sh
index c91d10d16..dada4b348 100755
--- a/.github/ci/book.sh
+++ b/.github/ci/book.sh
@@ -2,6 +2,7 @@
2## on push branch=main 2## on push branch=main
3## priority -100 3## priority -100
4## dedup dequeue 4## dedup dequeue
5## cooldown 15m
5 6
6set -euxo pipefail 7set -euxo pipefail
7 8
@@ -17,3 +18,4 @@ kubectl exec $POD -- mkdir -p /usr/share/nginx/html
17kubectl cp book.tar $POD:/usr/share/nginx/html/ 18kubectl cp book.tar $POD:/usr/share/nginx/html/
18kubectl exec $POD -- find /usr/share/nginx/html 19kubectl exec $POD -- find /usr/share/nginx/html
19kubectl exec $POD -- tar -C /usr/share/nginx/html -xvf /usr/share/nginx/html/book.tar 20kubectl exec $POD -- tar -C /usr/share/nginx/html -xvf /usr/share/nginx/html/book.tar
213
diff --git a/.github/ci/doc.sh b/.github/ci/doc.sh
index 26971afdc..ac96008d8 100755
--- a/.github/ci/doc.sh
+++ b/.github/ci/doc.sh
@@ -2,6 +2,7 @@
2## on push branch=main 2## on push branch=main
3## priority -100 3## priority -100
4## dedup dequeue 4## dedup dequeue
5## cooldown 15m
5 6
6set -euxo pipefail 7set -euxo pipefail
7 8
diff --git a/embassy-net/src/lib.rs b/embassy-net/src/lib.rs
index 2b1888170..0bc6ffe6c 100644
--- a/embassy-net/src/lib.rs
+++ b/embassy-net/src/lib.rs
@@ -171,7 +171,7 @@ impl Default for DhcpConfig {
171} 171}
172 172
173/// Network stack configuration. 173/// Network stack configuration.
174#[derive(Debug, Clone, Default)] 174#[derive(Debug, Clone, Default, PartialEq, Eq)]
175#[cfg_attr(feature = "defmt", derive(defmt::Format))] 175#[cfg_attr(feature = "defmt", derive(defmt::Format))]
176#[non_exhaustive] 176#[non_exhaustive]
177pub struct Config { 177pub struct Config {
@@ -223,7 +223,7 @@ impl Config {
223 223
224/// Network stack IPv4 configuration. 224/// Network stack IPv4 configuration.
225#[cfg(feature = "proto-ipv4")] 225#[cfg(feature = "proto-ipv4")]
226#[derive(Debug, Clone, Default)] 226#[derive(Debug, Clone, Default, PartialEq, Eq)]
227#[cfg_attr(feature = "defmt", derive(defmt::Format))] 227#[cfg_attr(feature = "defmt", derive(defmt::Format))]
228pub enum ConfigV4 { 228pub enum ConfigV4 {
229 /// Do not configure IPv4. 229 /// Do not configure IPv4.
@@ -238,7 +238,7 @@ pub enum ConfigV4 {
238 238
239/// Network stack IPv6 configuration. 239/// Network stack IPv6 configuration.
240#[cfg(feature = "proto-ipv6")] 240#[cfg(feature = "proto-ipv6")]
241#[derive(Debug, Clone, Default)] 241#[derive(Debug, Clone, Default, PartialEq, Eq)]
242#[cfg_attr(feature = "defmt", derive(defmt::Format))] 242#[cfg_attr(feature = "defmt", derive(defmt::Format))]
243pub enum ConfigV6 { 243pub enum ConfigV6 {
244 /// Do not configure IPv6. 244 /// Do not configure IPv6.
diff --git a/examples/rp/src/bin/wifi_tcp_server.rs b/examples/rp/src/bin/wifi_tcp_server.rs
index fbc957e0e..ed1a03fcf 100644
--- a/examples/rp/src/bin/wifi_tcp_server.rs
+++ b/examples/rp/src/bin/wifi_tcp_server.rs
@@ -18,7 +18,7 @@ use embassy_rp::clocks::RoscRng;
18use embassy_rp::gpio::{Level, Output}; 18use embassy_rp::gpio::{Level, Output};
19use embassy_rp::peripherals::{DMA_CH0, PIO0}; 19use embassy_rp::peripherals::{DMA_CH0, PIO0};
20use embassy_rp::pio::{InterruptHandler, Pio}; 20use embassy_rp::pio::{InterruptHandler, Pio};
21use embassy_time::{Duration, Timer}; 21use embassy_time::Duration;
22use embedded_io_async::Write; 22use embedded_io_async::Write;
23use static_cell::StaticCell; 23use static_cell::StaticCell;
24use {defmt_rtt as _, panic_probe as _}; 24use {defmt_rtt as _, panic_probe as _};
@@ -97,26 +97,21 @@ async fn main(spawner: Spawner) {
97 97
98 unwrap!(spawner.spawn(net_task(runner))); 98 unwrap!(spawner.spawn(net_task(runner)));
99 99
100 loop { 100 while let Err(err) = control
101 match control 101 .join(WIFI_NETWORK, JoinOptions::new(WIFI_PASSWORD.as_bytes()))
102 .join(WIFI_NETWORK, JoinOptions::new(WIFI_PASSWORD.as_bytes())) 102 .await
103 .await 103 {
104 { 104 info!("join failed with status={}", err.status);
105 Ok(_) => break,
106 Err(err) => {
107 info!("join failed with status={}", err.status);
108 }
109 }
110 } 105 }
111 106
112 // Wait for DHCP, not necessary when using static IP 107 info!("waiting for link...");
108 stack.wait_link_up().await;
109
113 info!("waiting for DHCP..."); 110 info!("waiting for DHCP...");
114 while !stack.is_config_up() { 111 stack.wait_config_up().await;
115 Timer::after_millis(100).await;
116 }
117 info!("DHCP is now up!");
118 112
119 // And now we can use it! 113 // And now we can use it!
114 info!("Stack is up!");
120 115
121 let mut rx_buffer = [0; 4096]; 116 let mut rx_buffer = [0; 4096];
122 let mut tx_buffer = [0; 4096]; 117 let mut tx_buffer = [0; 4096];
diff --git a/examples/rp/src/bin/wifi_webrequest.rs b/examples/rp/src/bin/wifi_webrequest.rs
index 1efd1cd28..a75253bb0 100644
--- a/examples/rp/src/bin/wifi_webrequest.rs
+++ b/examples/rp/src/bin/wifi_webrequest.rs
@@ -100,33 +100,20 @@ async fn main(spawner: Spawner) {
100 100
101 unwrap!(spawner.spawn(net_task(runner))); 101 unwrap!(spawner.spawn(net_task(runner)));
102 102
103 loop { 103 while let Err(err) = control
104 match control 104 .join(WIFI_NETWORK, JoinOptions::new(WIFI_PASSWORD.as_bytes()))
105 .join(WIFI_NETWORK, JoinOptions::new(WIFI_PASSWORD.as_bytes())) 105 .await
106 .await 106 {
107 { 107 info!("join failed with status={}", err.status);
108 Ok(_) => break,
109 Err(err) => {
110 info!("join failed with status={}", err.status);
111 }
112 }
113 }
114
115 // Wait for DHCP, not necessary when using static IP
116 info!("waiting for DHCP...");
117 while !stack.is_config_up() {
118 Timer::after_millis(100).await;
119 } 108 }
120 info!("DHCP is now up!");
121 109
122 info!("waiting for link up..."); 110 info!("waiting for link...");
123 while !stack.is_link_up() { 111 stack.wait_link_up().await;
124 Timer::after_millis(500).await;
125 }
126 info!("Link is up!");
127 112
128 info!("waiting for stack to be up..."); 113 info!("waiting for DHCP...");
129 stack.wait_config_up().await; 114 stack.wait_config_up().await;
115
116 // And now we can use it!
130 info!("Stack is up!"); 117 info!("Stack is up!");
131 118
132 // And now we can use it! 119 // And now we can use it!
diff --git a/examples/stm32wba/.cargo/config.toml b/examples/stm32wba/.cargo/config.toml
index 1896068d8..c96a5cb6c 100644
--- a/examples/stm32wba/.cargo/config.toml
+++ b/examples/stm32wba/.cargo/config.toml
@@ -1,5 +1,5 @@
1[target.'cfg(all(target_arch = "arm", target_os = "none"))'] 1[target.'cfg(all(target_arch = "arm", target_os = "none"))']
2runner = "probe-rs run --chip STM32WBA65RI" 2runner = "probe-rs run --chip STM32WBA55CGUx"
3 3
4[build] 4[build]
5target = "thumbv8m.main-none-eabihf" 5target = "thumbv8m.main-none-eabihf"
diff --git a/examples/stm32wba/Cargo.toml b/examples/stm32wba/Cargo.toml
index 336ea1e2e..2c638f9f4 100644
--- a/examples/stm32wba/Cargo.toml
+++ b/examples/stm32wba/Cargo.toml
@@ -5,19 +5,18 @@ version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
6 6
7[dependencies] 7[dependencies]
8embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = [ "defmt", "stm32wba65ri", "time-driver-any", "memory-x", "exti"] } 8embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = [ "defmt", "stm32wba55cg", "time-driver-any", "memory-x", "exti"] }
9embassy-sync = { version = "0.7.0", path = "../../embassy-sync", features = ["defmt"] } 9embassy-sync = { version = "0.7.0", path = "../../embassy-sync", features = ["defmt"] }
10embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt"] } 10embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt"] }
11embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } 11embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] }
12embassy-usb = { version = "0.5.0", path = "../../embassy-usb", features = ["defmt"] } 12embassy-net = { version = "0.7.0", path = "../../embassy-net", features = ["defmt", "udp", "proto-ipv6", "medium-ieee802154", ], optional = true }
13embassy-futures = { version = "0.1.0", path = "../../embassy-futures" }
14 13
15defmt = "1.0.1" 14defmt = "1.0.1"
16defmt-rtt = "1.0.0" 15defmt-rtt = "1.0.0"
17 16
18cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] } 17cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] }
19cortex-m-rt = "0.7.0" 18cortex-m-rt = "0.7.0"
20embedded-hal = "0.2.6" 19embedded-hal = "1.0.0"
21panic-probe = { version = "1.0.0", features = ["print-defmt"] } 20panic-probe = { version = "1.0.0", features = ["print-defmt"] }
22heapless = { version = "0.8", default-features = false } 21heapless = { version = "0.8", default-features = false }
23static_cell = "2" 22static_cell = "2"
diff --git a/examples/stm32wba/src/bin/pwm.rs b/examples/stm32wba/src/bin/pwm.rs
index fc1e0ff2d..de690fda0 100644
--- a/examples/stm32wba/src/bin/pwm.rs
+++ b/examples/stm32wba/src/bin/pwm.rs
@@ -5,8 +5,9 @@ use defmt::*;
5use defmt_rtt as _; // global logger 5use defmt_rtt as _; // global logger
6use embassy_executor::Spawner; 6use embassy_executor::Spawner;
7use embassy_stm32::gpio::OutputType; 7use embassy_stm32::gpio::OutputType;
8use embassy_stm32::rcc::{AHB5Prescaler, AHBPrescaler, APBPrescaler, Sysclk, VoltageScale}; 8use embassy_stm32::rcc::{
9use embassy_stm32::rcc::{PllDiv, PllMul, PllPreDiv, PllSource}; 9 AHB5Prescaler, AHBPrescaler, APBPrescaler, PllDiv, PllMul, PllPreDiv, PllSource, Sysclk, VoltageScale,
10};
10use embassy_stm32::time::khz; 11use embassy_stm32::time::khz;
11use embassy_stm32::timer::simple_pwm::{PwmPin, SimplePwm}; 12use embassy_stm32::timer::simple_pwm::{PwmPin, SimplePwm};
12use embassy_stm32::Config; 13use embassy_stm32::Config;
@@ -38,12 +39,13 @@ async fn main(_spawner: Spawner) {
38 39
39 // voltage scale for max performance 40 // voltage scale for max performance
40 config.rcc.voltage_scale = VoltageScale::RANGE1; 41 config.rcc.voltage_scale = VoltageScale::RANGE1;
42 // route PLL1_P into the USB‐OTG‐HS block
41 config.rcc.sys = Sysclk::PLL1_R; 43 config.rcc.sys = Sysclk::PLL1_R;
42 44
43 let p = embassy_stm32::init(config); 45 let p = embassy_stm32::init(config);
44 46
45 let ch1_pin = PwmPin::new(p.PA2, OutputType::PushPull); 47 let ch1_pin = PwmPin::new(p.PB8, OutputType::PushPull);
46 let mut pwm = SimplePwm::new(p.TIM3, Some(ch1_pin), None, None, None, khz(10), Default::default()); 48 let mut pwm = SimplePwm::new(p.TIM1, Some(ch1_pin), None, None, None, khz(10), Default::default());
47 let mut ch1 = pwm.ch1(); 49 let mut ch1 = pwm.ch1();
48 ch1.enable(); 50 ch1.enable();
49 51