aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Greig <[email protected]>2023-07-22 12:47:17 +0100
committerAdam Greig <[email protected]>2023-07-22 13:19:26 +0100
commite5b4641f9ee1b181a16028b84131083e0247d4d5 (patch)
tree611de3d50ad13f3c51b2d67a9c0a4e732d778608
parentc83552eadcf7546acf8bf4de47d7d9243ffe56d0 (diff)
stm32/dac: set pin mode to analog (ref #334)
-rw-r--r--embassy-stm32/src/dac/mod.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/embassy-stm32/src/dac/mod.rs b/embassy-stm32/src/dac/mod.rs
index 31a2d8863..3dee242ef 100644
--- a/embassy-stm32/src/dac/mod.rs
+++ b/embassy-stm32/src/dac/mod.rs
@@ -213,8 +213,9 @@ impl<'d, T: Instance, Tx> DacCh1<'d, T, Tx> {
213 pub fn new( 213 pub fn new(
214 peri: impl Peripheral<P = T> + 'd, 214 peri: impl Peripheral<P = T> + 'd,
215 dma: impl Peripheral<P = Tx> + 'd, 215 dma: impl Peripheral<P = Tx> + 'd,
216 _pin: impl Peripheral<P = impl DacPin<T, 1>> + 'd, 216 pin: impl Peripheral<P = impl DacPin<T, 1>> + crate::gpio::sealed::Pin + 'd,
217 ) -> Self { 217 ) -> Self {
218 pin.set_as_analog();
218 into_ref!(peri, dma); 219 into_ref!(peri, dma);
219 T::enable(); 220 T::enable();
220 T::reset(); 221 T::reset();
@@ -324,8 +325,9 @@ impl<'d, T: Instance, Tx> DacCh2<'d, T, Tx> {
324 pub fn new( 325 pub fn new(
325 _peri: impl Peripheral<P = T> + 'd, 326 _peri: impl Peripheral<P = T> + 'd,
326 dma: impl Peripheral<P = Tx> + 'd, 327 dma: impl Peripheral<P = Tx> + 'd,
327 _pin: impl Peripheral<P = impl DacPin<T, 2>> + 'd, 328 pin: impl Peripheral<P = impl DacPin<T, 2>> + crate::gpio::sealed::Pin + 'd,
328 ) -> Self { 329 ) -> Self {
330 pin.set_as_analog();
329 into_ref!(_peri, dma); 331 into_ref!(_peri, dma);
330 T::enable(); 332 T::enable();
331 T::reset(); 333 T::reset();
@@ -439,9 +441,11 @@ impl<'d, T: Instance, TxCh1, TxCh2> Dac<'d, T, TxCh1, TxCh2> {
439 peri: impl Peripheral<P = T> + 'd, 441 peri: impl Peripheral<P = T> + 'd,
440 dma_ch1: impl Peripheral<P = TxCh1> + 'd, 442 dma_ch1: impl Peripheral<P = TxCh1> + 'd,
441 dma_ch2: impl Peripheral<P = TxCh2> + 'd, 443 dma_ch2: impl Peripheral<P = TxCh2> + 'd,
442 _pin_ch1: impl Peripheral<P = impl DacPin<T, 1>> + 'd, 444 pin_ch1: impl Peripheral<P = impl DacPin<T, 1>> + crate::gpio::sealed::Pin + 'd,
443 _pin_ch2: impl Peripheral<P = impl DacPin<T, 2>> + 'd, 445 pin_ch2: impl Peripheral<P = impl DacPin<T, 2>> + crate::gpio::sealed::Pin + 'd,
444 ) -> Self { 446 ) -> Self {
447 pin_ch1.set_as_analog();
448 pin_ch2.set_as_analog();
445 into_ref!(peri, dma_ch1, dma_ch2); 449 into_ref!(peri, dma_ch1, dma_ch2);
446 T::enable(); 450 T::enable();
447 T::reset(); 451 T::reset();