diff options
Diffstat (limited to 'embassy-usb-dfu/src/consts.rs')
| -rw-r--r-- | embassy-usb-dfu/src/consts.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/embassy-usb-dfu/src/consts.rs b/embassy-usb-dfu/src/consts.rs index b359a107e..f8a056e5c 100644 --- a/embassy-usb-dfu/src/consts.rs +++ b/embassy-usb-dfu/src/consts.rs | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | //! USB DFU constants. | ||
| 1 | pub(crate) const USB_CLASS_APPN_SPEC: u8 = 0xFE; | 2 | pub(crate) const USB_CLASS_APPN_SPEC: u8 = 0xFE; |
| 2 | pub(crate) const APPN_SPEC_SUBCLASS_DFU: u8 = 0x01; | 3 | pub(crate) const APPN_SPEC_SUBCLASS_DFU: u8 = 0x01; |
| 3 | #[allow(unused)] | 4 | #[allow(unused)] |
| @@ -18,10 +19,15 @@ defmt::bitflags! { | |||
| 18 | 19 | ||
| 19 | #[cfg(not(feature = "defmt"))] | 20 | #[cfg(not(feature = "defmt"))] |
| 20 | bitflags::bitflags! { | 21 | bitflags::bitflags! { |
| 22 | /// Attributes supported by the DFU controller. | ||
| 21 | pub struct DfuAttributes: u8 { | 23 | pub struct DfuAttributes: u8 { |
| 24 | /// Generate WillDetache sequence on bus. | ||
| 22 | const WILL_DETACH = 0b0000_1000; | 25 | const WILL_DETACH = 0b0000_1000; |
| 26 | /// Device can communicate during manifestation phase. | ||
| 23 | const MANIFESTATION_TOLERANT = 0b0000_0100; | 27 | const MANIFESTATION_TOLERANT = 0b0000_0100; |
| 28 | /// Capable of upload. | ||
| 24 | const CAN_UPLOAD = 0b0000_0010; | 29 | const CAN_UPLOAD = 0b0000_0010; |
| 30 | /// Capable of download. | ||
| 25 | const CAN_DOWNLOAD = 0b0000_0001; | 31 | const CAN_DOWNLOAD = 0b0000_0001; |
| 26 | } | 32 | } |
| 27 | } | 33 | } |
| @@ -29,7 +35,7 @@ bitflags::bitflags! { | |||
| 29 | #[derive(Copy, Clone, PartialEq, Eq)] | 35 | #[derive(Copy, Clone, PartialEq, Eq)] |
| 30 | #[repr(u8)] | 36 | #[repr(u8)] |
| 31 | #[allow(unused)] | 37 | #[allow(unused)] |
| 32 | pub enum State { | 38 | pub(crate) enum State { |
| 33 | AppIdle = 0, | 39 | AppIdle = 0, |
| 34 | AppDetach = 1, | 40 | AppDetach = 1, |
| 35 | DfuIdle = 2, | 41 | DfuIdle = 2, |
| @@ -46,7 +52,7 @@ pub enum State { | |||
| 46 | #[derive(Copy, Clone, PartialEq, Eq)] | 52 | #[derive(Copy, Clone, PartialEq, Eq)] |
| 47 | #[repr(u8)] | 53 | #[repr(u8)] |
| 48 | #[allow(unused)] | 54 | #[allow(unused)] |
| 49 | pub enum Status { | 55 | pub(crate) enum Status { |
| 50 | Ok = 0x00, | 56 | Ok = 0x00, |
| 51 | ErrTarget = 0x01, | 57 | ErrTarget = 0x01, |
| 52 | ErrFile = 0x02, | 58 | ErrFile = 0x02, |
| @@ -67,7 +73,7 @@ pub enum Status { | |||
| 67 | 73 | ||
| 68 | #[derive(Copy, Clone, PartialEq, Eq)] | 74 | #[derive(Copy, Clone, PartialEq, Eq)] |
| 69 | #[repr(u8)] | 75 | #[repr(u8)] |
| 70 | pub enum Request { | 76 | pub(crate) enum Request { |
| 71 | Detach = 0, | 77 | Detach = 0, |
| 72 | Dnload = 1, | 78 | Dnload = 1, |
| 73 | Upload = 2, | 79 | Upload = 2, |
