Abstract chip reset logic, add Reset impls for cortex-m and esp32c3

This commit is contained in:
Kaitlyn Kenwell 2023-12-14 13:29:26 -05:00
parent cbc8ccc51e
commit 9f9f6e75bb
8 changed files with 64 additions and 20 deletions
examples/boot/application/stm32wb-dfu

View file

@ -12,7 +12,7 @@ embassy-stm32 = { version = "0.1.0", path = "../../../../embassy-stm32", feature
embassy-boot-stm32 = { version = "0.1.0", path = "../../../../embassy-boot/stm32", features = [] }
embassy-embedded-hal = { version = "0.1.0", path = "../../../../embassy-embedded-hal" }
embassy-usb = { version = "0.1.0", path = "../../../../embassy-usb" }
embassy-usb-dfu = { version = "0.1.0", path = "../../../../embassy-usb-dfu", features = ["application"] }
embassy-usb-dfu = { version = "0.1.0", path = "../../../../embassy-usb-dfu", features = ["application", "cortex-m"] }
defmt = { version = "0.3", optional = true }
defmt-rtt = { version = "0.4", optional = true }

View file

@ -16,7 +16,7 @@ use embassy_sync::blocking_mutex::Mutex;
use embassy_time::Duration;
use embassy_usb::Builder;
use embassy_usb_dfu::consts::DfuAttributes;
use embassy_usb_dfu::{usb_dfu, Control};
use embassy_usb_dfu::{usb_dfu, Control, ResetImmediate};
use panic_reset as _;
bind_interrupts!(struct Irqs {
@ -57,7 +57,7 @@ async fn main(_spawner: Spawner) {
&mut control_buf,
);
usb_dfu::<_, _>(&mut builder, &mut state, Duration::from_millis(2500));
usb_dfu::<_, _, ResetImmediate>(&mut builder, &mut state, Duration::from_millis(2500));
let mut dev = builder.build();
dev.run().await