mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
drivers/sx127x: let sx127x driver manage spi pins GPIO modes
This commit is contained in:
parent
cb25ed7b05
commit
340c8e8236
@ -489,6 +489,7 @@ ifneq (,$(filter sx127%,$(USEMODULE)))
|
||||
FEATURES_REQUIRED += periph_gpio
|
||||
FEATURES_REQUIRED += periph_gpio_irq
|
||||
FEATURES_REQUIRED += periph_spi
|
||||
FEATURES_OPTIONAL += periph_spi_gpio_mode
|
||||
USEMODULE += iolist
|
||||
USEMODULE += xtimer
|
||||
USEMODULE += sx127x
|
||||
|
@ -344,6 +344,15 @@ static int _init_spi(sx127x_t *dev)
|
||||
/* Setup SPI for SX127X */
|
||||
res = spi_init_cs(dev->params.spi, dev->params.nss_pin);
|
||||
|
||||
#ifdef MODULE_PERIPH_SPI_GPIO_MODE
|
||||
spi_gpio_mode_t gpio_modes = {
|
||||
.mosi = (GPIO_OUT | SX127X_DIO_PULL_MODE),
|
||||
.miso = (SX127X_DIO_PULL_MODE),
|
||||
.sclk = (GPIO_OUT | SX127X_DIO_PULL_MODE),
|
||||
};
|
||||
res += spi_init_with_gpio_mode(dev->params.spi, gpio_modes);
|
||||
#endif
|
||||
|
||||
if (res != SPI_OK) {
|
||||
DEBUG("[sx127x] error: failed to initialize SPI_%i device (code %i)\n",
|
||||
dev->params.spi, res);
|
||||
|
Loading…
Reference in New Issue
Block a user