diff options
| author | Dario Nieuwenhuis <[email protected]> | 2022-09-29 15:52:23 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2022-09-29 15:52:23 +0200 |
| commit | dab17627093faa709f309c81f067ed2b578f2a8e (patch) | |
| tree | a6b0139df4ccc8acf8f57c83226207bb3cc60308 /embassy-usb-driver/src/lib.rs | |
| parent | ebf5a92ab2c23cc6430e83109cd5762904cf2c41 (diff) | |
usb: remove all "Direction as u8" casts.
Diffstat (limited to 'embassy-usb-driver/src/lib.rs')
| -rw-r--r-- | embassy-usb-driver/src/lib.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/embassy-usb-driver/src/lib.rs b/embassy-usb-driver/src/lib.rs index fc29786fc..931e9c318 100644 --- a/embassy-usb-driver/src/lib.rs +++ b/embassy-usb-driver/src/lib.rs | |||
| @@ -54,12 +54,16 @@ impl From<EndpointAddress> for u8 { | |||
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | impl EndpointAddress { | 56 | impl EndpointAddress { |
| 57 | const INBITS: u8 = Direction::In as u8; | 57 | const INBITS: u8 = 0x80; |
| 58 | 58 | ||
| 59 | /// Constructs a new EndpointAddress with the given index and direction. | 59 | /// Constructs a new EndpointAddress with the given index and direction. |
| 60 | #[inline] | 60 | #[inline] |
| 61 | pub fn from_parts(index: usize, dir: Direction) -> Self { | 61 | pub fn from_parts(index: usize, dir: Direction) -> Self { |
| 62 | EndpointAddress(index as u8 | dir as u8) | 62 | let dir_u8 = match dir { |
| 63 | Direction::Out => 0x00, | ||
| 64 | Direction::In => Self::INBITS, | ||
| 65 | }; | ||
| 66 | EndpointAddress(index as u8 | dir_u8) | ||
| 63 | } | 67 | } |
| 64 | 68 | ||
| 65 | /// Gets the direction part of the address. | 69 | /// Gets the direction part of the address. |
