Commit 8e8f14e3 authored by Andreas Sandberg's avatar Andreas Sandberg Committed by Anas Nashif
Browse files

drivers: lora: Add chip select flags to SX1276 driver



Add chip select flags from the device tree to the spi_cs_control
instance.

Signed-off-by: default avatarAndreas Sandberg <andreas@sandberg.pp.se>
parent 33d473d2
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ LOG_MODULE_REGISTER(sx1276);
#define GPIO_RESET_PIN		DT_INST_GPIO_PIN(0, reset_gpios)
#define GPIO_RESET_FLAGS	DT_INST_GPIO_FLAGS(0, reset_gpios)
#define GPIO_CS_PIN		DT_INST_SPI_DEV_CS_GPIOS_PIN(0)
#define GPIO_CS_FLAGS		DT_INST_SPI_DEV_CS_GPIOS_FLAGS(0)

#define GPIO_ANTENNA_ENABLE_PIN				\
	DT_INST_GPIO_PIN(0, antenna_enable_gpios)
@@ -541,7 +542,6 @@ static int sx1276_lora_init(struct device *dev)
	dev_data.spi_cfg.slave = DT_INST_REG_ADDR(0);

#if DT_INST_SPI_DEV_HAS_CS_GPIOS(0)
	spi_cs.gpio_pin = GPIO_CS_PIN,
	spi_cs.gpio_dev = device_get_binding(
			DT_INST_SPI_DEV_CS_GPIOS_LABEL(0));
	if (!spi_cs.gpio_dev) {
@@ -550,6 +550,10 @@ static int sx1276_lora_init(struct device *dev)
		return -EIO;
	}

	spi_cs.gpio_pin = GPIO_CS_PIN;
	spi_cs.gpio_dt_flags = GPIO_CS_FLAGS;
	spi_cs.delay = 0U;

	dev_data.spi_cfg.cs = &spi_cs;
#endif