diff options
Diffstat (limited to 'embassy-usb-dfu/src/application.rs')
| -rw-r--r-- | embassy-usb-dfu/src/application.rs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/embassy-usb-dfu/src/application.rs b/embassy-usb-dfu/src/application.rs index e93c241ad..3c1e8b2cc 100644 --- a/embassy-usb-dfu/src/application.rs +++ b/embassy-usb-dfu/src/application.rs | |||
| @@ -1,5 +1,3 @@ | |||
| 1 | use core::marker::PhantomData; | ||
| 2 | |||
| 3 | use embassy_boot::BlockingFirmwareState; | 1 | use embassy_boot::BlockingFirmwareState; |
| 4 | use embassy_time::{Duration, Instant}; | 2 | use embassy_time::{Duration, Instant}; |
| 5 | use embassy_usb::control::{InResponse, OutResponse, Recipient, RequestType}; | 3 | use embassy_usb::control::{InResponse, OutResponse, Recipient, RequestType}; |
| @@ -36,19 +34,19 @@ pub struct Control<MARK: DfuMarker, RST: Reset> { | |||
| 36 | state: State, | 34 | state: State, |
| 37 | timeout: Option<Duration>, | 35 | timeout: Option<Duration>, |
| 38 | detach_start: Option<Instant>, | 36 | detach_start: Option<Instant>, |
| 39 | _rst: PhantomData<RST>, | 37 | reset: RST, |
| 40 | } | 38 | } |
| 41 | 39 | ||
| 42 | impl<MARK: DfuMarker, RST: Reset> Control<MARK, RST> { | 40 | impl<MARK: DfuMarker, RST: Reset> Control<MARK, RST> { |
| 43 | /// Create a new DFU instance to expose a DFU interface. | 41 | /// Create a new DFU instance to expose a DFU interface. |
| 44 | pub fn new(dfu_marker: MARK, attrs: DfuAttributes) -> Self { | 42 | pub fn new(dfu_marker: MARK, attrs: DfuAttributes, reset: RST) -> Self { |
| 45 | Control { | 43 | Control { |
| 46 | dfu_marker, | 44 | dfu_marker, |
| 47 | attrs, | 45 | attrs, |
| 48 | state: State::AppIdle, | 46 | state: State::AppIdle, |
| 49 | detach_start: None, | 47 | detach_start: None, |
| 50 | timeout: None, | 48 | timeout: None, |
| 51 | _rst: PhantomData, | 49 | reset, |
| 52 | } | 50 | } |
| 53 | } | 51 | } |
| 54 | } | 52 | } |
| @@ -65,7 +63,7 @@ impl<MARK: DfuMarker, RST: Reset> Handler for Control<MARK, RST> { | |||
| 65 | ); | 63 | ); |
| 66 | if delta < timeout { | 64 | if delta < timeout { |
| 67 | self.dfu_marker.mark_dfu(); | 65 | self.dfu_marker.mark_dfu(); |
| 68 | RST::sys_reset() | 66 | self.reset.sys_reset() |
| 69 | } | 67 | } |
| 70 | } | 68 | } |
| 71 | } | 69 | } |
