diff options
| author | Grant Miller <[email protected]> | 2022-10-26 17:33:32 -0500 |
|---|---|---|
| committer | Grant Miller <[email protected]> | 2022-10-26 17:35:06 -0500 |
| commit | f363f6ce92879a9cb21f058fa308b05256e7c482 (patch) | |
| tree | cbb40f84a303bbe1d7f28d195af8405a43a52964 | |
| parent | 6bf24b4d1ab1df57e410de6d6c8f413a2c44d5af (diff) | |
Refactor: Don't return references to pointers
| -rw-r--r-- | embassy-stm32/src/adc/mod.rs | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/embassy-stm32/src/adc/mod.rs b/embassy-stm32/src/adc/mod.rs index 08989649b..439fe0ba6 100644 --- a/embassy-stm32/src/adc/mod.rs +++ b/embassy-stm32/src/adc/mod.rs | |||
| @@ -24,9 +24,9 @@ use crate::peripherals; | |||
| 24 | 24 | ||
| 25 | pub(crate) mod sealed { | 25 | pub(crate) mod sealed { |
| 26 | pub trait Instance { | 26 | pub trait Instance { |
| 27 | fn regs() -> &'static crate::pac::adc::Adc; | 27 | fn regs() -> crate::pac::adc::Adc; |
| 28 | #[cfg(all(not(adc_f1), not(adc_v1)))] | 28 | #[cfg(all(not(adc_f1), not(adc_v1)))] |
| 29 | fn common_regs() -> &'static crate::pac::adccommon::AdcCommon; | 29 | fn common_regs() -> crate::pac::adccommon::AdcCommon; |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | pub trait AdcPin<T: Instance> { | 32 | pub trait AdcPin<T: Instance> { |
| @@ -50,14 +50,14 @@ pub trait InternalChannel<T>: sealed::InternalChannel<T> {} | |||
| 50 | foreach_peripheral!( | 50 | foreach_peripheral!( |
| 51 | (adc, $inst:ident) => { | 51 | (adc, $inst:ident) => { |
| 52 | impl crate::adc::sealed::Instance for peripherals::$inst { | 52 | impl crate::adc::sealed::Instance for peripherals::$inst { |
| 53 | fn regs() -> &'static crate::pac::adc::Adc { | 53 | fn regs() -> crate::pac::adc::Adc { |
| 54 | &crate::pac::$inst | 54 | crate::pac::$inst |
| 55 | } | 55 | } |
| 56 | #[cfg(all(not(adc_f1), not(adc_v1)))] | 56 | #[cfg(all(not(adc_f1), not(adc_v1)))] |
| 57 | fn common_regs() -> &'static crate::pac::adccommon::AdcCommon { | 57 | fn common_regs() -> crate::pac::adccommon::AdcCommon { |
| 58 | foreach_peripheral!{ | 58 | foreach_peripheral!{ |
| 59 | (adccommon, $common_inst:ident) => { | 59 | (adccommon, $common_inst:ident) => { |
| 60 | return &crate::pac::$common_inst | 60 | return crate::pac::$common_inst |
| 61 | }; | 61 | }; |
| 62 | } | 62 | } |
| 63 | } | 63 | } |
| @@ -71,14 +71,14 @@ foreach_peripheral!( | |||
| 71 | foreach_peripheral!( | 71 | foreach_peripheral!( |
| 72 | (adc, ADC3) => { | 72 | (adc, ADC3) => { |
| 73 | impl crate::adc::sealed::Instance for peripherals::ADC3 { | 73 | impl crate::adc::sealed::Instance for peripherals::ADC3 { |
| 74 | fn regs() -> &'static crate::pac::adc::Adc { | 74 | fn regs() -> crate::pac::adc::Adc { |
| 75 | &crate::pac::ADC3 | 75 | crate::pac::ADC3 |
| 76 | } | 76 | } |
| 77 | #[cfg(all(not(adc_f1), not(adc_v1)))] | 77 | #[cfg(all(not(adc_f1), not(adc_v1)))] |
| 78 | fn common_regs() -> &'static crate::pac::adccommon::AdcCommon { | 78 | fn common_regs() -> crate::pac::adccommon::AdcCommon { |
| 79 | foreach_peripheral!{ | 79 | foreach_peripheral!{ |
| 80 | (adccommon, ADC3_COMMON) => { | 80 | (adccommon, ADC3_COMMON) => { |
| 81 | return &crate::pac::ADC3_COMMON | 81 | return crate::pac::ADC3_COMMON |
| 82 | }; | 82 | }; |
| 83 | } | 83 | } |
| 84 | } | 84 | } |
| @@ -88,14 +88,14 @@ foreach_peripheral!( | |||
| 88 | }; | 88 | }; |
| 89 | (adc, $inst:ident) => { | 89 | (adc, $inst:ident) => { |
| 90 | impl crate::adc::sealed::Instance for peripherals::$inst { | 90 | impl crate::adc::sealed::Instance for peripherals::$inst { |
| 91 | fn regs() -> &'static crate::pac::adc::Adc { | 91 | fn regs() -> crate::pac::adc::Adc { |
| 92 | &crate::pac::$inst | 92 | crate::pac::$inst |
| 93 | } | 93 | } |
| 94 | #[cfg(all(not(adc_f1), not(adc_v1)))] | 94 | #[cfg(all(not(adc_f1), not(adc_v1)))] |
| 95 | fn common_regs() -> &'static crate::pac::adccommon::AdcCommon { | 95 | fn common_regs() -> crate::pac::adccommon::AdcCommon { |
| 96 | foreach_peripheral!{ | 96 | foreach_peripheral!{ |
| 97 | (adccommon, ADC_COMMON) => { | 97 | (adccommon, ADC_COMMON) => { |
| 98 | return &crate::pac::ADC_COMMON | 98 | return crate::pac::ADC_COMMON |
| 99 | }; | 99 | }; |
| 100 | } | 100 | } |
| 101 | } | 101 | } |
