diff --git a/drivers/soft_spi/include/soft_spi_params.h b/drivers/soft_spi/include/soft_spi_params.h index 78a2425766..f17f8be93f 100644 --- a/drivers/soft_spi/include/soft_spi_params.h +++ b/drivers/soft_spi/include/soft_spi_params.h @@ -48,6 +48,11 @@ static soft_spi_conf_t soft_spi_config[] = { SOFT_SPI_PARAMS, }; +/** + * @brief Number of software SPI buses + */ +#define SOFT_SPI_NUMOF ARRAY_SIZE(soft_spi_config) + #ifdef __cplusplus } #endif diff --git a/drivers/soft_spi/soft_spi.c b/drivers/soft_spi/soft_spi.c index 8786b4bcdb..6a7cff9698 100644 --- a/drivers/soft_spi/soft_spi.c +++ b/drivers/soft_spi/soft_spi.c @@ -34,7 +34,7 @@ /** * @brief Allocate one lock per SPI device */ -static mutex_t locks[sizeof soft_spi_config]; +static mutex_t locks[SOFT_SPI_NUMOF]; static inline bool soft_spi_bus_is_valid(soft_spi_t bus) {