aboutsummaryrefslogtreecommitdiff
path: root/embassy-stm32/src/usb
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2025-09-06 00:11:59 +0200
committerDario Nieuwenhuis <[email protected]>2025-09-06 00:14:03 +0200
commita23c4b7bca15bc00f4b5c4af200f17eb0097e94b (patch)
treef293891a3dad44dc808f31f7aa6fd7fcdb21bbe5 /embassy-stm32/src/usb
parent35f4ae378cbc9a1263e46baaeac536cae2337896 (diff)
stm32/afio: make af_num() unavailable in afio chips.
Diffstat (limited to 'embassy-stm32/src/usb')
-rw-r--r--embassy-stm32/src/usb/otg.rs10
-rw-r--r--embassy-stm32/src/usb/usb.rs6
2 files changed, 8 insertions, 8 deletions
diff --git a/embassy-stm32/src/usb/otg.rs b/embassy-stm32/src/usb/otg.rs
index 1c3b99b93..5ce81b131 100644
--- a/embassy-stm32/src/usb/otg.rs
+++ b/embassy-stm32/src/usb/otg.rs
@@ -34,7 +34,7 @@ macro_rules! config_ulpi_pins {
34 ($($pin:ident),*) => { 34 ($($pin:ident),*) => {
35 critical_section::with(|_| { 35 critical_section::with(|_| {
36 $( 36 $(
37 $pin.set_as_af($pin.af_num(), AfType::output(OutputType::PushPull, Speed::VeryHigh)); 37 set_as_af!($pin, AfType::output(OutputType::PushPull, Speed::VeryHigh));
38 )* 38 )*
39 }) 39 })
40 }; 40 };
@@ -68,8 +68,8 @@ impl<'d, T: Instance> Driver<'d, T> {
68 ep_out_buffer: &'d mut [u8], 68 ep_out_buffer: &'d mut [u8],
69 config: Config, 69 config: Config,
70 ) -> Self { 70 ) -> Self {
71 dp.set_as_af(dp.af_num(), AfType::output(OutputType::PushPull, Speed::VeryHigh)); 71 set_as_af!(dp, AfType::output(OutputType::PushPull, Speed::VeryHigh));
72 dm.set_as_af(dm.af_num(), AfType::output(OutputType::PushPull, Speed::VeryHigh)); 72 set_as_af!(dm, AfType::output(OutputType::PushPull, Speed::VeryHigh));
73 73
74 let regs = T::regs(); 74 let regs = T::regs();
75 75
@@ -107,8 +107,8 @@ impl<'d, T: Instance> Driver<'d, T> {
107 // For STM32U5 High speed pins need to be left in analog mode 107 // For STM32U5 High speed pins need to be left in analog mode
108 #[cfg(not(any(all(stm32u5, peri_usb_otg_hs), all(stm32wba, peri_usb_otg_hs))))] 108 #[cfg(not(any(all(stm32u5, peri_usb_otg_hs), all(stm32wba, peri_usb_otg_hs))))]
109 { 109 {
110 _dp.set_as_af(_dp.af_num(), AfType::output(OutputType::PushPull, Speed::VeryHigh)); 110 set_as_af!(_dp, AfType::output(OutputType::PushPull, Speed::VeryHigh));
111 _dm.set_as_af(_dm.af_num(), AfType::output(OutputType::PushPull, Speed::VeryHigh)); 111 set_as_af!(_dm, AfType::output(OutputType::PushPull, Speed::VeryHigh));
112 } 112 }
113 113
114 let instance = OtgInstance { 114 let instance = OtgInstance {
diff --git a/embassy-stm32/src/usb/usb.rs b/embassy-stm32/src/usb/usb.rs
index 54596aeae..9e08d99b3 100644
--- a/embassy-stm32/src/usb/usb.rs
+++ b/embassy-stm32/src/usb/usb.rs
@@ -298,7 +298,7 @@ impl<'d, T: Instance> Driver<'d, T> {
298 ) -> Self { 298 ) -> Self {
299 { 299 {
300 use crate::gpio::{AfType, OutputType, Speed}; 300 use crate::gpio::{AfType, OutputType, Speed};
301 sof.set_as_af(sof.af_num(), AfType::output(OutputType::PushPull, Speed::VeryHigh)); 301 set_as_af!(sof, AfType::output(OutputType::PushPull, Speed::VeryHigh));
302 } 302 }
303 303
304 Self::new(_usb, _irq, dp, dm) 304 Self::new(_usb, _irq, dp, dm)
@@ -329,8 +329,8 @@ impl<'d, T: Instance> Driver<'d, T> {
329 #[cfg(not(stm32l1))] 329 #[cfg(not(stm32l1))]
330 { 330 {
331 use crate::gpio::{AfType, OutputType, Speed}; 331 use crate::gpio::{AfType, OutputType, Speed};
332 dp.set_as_af(dp.af_num(), AfType::output(OutputType::PushPull, Speed::VeryHigh)); 332 set_as_af!(dp, AfType::output(OutputType::PushPull, Speed::VeryHigh));
333 dm.set_as_af(dm.af_num(), AfType::output(OutputType::PushPull, Speed::VeryHigh)); 333 set_as_af!(dm, AfType::output(OutputType::PushPull, Speed::VeryHigh));
334 } 334 }
335 #[cfg(stm32l1)] 335 #[cfg(stm32l1)]
336 let _ = (dp, dm); // suppress "unused" warnings. 336 let _ = (dp, dm); // suppress "unused" warnings.