stm32/dac: set pin mode to analog (ref #334)

This commit is contained in:
Adam Greig 2023-07-22 12:47:17 +01:00
parent c83552eadc
commit e5b4641f9e
No known key found for this signature in database
GPG Key ID: 8B3FE5477B1DD9A0

View File

@ -213,8 +213,9 @@ impl<'d, T: Instance, Tx> DacCh1<'d, T, Tx> {
pub fn new( pub fn new(
peri: impl Peripheral<P = T> + 'd, peri: impl Peripheral<P = T> + 'd,
dma: impl Peripheral<P = Tx> + 'd, dma: impl Peripheral<P = Tx> + 'd,
_pin: impl Peripheral<P = impl DacPin<T, 1>> + 'd, pin: impl Peripheral<P = impl DacPin<T, 1>> + crate::gpio::sealed::Pin + 'd,
) -> Self { ) -> Self {
pin.set_as_analog();
into_ref!(peri, dma); into_ref!(peri, dma);
T::enable(); T::enable();
T::reset(); T::reset();
@ -324,8 +325,9 @@ impl<'d, T: Instance, Tx> DacCh2<'d, T, Tx> {
pub fn new( pub fn new(
_peri: impl Peripheral<P = T> + 'd, _peri: impl Peripheral<P = T> + 'd,
dma: impl Peripheral<P = Tx> + 'd, dma: impl Peripheral<P = Tx> + 'd,
_pin: impl Peripheral<P = impl DacPin<T, 2>> + 'd, pin: impl Peripheral<P = impl DacPin<T, 2>> + crate::gpio::sealed::Pin + 'd,
) -> Self { ) -> Self {
pin.set_as_analog();
into_ref!(_peri, dma); into_ref!(_peri, dma);
T::enable(); T::enable();
T::reset(); T::reset();
@ -439,9 +441,11 @@ impl<'d, T: Instance, TxCh1, TxCh2> Dac<'d, T, TxCh1, TxCh2> {
peri: impl Peripheral<P = T> + 'd, peri: impl Peripheral<P = T> + 'd,
dma_ch1: impl Peripheral<P = TxCh1> + 'd, dma_ch1: impl Peripheral<P = TxCh1> + 'd,
dma_ch2: impl Peripheral<P = TxCh2> + 'd, dma_ch2: impl Peripheral<P = TxCh2> + 'd,
_pin_ch1: impl Peripheral<P = impl DacPin<T, 1>> + 'd, pin_ch1: impl Peripheral<P = impl DacPin<T, 1>> + crate::gpio::sealed::Pin + 'd,
_pin_ch2: impl Peripheral<P = impl DacPin<T, 2>> + 'd, pin_ch2: impl Peripheral<P = impl DacPin<T, 2>> + crate::gpio::sealed::Pin + 'd,
) -> Self { ) -> Self {
pin_ch1.set_as_analog();
pin_ch2.set_as_analog();
into_ref!(peri, dma_ch1, dma_ch2); into_ref!(peri, dma_ch1, dma_ch2);
T::enable(); T::enable();
T::reset(); T::reset();