Merge pull request #2055 from kwagyeman/kwabena/fix_cs_issue

ports: Don't deinit the SSEL pin on stm32 and mimxrt.
This commit is contained in:
Ibrahim Abdelkader 2023-12-26 19:22:28 +02:00 committed by GitHub
commit 61501d2580
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -19,6 +19,7 @@
#include "irq.h"
#include "omv_common.h"
#include "dma_utils.h"
#include "omv_gpio.h"
#include "omv_spi.h"
// If an SPI handle is already defined in MicroPython, reuse that handle to allow
@ -433,6 +434,8 @@ int omv_spi_deinit(omv_spi_t *spi) {
}
HAL_SPI_DeInit(spi->descr);
HAL_NVIC_DisableIRQ(spi->irqn);
// Deinit the CS pin here versus in HAL_SPI_MspDeInit which is shared code.
omv_gpio_deinit(spi->cs);
}
return 0;
}

View File

@ -520,7 +520,9 @@ void HAL_SPI_MspDeInit(SPI_HandleTypeDef *hspi) {
omv_gpio_deinit(spi_pins.sclk_pin);
omv_gpio_deinit(spi_pins.miso_pin);
omv_gpio_deinit(spi_pins.mosi_pin);
omv_gpio_deinit(spi_pins.ssel_pin);
// Deinited by omv_spi.c so as to not deinit the pin when HAL_SPI_MspDeInit is called
// from deiniting the SPI bus from the machine or pyb module.
// omv_gpio_deinit(spi_pins.ssel_pin);
}
#if defined(AUDIO_SAI)