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
committed by Dario Nieuwenhuis
parent 39ac7e574f
commit 1c56523341
8 changed files with 64 additions and 20 deletions

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

View File

@ -17,7 +17,7 @@ cortex-m-rt = { version = "0.7" }
embedded-storage = "0.3.1"
embedded-storage-async = "0.4.0"
cfg-if = "1.0.0"
embassy-usb-dfu = { version = "0.1.0", path = "../../../../embassy-usb-dfu", features = ["bootloader"] }
embassy-usb-dfu = { version = "0.1.0", path = "../../../../embassy-usb-dfu", features = ["bootloader", "cortex-m"] }
embassy-usb = { version = "0.1.0", path = "../../../../embassy-usb", default-features = false }
embassy-futures = { version = "0.1.1", path = "../../../../embassy-futures" }

View File

@ -14,7 +14,7 @@ use embassy_stm32::{bind_interrupts, peripherals, usb};
use embassy_sync::blocking_mutex::Mutex;
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};
bind_interrupts!(struct Irqs {
USB_LP => usb::InterruptHandler<peripherals::USB>;
@ -64,7 +64,7 @@ fn main() -> ! {
&mut control_buf,
);
usb_dfu::<_, _, _, 4096>(&mut builder, &mut state);
usb_dfu::<_, _, _, ResetImmediate, 4096>(&mut builder, &mut state);
let mut dev = builder.build();
embassy_futures::block_on(dev.run());