stm32: fix refcounts for usart, spi, and i2c

This commit is contained in:
xoviat
2023-09-04 15:47:33 -05:00
parent 3466c9cfa9
commit 274f63a879
7 changed files with 60 additions and 17 deletions

View File

@ -124,6 +124,8 @@ impl<'d, T: BasicInstance> BufferedUart<'d, T> {
rx_buffer: &'d mut [u8],
config: Config,
) -> BufferedUart<'d, T> {
// UartRx and UartTx have one refcount ea.
T::enable();
T::enable();
T::reset();
@ -143,6 +145,8 @@ impl<'d, T: BasicInstance> BufferedUart<'d, T> {
) -> BufferedUart<'d, T> {
into_ref!(cts, rts);
// UartRx and UartTx have one refcount ea.
T::enable();
T::enable();
T::reset();
@ -169,6 +173,8 @@ impl<'d, T: BasicInstance> BufferedUart<'d, T> {
) -> BufferedUart<'d, T> {
into_ref!(de);
// UartRx and UartTx have one refcount ea.
T::enable();
T::enable();
T::reset();
@ -382,6 +388,8 @@ impl<'d, T: BasicInstance> Drop for BufferedUartRx<'d, T> {
T::Interrupt::disable();
}
}
T::disable();
}
}
@ -397,6 +405,8 @@ impl<'d, T: BasicInstance> Drop for BufferedUartTx<'d, T> {
T::Interrupt::disable();
}
}
T::disable();
}
}