Compare commits

...
Sign in to create a new pull request.
Author SHA1 Message Date
copilot-swe-agent[bot]
a9cab9a9a4 Fix formatting for preprocessor directives
Co-authored-by: tzarc <2985843+tzarc@users.noreply.github.com>
2025-07-04 00:38:25 +00:00
copilot-swe-agent[bot]
2cb308f236 Fix SPI bus lock issue in spi_start_extended when using mutual exclusion
Co-authored-by: tzarc <2985843+tzarc@users.noreply.github.com>
2025-07-04 00:17:40 +00:00
copilot-swe-agent[bot]
5e8146c2e9 Initial plan 2025-07-04 00:11:08 +00:00

View file

@ -130,10 +130,16 @@ bool spi_start_extended(spi_start_config_t *start_config) {
#endif // (SPI_USE_MUTUAL_EXCLUSION == TRUE)
if (spiStarted) {
#if (SPI_USE_MUTUAL_EXCLUSION == TRUE)
spiReleaseBus(&SPI_DRIVER);
#endif // (SPI_USE_MUTUAL_EXCLUSION == TRUE)
return false;
}
#if SPI_SELECT_MODE != SPI_SELECT_MODE_NONE
if (start_config->slave_pin == NO_PIN) {
# if (SPI_USE_MUTUAL_EXCLUSION == TRUE)
spiReleaseBus(&SPI_DRIVER);
# endif // (SPI_USE_MUTUAL_EXCLUSION == TRUE)
return false;
}
#endif
@ -146,10 +152,16 @@ bool spi_start_extended(spi_start_config_t *start_config) {
# if defined(AT32F415)
if (roundedDivisor < 2 || roundedDivisor > 1024) {
# if (SPI_USE_MUTUAL_EXCLUSION == TRUE)
spiReleaseBus(&SPI_DRIVER);
# endif // (SPI_USE_MUTUAL_EXCLUSION == TRUE)
return false;
}
# else
if (roundedDivisor < 2 || roundedDivisor > 256) {
# if (SPI_USE_MUTUAL_EXCLUSION == TRUE)
spiReleaseBus(&SPI_DRIVER);
# endif // (SPI_USE_MUTUAL_EXCLUSION == TRUE)
return false;
}
# endif
@ -234,6 +246,9 @@ bool spi_start_extended(spi_start_config_t *start_config) {
}
if (start_config->divisor < 1) {
# if (SPI_USE_MUTUAL_EXCLUSION == TRUE)
spiReleaseBus(&SPI_DRIVER);
# endif // (SPI_USE_MUTUAL_EXCLUSION == TRUE)
return false;
}