Skip to content

Commit 4d82d77

Browse files
committed
stm32/spi: Deinit SPI DMA handles in spi_deinit.
1 parent fb6ad01 commit 4d82d77

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

ports/stm32/spi.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,12 @@ int spi_init(const spi_t *self, bool enable_nss_pin) {
510510
}
511511

512512
void spi_deinit(const spi_t *spi_obj) {
513+
if (spi_obj->rx_dma_descr != NULL) {
514+
dma_deinit(spi_obj->rx_dma_descr);
515+
}
516+
if (spi_obj->tx_dma_descr != NULL) {
517+
dma_deinit(spi_obj->tx_dma_descr);
518+
}
513519
SPI_HandleTypeDef *spi = spi_obj->spi;
514520
HAL_SPI_DeInit(spi);
515521
if (0) {

0 commit comments

Comments
 (0)