mirror of
https://github.com/micropython/micropython.git
synced 2025-07-21 13:01:10 +02:00
stm32/spi: Fail spi_init if pins can't be configured.
Follows the UART and I2C drivers. Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
@@ -481,7 +481,10 @@ int spi_init(const spi_t *self, bool enable_nss_pin) {
|
||||
if (pins[i] == NULL) {
|
||||
continue;
|
||||
}
|
||||
mp_hal_pin_config_alt(pins[i], mode, pull, AF_FN_SPI, (self - &spi_obj[0]) + 1);
|
||||
if (!mp_hal_pin_config_alt(pins[i], mode, pull, AF_FN_SPI, (self - &spi_obj[0]) + 1)) {
|
||||
// Pin does not have SPI alternate function.
|
||||
return -MP_EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
// init the SPI device
|
||||
|
Reference in New Issue
Block a user