diff --git a/cpu/stm32/periph/spi.c b/cpu/stm32/periph/spi.c index cd8fcc82a8..af8e498ea6 100644 --- a/cpu/stm32/periph/spi.c +++ b/cpu/stm32/periph/spi.c @@ -192,7 +192,7 @@ int spi_init_cs(spi_t bus, spi_cs_t cs) } #ifdef MODULE_PERIPH_SPI_GPIO_MODE -int spi_init_with_gpio_mode(spi_t bus, spi_gpio_mode_t mode) +int spi_init_with_gpio_mode(spi_t bus, const spi_gpio_mode_t* mode) { assert(bus < SPI_NUMOF); @@ -203,17 +203,17 @@ int spi_init_with_gpio_mode(spi_t bus, spi_gpio_mode_t mode) return ret; #else if (gpio_is_valid(spi_config[bus].mosi_pin)) { - ret += gpio_init(spi_config[bus].mosi_pin, mode.mosi); + ret += gpio_init(spi_config[bus].mosi_pin, mode->mosi); gpio_init_af(spi_config[bus].mosi_pin, spi_config[bus].mosi_af); } if (gpio_is_valid(spi_config[bus].miso_pin)) { - ret += gpio_init(spi_config[bus].miso_pin, mode.miso); + ret += gpio_init(spi_config[bus].miso_pin, mode->miso); gpio_init_af(spi_config[bus].miso_pin, spi_config[bus].miso_af); } if (gpio_is_valid(spi_config[bus].sclk_pin)) { - ret += gpio_init(spi_config[bus].sclk_pin, mode.sclk); + ret += gpio_init(spi_config[bus].sclk_pin, mode->sclk); gpio_init_af(spi_config[bus].sclk_pin, spi_config[bus].sclk_af); } return ret; diff --git a/drivers/include/periph/spi.h b/drivers/include/periph/spi.h index a30e96376d..0cd4bd6c14 100644 --- a/drivers/include/periph/spi.h +++ b/drivers/include/periph/spi.h @@ -324,12 +324,13 @@ typedef struct { * @brief Initialize MOSI/MISO/SCLK pins with adapted GPIO modes * * @param[in] bus SPI device that is used with the given CS line - * @param[in] mode a struct containing the 3 modes to use on each pin + * @param[in] mode a pointer to a truct containing the 3 modes to use on + * each pin * * @retval 0 success * @retval <0 error */ -int spi_init_with_gpio_mode(spi_t bus, spi_gpio_mode_t mode); +int spi_init_with_gpio_mode(spi_t bus, const spi_gpio_mode_t* mode); #endif /** diff --git a/drivers/sx127x/sx127x.c b/drivers/sx127x/sx127x.c index edeb406b5f..3d8e5b06e7 100644 --- a/drivers/sx127x/sx127x.c +++ b/drivers/sx127x/sx127x.c @@ -350,7 +350,7 @@ static int _init_spi(sx127x_t *dev) .miso = (SX127X_DIO_PULL_MODE), .sclk = (GPIO_OUT | SX127X_DIO_PULL_MODE), }; - res += spi_init_with_gpio_mode(dev->params.spi, gpio_modes); + res += spi_init_with_gpio_mode(dev->params.spi, &gpio_modes); #endif if (res != SPI_OK) {