diff options
| author | Dario Nieuwenhuis <[email protected]> | 2025-05-30 11:15:54 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-05-30 11:15:54 +0000 |
| commit | 9b8d6d6f22193ba020ed18c622cb8c6d59e1254f (patch) | |
| tree | 366df85c40a80fc228caa22830c53a27c8ca7703 | |
| parent | 675dd81a0f3da79feb35e8deaa81436e5e39b64e (diff) | |
| parent | 86efdc9cc39a47269d384424dc09c4642444e357 (diff) | |
Merge pull request #4267 from melvdlin/stm32-qspi-from
convert embassy-stm32::qspi::enums `Into` impls into equivalant `From` impls
| -rw-r--r-- | embassy-stm32/src/qspi/enums.rs | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/embassy-stm32/src/qspi/enums.rs b/embassy-stm32/src/qspi/enums.rs index ecade9b1a..9ec4c1b43 100644 --- a/embassy-stm32/src/qspi/enums.rs +++ b/embassy-stm32/src/qspi/enums.rs | |||
| @@ -9,9 +9,9 @@ pub(crate) enum QspiMode { | |||
| 9 | MemoryMapped, | 9 | MemoryMapped, |
| 10 | } | 10 | } |
| 11 | 11 | ||
| 12 | impl Into<u8> for QspiMode { | 12 | impl From<QspiMode> for u8 { |
| 13 | fn into(self) -> u8 { | 13 | fn from(val: QspiMode) -> Self { |
| 14 | match self { | 14 | match val { |
| 15 | QspiMode::IndirectWrite => 0b00, | 15 | QspiMode::IndirectWrite => 0b00, |
| 16 | QspiMode::IndirectRead => 0b01, | 16 | QspiMode::IndirectRead => 0b01, |
| 17 | QspiMode::AutoPolling => 0b10, | 17 | QspiMode::AutoPolling => 0b10, |
| @@ -34,9 +34,9 @@ pub enum QspiWidth { | |||
| 34 | QUAD, | 34 | QUAD, |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | impl Into<u8> for QspiWidth { | 37 | impl From<QspiWidth> for u8 { |
| 38 | fn into(self) -> u8 { | 38 | fn from(val: QspiWidth) -> Self { |
| 39 | match self { | 39 | match val { |
| 40 | QspiWidth::NONE => 0b00, | 40 | QspiWidth::NONE => 0b00, |
| 41 | QspiWidth::SING => 0b01, | 41 | QspiWidth::SING => 0b01, |
| 42 | QspiWidth::DUAL => 0b10, | 42 | QspiWidth::DUAL => 0b10, |
| @@ -55,9 +55,9 @@ pub enum FlashSelection { | |||
| 55 | Flash2, | 55 | Flash2, |
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | impl Into<bool> for FlashSelection { | 58 | impl From<FlashSelection> for bool { |
| 59 | fn into(self) -> bool { | 59 | fn from(val: FlashSelection) -> Self { |
| 60 | match self { | 60 | match val { |
| 61 | FlashSelection::Flash1 => false, | 61 | FlashSelection::Flash1 => false, |
| 62 | FlashSelection::Flash2 => true, | 62 | FlashSelection::Flash2 => true, |
| 63 | } | 63 | } |
| @@ -94,9 +94,9 @@ pub enum MemorySize { | |||
| 94 | Other(u8), | 94 | Other(u8), |
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | impl Into<u8> for MemorySize { | 97 | impl From<MemorySize> for u8 { |
| 98 | fn into(self) -> u8 { | 98 | fn from(val: MemorySize) -> Self { |
| 99 | match self { | 99 | match val { |
| 100 | MemorySize::_1KiB => 9, | 100 | MemorySize::_1KiB => 9, |
| 101 | MemorySize::_2KiB => 10, | 101 | MemorySize::_2KiB => 10, |
| 102 | MemorySize::_4KiB => 11, | 102 | MemorySize::_4KiB => 11, |
| @@ -138,9 +138,9 @@ pub enum AddressSize { | |||
| 138 | _32bit, | 138 | _32bit, |
| 139 | } | 139 | } |
| 140 | 140 | ||
| 141 | impl Into<u8> for AddressSize { | 141 | impl From<AddressSize> for u8 { |
| 142 | fn into(self) -> u8 { | 142 | fn from(val: AddressSize) -> Self { |
| 143 | match self { | 143 | match val { |
| 144 | AddressSize::_8Bit => 0b00, | 144 | AddressSize::_8Bit => 0b00, |
| 145 | AddressSize::_16Bit => 0b01, | 145 | AddressSize::_16Bit => 0b01, |
| 146 | AddressSize::_24bit => 0b10, | 146 | AddressSize::_24bit => 0b10, |
| @@ -163,9 +163,9 @@ pub enum ChipSelectHighTime { | |||
| 163 | _8Cycle, | 163 | _8Cycle, |
| 164 | } | 164 | } |
| 165 | 165 | ||
| 166 | impl Into<u8> for ChipSelectHighTime { | 166 | impl From<ChipSelectHighTime> for u8 { |
| 167 | fn into(self) -> u8 { | 167 | fn from(val: ChipSelectHighTime) -> Self { |
| 168 | match self { | 168 | match val { |
| 169 | ChipSelectHighTime::_1Cycle => 0, | 169 | ChipSelectHighTime::_1Cycle => 0, |
| 170 | ChipSelectHighTime::_2Cycle => 1, | 170 | ChipSelectHighTime::_2Cycle => 1, |
| 171 | ChipSelectHighTime::_3Cycle => 2, | 171 | ChipSelectHighTime::_3Cycle => 2, |
| @@ -216,9 +216,9 @@ pub enum FIFOThresholdLevel { | |||
| 216 | _32Bytes, | 216 | _32Bytes, |
| 217 | } | 217 | } |
| 218 | 218 | ||
| 219 | impl Into<u8> for FIFOThresholdLevel { | 219 | impl From<FIFOThresholdLevel> for u8 { |
| 220 | fn into(self) -> u8 { | 220 | fn from(val: FIFOThresholdLevel) -> Self { |
| 221 | match self { | 221 | match val { |
| 222 | FIFOThresholdLevel::_1Bytes => 0, | 222 | FIFOThresholdLevel::_1Bytes => 0, |
| 223 | FIFOThresholdLevel::_2Bytes => 1, | 223 | FIFOThresholdLevel::_2Bytes => 1, |
| 224 | FIFOThresholdLevel::_3Bytes => 2, | 224 | FIFOThresholdLevel::_3Bytes => 2, |
| @@ -293,9 +293,9 @@ pub enum DummyCycles { | |||
| 293 | _31, | 293 | _31, |
| 294 | } | 294 | } |
| 295 | 295 | ||
| 296 | impl Into<u8> for DummyCycles { | 296 | impl From<DummyCycles> for u8 { |
| 297 | fn into(self) -> u8 { | 297 | fn from(val: DummyCycles) -> Self { |
| 298 | match self { | 298 | match val { |
| 299 | DummyCycles::_0 => 0, | 299 | DummyCycles::_0 => 0, |
| 300 | DummyCycles::_1 => 1, | 300 | DummyCycles::_1 => 1, |
| 301 | DummyCycles::_2 => 2, | 301 | DummyCycles::_2 => 2, |
