diff options
| author | Dario Nieuwenhuis <[email protected]> | 2025-07-22 16:36:47 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-07-22 16:36:47 +0000 |
| commit | 12fbc65e1aefd637f7b1636533ab1866dc39423d (patch) | |
| tree | 686d661fd0eeaec75b60fa4a357d77a260bd27e9 | |
| parent | 908e016524e1802b736664d84ca2da6ea908444d (diff) | |
| parent | 03b86d75b6861ed8151f4f48682e9b4f5b159232 (diff) | |
Merge pull request #4441 from dimpolo/copy-clone-adc-config
derive Copy, Clone for adc config enums
| -rw-r--r-- | embassy-stm32/src/adc/adc4.rs | 4 | ||||
| -rw-r--r-- | embassy-stm32/src/adc/c0.rs | 3 | ||||
| -rw-r--r-- | embassy-stm32/src/adc/f3_v1_1.rs | 2 | ||||
| -rw-r--r-- | embassy-stm32/src/adc/v4.rs | 1 |
4 files changed, 8 insertions, 2 deletions
diff --git a/embassy-stm32/src/adc/adc4.rs b/embassy-stm32/src/adc/adc4.rs index 98483489f..31cbdc0d7 100644 --- a/embassy-stm32/src/adc/adc4.rs +++ b/embassy-stm32/src/adc/adc4.rs | |||
| @@ -76,12 +76,14 @@ impl<T: Instance> SealedAdcChannel<T> for Vcore { | |||
| 76 | } | 76 | } |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | #[derive(Copy, Clone)] | ||
| 79 | pub enum DacChannel { | 80 | pub enum DacChannel { |
| 80 | OUT1, | 81 | OUT1, |
| 81 | OUT2, | 82 | OUT2, |
| 82 | } | 83 | } |
| 83 | 84 | ||
| 84 | /// Number of samples used for averaging. | 85 | /// Number of samples used for averaging. |
| 86 | #[derive(Copy, Clone)] | ||
| 85 | pub enum Averaging { | 87 | pub enum Averaging { |
| 86 | Disabled, | 88 | Disabled, |
| 87 | Samples2, | 89 | Samples2, |
| @@ -187,7 +189,7 @@ pub struct Adc4<'d, T: Instance> { | |||
| 187 | adc: crate::Peri<'d, T>, | 189 | adc: crate::Peri<'d, T>, |
| 188 | } | 190 | } |
| 189 | 191 | ||
| 190 | #[derive(Debug)] | 192 | #[derive(Copy, Clone, Debug)] |
| 191 | pub enum Adc4Error { | 193 | pub enum Adc4Error { |
| 192 | InvalidSequence, | 194 | InvalidSequence, |
| 193 | DMAError, | 195 | DMAError, |
diff --git a/embassy-stm32/src/adc/c0.rs b/embassy-stm32/src/adc/c0.rs index 936ad7413..f5870801e 100644 --- a/embassy-stm32/src/adc/c0.rs +++ b/embassy-stm32/src/adc/c0.rs | |||
| @@ -48,7 +48,7 @@ impl<T: Instance> SealedAdcChannel<T> for Temperature { | |||
| 48 | } | 48 | } |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | #[derive(Debug)] | 51 | #[derive(Copy, Clone, Debug)] |
| 52 | pub enum Prescaler { | 52 | pub enum Prescaler { |
| 53 | NotDivided, | 53 | NotDivided, |
| 54 | DividedBy2, | 54 | DividedBy2, |
| @@ -138,6 +138,7 @@ impl<'a> defmt::Format for Prescaler { | |||
| 138 | /// Number of samples used for averaging. | 138 | /// Number of samples used for averaging. |
| 139 | /// TODO: Implement hardware averaging setting. | 139 | /// TODO: Implement hardware averaging setting. |
| 140 | #[allow(unused)] | 140 | #[allow(unused)] |
| 141 | #[derive(Copy, Clone)] | ||
| 141 | pub enum Averaging { | 142 | pub enum Averaging { |
| 142 | Disabled, | 143 | Disabled, |
| 143 | Samples2, | 144 | Samples2, |
diff --git a/embassy-stm32/src/adc/f3_v1_1.rs b/embassy-stm32/src/adc/f3_v1_1.rs index 944e971bb..84613078c 100644 --- a/embassy-stm32/src/adc/f3_v1_1.rs +++ b/embassy-stm32/src/adc/f3_v1_1.rs | |||
| @@ -17,6 +17,7 @@ pub const VDDA_CALIB_MV: u32 = 3300; | |||
| 17 | pub const ADC_MAX: u32 = (1 << 12) - 1; | 17 | pub const ADC_MAX: u32 = (1 << 12) - 1; |
| 18 | pub const VREF_INT: u32 = 1230; | 18 | pub const VREF_INT: u32 = 1230; |
| 19 | 19 | ||
| 20 | #[derive(Copy, Clone)] | ||
| 20 | pub enum AdcPowerMode { | 21 | pub enum AdcPowerMode { |
| 21 | AlwaysOn, | 22 | AlwaysOn, |
| 22 | DelayOff, | 23 | DelayOff, |
| @@ -24,6 +25,7 @@ pub enum AdcPowerMode { | |||
| 24 | DelayIdleOff, | 25 | DelayIdleOff, |
| 25 | } | 26 | } |
| 26 | 27 | ||
| 28 | #[derive(Copy, Clone)] | ||
| 27 | pub enum Prescaler { | 29 | pub enum Prescaler { |
| 28 | Div1, | 30 | Div1, |
| 29 | Div2, | 31 | Div2, |
diff --git a/embassy-stm32/src/adc/v4.rs b/embassy-stm32/src/adc/v4.rs index 39e0d51b9..b0871019a 100644 --- a/embassy-stm32/src/adc/v4.rs +++ b/embassy-stm32/src/adc/v4.rs | |||
| @@ -142,6 +142,7 @@ impl Prescaler { | |||
| 142 | } | 142 | } |
| 143 | 143 | ||
| 144 | /// Number of samples used for averaging. | 144 | /// Number of samples used for averaging. |
| 145 | #[derive(Copy, Clone)] | ||
| 145 | pub enum Averaging { | 146 | pub enum Averaging { |
| 146 | Disabled, | 147 | Disabled, |
| 147 | Samples2, | 148 | Samples2, |
