aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xci.sh2
-rw-r--r--embassy-stm32/Cargo.toml4
-rw-r--r--embassy-stm32/src/adc/f3.rs3
-rw-r--r--embassy-stm32/src/adc/mod.rs38
-rw-r--r--embassy-stm32/src/adc/v2.rs2
5 files changed, 42 insertions, 7 deletions
diff --git a/ci.sh b/ci.sh
index db00c406c..ba684e449 100755
--- a/ci.sh
+++ b/ci.sh
@@ -180,4 +180,6 @@ if [[ -z "${TELEPROBE_TOKEN-}" ]]; then
180 exit 180 exit
181fi 181fi
182 182
183rm out/tests/stm32wb55rg/wpan_ble
184
183teleprobe client run -r out/tests 185teleprobe client run -r out/tests
diff --git a/embassy-stm32/Cargo.toml b/embassy-stm32/Cargo.toml
index 4ba47764d..948ed3ca4 100644
--- a/embassy-stm32/Cargo.toml
+++ b/embassy-stm32/Cargo.toml
@@ -58,7 +58,7 @@ sdio-host = "0.5.0"
58embedded-sdmmc = { git = "https://github.com/embassy-rs/embedded-sdmmc-rs", rev = "a4f293d3a6f72158385f79c98634cb8a14d0d2fc", optional = true } 58embedded-sdmmc = { git = "https://github.com/embassy-rs/embedded-sdmmc-rs", rev = "a4f293d3a6f72158385f79c98634cb8a14d0d2fc", optional = true }
59critical-section = "1.1" 59critical-section = "1.1"
60atomic-polyfill = "1.0.1" 60atomic-polyfill = "1.0.1"
61stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-e667107cf81934383ec5744f49b2cda0599ec749" } 61stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-4e6a74f69c4bc5d2d4872ba50d805e75bfe55cad" }
62vcell = "0.1.3" 62vcell = "0.1.3"
63bxcan = "0.7.0" 63bxcan = "0.7.0"
64nb = "1.0.0" 64nb = "1.0.0"
@@ -77,7 +77,7 @@ critical-section = { version = "1.1", features = ["std"] }
77[build-dependencies] 77[build-dependencies]
78proc-macro2 = "1.0.36" 78proc-macro2 = "1.0.36"
79quote = "1.0.15" 79quote = "1.0.15"
80stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-e667107cf81934383ec5744f49b2cda0599ec749", default-features = false, features = ["metadata"]} 80stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-4e6a74f69c4bc5d2d4872ba50d805e75bfe55cad", default-features = false, features = ["metadata"]}
81 81
82[features] 82[features]
83default = ["rt"] 83default = ["rt"]
diff --git a/embassy-stm32/src/adc/f3.rs b/embassy-stm32/src/adc/f3.rs
index 8f16c6abf..c7b876fe1 100644
--- a/embassy-stm32/src/adc/f3.rs
+++ b/embassy-stm32/src/adc/f3.rs
@@ -49,6 +49,9 @@ impl<'d, T: Instance> Adc<'d, T> {
49 49
50 while T::regs().cr().read().adcal() {} 50 while T::regs().cr().read().adcal() {}
51 51
52 // Wait more than 4 clock cycles after adcal is cleared (RM0364 p. 223)
53 delay.delay_us(6 * Self::freq().0 / 1_000_000);
54
52 // Enable the adc 55 // Enable the adc
53 T::regs().cr().modify(|w| w.set_aden(true)); 56 T::regs().cr().modify(|w| w.set_aden(true));
54 57
diff --git a/embassy-stm32/src/adc/mod.rs b/embassy-stm32/src/adc/mod.rs
index 013debca8..d1cfd8fbd 100644
--- a/embassy-stm32/src/adc/mod.rs
+++ b/embassy-stm32/src/adc/mod.rs
@@ -80,17 +80,21 @@ foreach_peripheral!(
80#[cfg(any(stm32h7, adc_f3, adc_v4))] 80#[cfg(any(stm32h7, adc_f3, adc_v4))]
81foreach_peripheral!( 81foreach_peripheral!(
82 (adc, ADC3) => { 82 (adc, ADC3) => {
83 #[cfg(not(any(stm32g4x1, stm32g4x2, stm32g4x3, stm32g4x4)))]
84 impl crate::adc::sealed::Instance for peripherals::ADC3 { 83 impl crate::adc::sealed::Instance for peripherals::ADC3 {
85 fn regs() -> crate::pac::adc::Adc { 84 fn regs() -> crate::pac::adc::Adc {
86 crate::pac::ADC3 85 crate::pac::ADC3
87 } 86 }
88 #[cfg(all(not(adc_f1), not(adc_v1)))] 87 #[cfg(all(not(adc_f1), not(adc_v1)))]
88 #[allow(unreachable_code)]
89 fn common_regs() -> crate::pac::adccommon::AdcCommon { 89 fn common_regs() -> crate::pac::adccommon::AdcCommon {
90 foreach_peripheral!{ 90 foreach_peripheral!{
91 (adccommon, ADC3_COMMON) => { 91 (adccommon, ADC3_COMMON) => {
92 return crate::pac::ADC3_COMMON 92 return crate::pac::ADC3_COMMON
93 }; 93 };
94 // Fall back to ADC_COMMON if ADC3_COMMON does not exist
95 (adccommon, ADC_COMMON) => {
96 return crate::pac::ADC_COMMON
97 };
94 } 98 }
95 } 99 }
96 100
@@ -100,21 +104,24 @@ foreach_peripheral!(
100 } 104 }
101 } 105 }
102 106
103 #[cfg(not(any(stm32g4x1, stm32g4x2, stm32g4x3, stm32g4x4)))]
104 impl crate::adc::Instance for peripherals::ADC3 {} 107 impl crate::adc::Instance for peripherals::ADC3 {}
105 }; 108 };
106 (adc, ADC4) => { 109 (adc, ADC4) => {
107 #[cfg(not(any(stm32g4x1, stm32g4x2, stm32g4x3, stm32g4x4)))]
108 impl crate::adc::sealed::Instance for peripherals::ADC4 { 110 impl crate::adc::sealed::Instance for peripherals::ADC4 {
109 fn regs() -> crate::pac::adc::Adc { 111 fn regs() -> crate::pac::adc::Adc {
110 crate::pac::ADC4 112 crate::pac::ADC4
111 } 113 }
112 #[cfg(not(any(adc_f1, adc_v1)))] 114 #[cfg(not(any(adc_f1, adc_v1)))]
115 #[allow(unreachable_code)]
113 fn common_regs() -> crate::pac::adccommon::AdcCommon { 116 fn common_regs() -> crate::pac::adccommon::AdcCommon {
114 foreach_peripheral!{ 117 foreach_peripheral!{
115 (adccommon, ADC3_COMMON) => { 118 (adccommon, ADC3_COMMON) => {
116 return crate::pac::ADC3_COMMON 119 return crate::pac::ADC3_COMMON
117 }; 120 };
121 // Fall back to ADC_COMMON if ADC3_COMMON does not exist
122 (adccommon, ADC_COMMON) => {
123 return crate::pac::ADC_COMMON
124 };
118 } 125 }
119 } 126 }
120 127
@@ -124,11 +131,34 @@ foreach_peripheral!(
124 } 131 }
125 } 132 }
126 133
127 #[cfg(not(any(stm32g4x1, stm32g4x2, stm32g4x3, stm32g4x4)))]
128 impl crate::adc::Instance for peripherals::ADC4 {} 134 impl crate::adc::Instance for peripherals::ADC4 {}
129 }; 135 };
130 (adc, ADC5) => { 136 (adc, ADC5) => {
137 impl crate::adc::sealed::Instance for peripherals::ADC5 {
138 fn regs() -> crate::pac::adc::Adc {
139 crate::pac::ADC5
140 }
141 #[cfg(not(any(adc_f1, adc_v1)))]
142 #[allow(unreachable_code)]
143 fn common_regs() -> crate::pac::adccommon::AdcCommon {
144 foreach_peripheral!{
145 (adccommon, ADC3_COMMON) => {
146 return crate::pac::ADC3_COMMON
147 };
148 // Fall back to ADC_COMMON if ADC3_COMMON does not exist
149 (adccommon, ADC_COMMON) => {
150 return crate::pac::ADC_COMMON
151 };
152 }
153 }
154
155 #[cfg(adc_f3)]
156 fn frequency() -> crate::time::Hertz {
157 unsafe { crate::rcc::get_freqs() }.adc34.unwrap()
158 }
159 }
131 160
161 impl crate::adc::Instance for peripherals::ADC5 {}
132 }; 162 };
133 (adc, $inst:ident) => { 163 (adc, $inst:ident) => {
134 impl crate::adc::sealed::Instance for peripherals::$inst { 164 impl crate::adc::sealed::Instance for peripherals::$inst {
diff --git a/embassy-stm32/src/adc/v2.rs b/embassy-stm32/src/adc/v2.rs
index 9a7acea53..4fbd1cfa2 100644
--- a/embassy-stm32/src/adc/v2.rs
+++ b/embassy-stm32/src/adc/v2.rs
@@ -102,7 +102,7 @@ where
102 let presc = Prescaler::from_pclk2(T::frequency()); 102 let presc = Prescaler::from_pclk2(T::frequency());
103 T::common_regs().ccr().modify(|w| w.set_adcpre(presc.adcpre())); 103 T::common_regs().ccr().modify(|w| w.set_adcpre(presc.adcpre()));
104 T::regs().cr2().modify(|reg| { 104 T::regs().cr2().modify(|reg| {
105 reg.set_adon(crate::pac::adc::vals::Adon::ENABLED); 105 reg.set_adon(true);
106 }); 106 });
107 107
108 delay.delay_us(ADC_POWERUP_TIME_US); 108 delay.delay_us(ADC_POWERUP_TIME_US);