diff options
| author | Dario Nieuwenhuis <[email protected]> | 2023-06-27 22:39:00 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-06-27 22:39:00 +0000 |
| commit | 9b5d7ec06152e4f5dd036f813605a4bafb7e8621 (patch) | |
| tree | 22564eaf7bf22140a06c36717f124a1e645cf41b /examples | |
| parent | 45561f1622c9d883c8a9fa990c22a8a373d6ce5e (diff) | |
| parent | ed493be869fa653dc14d31060375e17e2469ce11 (diff) | |
Merge pull request #1589 from embassy-rs/otg-fixes
stm32/otg: implement VBUS detection, misc fixes so plug/unplug works.
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/stm32f4/src/bin/usb_ethernet.rs | 4 | ||||
| -rw-r--r-- | examples/stm32f4/src/bin/usb_serial.rs | 4 | ||||
| -rw-r--r-- | examples/stm32f7/src/bin/usb_serial.rs | 4 | ||||
| -rw-r--r-- | examples/stm32g4/src/bin/usb_serial.rs | 4 | ||||
| -rw-r--r-- | examples/stm32h7/src/bin/usb_serial.rs | 4 | ||||
| -rw-r--r-- | examples/stm32l4/src/bin/usb_serial.rs | 4 | ||||
| -rw-r--r-- | examples/stm32u5/src/bin/usb_serial.rs | 4 |
7 files changed, 21 insertions, 7 deletions
diff --git a/examples/stm32f4/src/bin/usb_ethernet.rs b/examples/stm32f4/src/bin/usb_ethernet.rs index 953d99a45..b1f01417c 100644 --- a/examples/stm32f4/src/bin/usb_ethernet.rs +++ b/examples/stm32f4/src/bin/usb_ethernet.rs | |||
| @@ -52,7 +52,9 @@ async fn main(spawner: Spawner) { | |||
| 52 | 52 | ||
| 53 | // Create the driver, from the HAL. | 53 | // Create the driver, from the HAL. |
| 54 | let ep_out_buffer = &mut make_static!([0; 256])[..]; | 54 | let ep_out_buffer = &mut make_static!([0; 256])[..]; |
| 55 | let driver = Driver::new_fs(p.USB_OTG_FS, Irqs, p.PA12, p.PA11, ep_out_buffer); | 55 | let mut config = embassy_stm32::usb_otg::Config::default(); |
| 56 | config.vbus_detection = true; | ||
| 57 | let driver = Driver::new_fs(p.USB_OTG_FS, Irqs, p.PA12, p.PA11, ep_out_buffer, config); | ||
| 56 | 58 | ||
| 57 | // Create embassy-usb Config | 59 | // Create embassy-usb Config |
| 58 | let mut config = embassy_usb::Config::new(0xc0de, 0xcafe); | 60 | let mut config = embassy_usb::Config::new(0xc0de, 0xcafe); |
diff --git a/examples/stm32f4/src/bin/usb_serial.rs b/examples/stm32f4/src/bin/usb_serial.rs index f8f5940a7..4ff6452ef 100644 --- a/examples/stm32f4/src/bin/usb_serial.rs +++ b/examples/stm32f4/src/bin/usb_serial.rs | |||
| @@ -29,7 +29,9 @@ async fn main(_spawner: Spawner) { | |||
| 29 | 29 | ||
| 30 | // Create the driver, from the HAL. | 30 | // Create the driver, from the HAL. |
| 31 | let mut ep_out_buffer = [0u8; 256]; | 31 | let mut ep_out_buffer = [0u8; 256]; |
| 32 | let driver = Driver::new_fs(p.USB_OTG_FS, Irqs, p.PA12, p.PA11, &mut ep_out_buffer); | 32 | let mut config = embassy_stm32::usb_otg::Config::default(); |
| 33 | config.vbus_detection = true; | ||
| 34 | let driver = Driver::new_fs(p.USB_OTG_FS, Irqs, p.PA12, p.PA11, &mut ep_out_buffer, config); | ||
| 33 | 35 | ||
| 34 | // Create embassy-usb Config | 36 | // Create embassy-usb Config |
| 35 | let mut config = embassy_usb::Config::new(0xc0de, 0xcafe); | 37 | let mut config = embassy_usb::Config::new(0xc0de, 0xcafe); |
diff --git a/examples/stm32f7/src/bin/usb_serial.rs b/examples/stm32f7/src/bin/usb_serial.rs index 763309ce2..a2c76178b 100644 --- a/examples/stm32f7/src/bin/usb_serial.rs +++ b/examples/stm32f7/src/bin/usb_serial.rs | |||
| @@ -30,7 +30,9 @@ async fn main(_spawner: Spawner) { | |||
| 30 | 30 | ||
| 31 | // Create the driver, from the HAL. | 31 | // Create the driver, from the HAL. |
| 32 | let mut ep_out_buffer = [0u8; 256]; | 32 | let mut ep_out_buffer = [0u8; 256]; |
| 33 | let driver = Driver::new_fs(p.USB_OTG_FS, Irqs, p.PA12, p.PA11, &mut ep_out_buffer); | 33 | let mut config = embassy_stm32::usb_otg::Config::default(); |
| 34 | config.vbus_detection = true; | ||
| 35 | let driver = Driver::new_fs(p.USB_OTG_FS, Irqs, p.PA12, p.PA11, &mut ep_out_buffer, config); | ||
| 34 | 36 | ||
| 35 | // Create embassy-usb Config | 37 | // Create embassy-usb Config |
| 36 | let mut config = embassy_usb::Config::new(0xc0de, 0xcafe); | 38 | let mut config = embassy_usb::Config::new(0xc0de, 0xcafe); |
diff --git a/examples/stm32g4/src/bin/usb_serial.rs b/examples/stm32g4/src/bin/usb_serial.rs index c111a9787..289d0ed86 100644 --- a/examples/stm32g4/src/bin/usb_serial.rs +++ b/examples/stm32g4/src/bin/usb_serial.rs | |||
| @@ -38,7 +38,9 @@ async fn main(_spawner: Spawner) { | |||
| 38 | let p = embassy_stm32::init(config); | 38 | let p = embassy_stm32::init(config); |
| 39 | info!("Hello World!"); | 39 | info!("Hello World!"); |
| 40 | 40 | ||
| 41 | pac::RCC.ccipr().write(|w| w.set_clk48sel(0b10)); | 41 | pac::RCC.ccipr().write(|w| { |
| 42 | w.set_clk48sel(pac::rcc::vals::Clk48sel::PLLQCLK); | ||
| 43 | }); | ||
| 42 | 44 | ||
| 43 | let driver = Driver::new(p.USB, Irqs, p.PA12, p.PA11); | 45 | let driver = Driver::new(p.USB, Irqs, p.PA12, p.PA11); |
| 44 | 46 | ||
diff --git a/examples/stm32h7/src/bin/usb_serial.rs b/examples/stm32h7/src/bin/usb_serial.rs index c622f19f7..97291f60c 100644 --- a/examples/stm32h7/src/bin/usb_serial.rs +++ b/examples/stm32h7/src/bin/usb_serial.rs | |||
| @@ -29,7 +29,9 @@ async fn main(_spawner: Spawner) { | |||
| 29 | 29 | ||
| 30 | // Create the driver, from the HAL. | 30 | // Create the driver, from the HAL. |
| 31 | let mut ep_out_buffer = [0u8; 256]; | 31 | let mut ep_out_buffer = [0u8; 256]; |
| 32 | let driver = Driver::new_fs(p.USB_OTG_FS, Irqs, p.PA12, p.PA11, &mut ep_out_buffer); | 32 | let mut config = embassy_stm32::usb_otg::Config::default(); |
| 33 | config.vbus_detection = true; | ||
| 34 | let driver = Driver::new_fs(p.USB_OTG_FS, Irqs, p.PA12, p.PA11, &mut ep_out_buffer, config); | ||
| 33 | 35 | ||
| 34 | // Create embassy-usb Config | 36 | // Create embassy-usb Config |
| 35 | let mut config = embassy_usb::Config::new(0xc0de, 0xcafe); | 37 | let mut config = embassy_usb::Config::new(0xc0de, 0xcafe); |
diff --git a/examples/stm32l4/src/bin/usb_serial.rs b/examples/stm32l4/src/bin/usb_serial.rs index 80811a43e..410d6891b 100644 --- a/examples/stm32l4/src/bin/usb_serial.rs +++ b/examples/stm32l4/src/bin/usb_serial.rs | |||
| @@ -30,7 +30,9 @@ async fn main(_spawner: Spawner) { | |||
| 30 | 30 | ||
| 31 | // Create the driver, from the HAL. | 31 | // Create the driver, from the HAL. |
| 32 | let mut ep_out_buffer = [0u8; 256]; | 32 | let mut ep_out_buffer = [0u8; 256]; |
| 33 | let driver = Driver::new_fs(p.USB_OTG_FS, Irqs, p.PA12, p.PA11, &mut ep_out_buffer); | 33 | let mut config = embassy_stm32::usb_otg::Config::default(); |
| 34 | config.vbus_detection = true; | ||
| 35 | let driver = Driver::new_fs(p.USB_OTG_FS, Irqs, p.PA12, p.PA11, &mut ep_out_buffer, config); | ||
| 34 | 36 | ||
| 35 | // Create embassy-usb Config | 37 | // Create embassy-usb Config |
| 36 | let mut config = embassy_usb::Config::new(0xc0de, 0xcafe); | 38 | let mut config = embassy_usb::Config::new(0xc0de, 0xcafe); |
diff --git a/examples/stm32u5/src/bin/usb_serial.rs b/examples/stm32u5/src/bin/usb_serial.rs index f36daf91b..9e47fb18a 100644 --- a/examples/stm32u5/src/bin/usb_serial.rs +++ b/examples/stm32u5/src/bin/usb_serial.rs | |||
| @@ -31,7 +31,9 @@ async fn main(_spawner: Spawner) { | |||
| 31 | 31 | ||
| 32 | // Create the driver, from the HAL. | 32 | // Create the driver, from the HAL. |
| 33 | let mut ep_out_buffer = [0u8; 256]; | 33 | let mut ep_out_buffer = [0u8; 256]; |
| 34 | let driver = Driver::new_fs(p.USB_OTG_FS, Irqs, p.PA12, p.PA11, &mut ep_out_buffer); | 34 | let mut config = embassy_stm32::usb_otg::Config::default(); |
| 35 | config.vbus_detection = true; | ||
| 36 | let driver = Driver::new_fs(p.USB_OTG_FS, Irqs, p.PA12, p.PA11, &mut ep_out_buffer, config); | ||
| 35 | 37 | ||
| 36 | // Create embassy-usb Config | 38 | // Create embassy-usb Config |
| 37 | let mut config = embassy_usb::Config::new(0xc0de, 0xcafe); | 39 | let mut config = embassy_usb::Config::new(0xc0de, 0xcafe); |
