Skip to content

Commit 8e8f14e

Browse files
andysannashif
authored andcommitted
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: Andreas Sandberg <[email protected]>
1 parent 33d473d commit 8e8f14e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/lora/sx1276.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ LOG_MODULE_REGISTER(sx1276);
2323
#define GPIO_RESET_PIN DT_INST_GPIO_PIN(0, reset_gpios)
2424
#define GPIO_RESET_FLAGS DT_INST_GPIO_FLAGS(0, reset_gpios)
2525
#define GPIO_CS_PIN DT_INST_SPI_DEV_CS_GPIOS_PIN(0)
26+
#define GPIO_CS_FLAGS DT_INST_SPI_DEV_CS_GPIOS_FLAGS(0)
2627

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

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

553+
spi_cs.gpio_pin = GPIO_CS_PIN;
554+
spi_cs.gpio_dt_flags = GPIO_CS_FLAGS;
555+
spi_cs.delay = 0U;
556+
553557
dev_data.spi_cfg.cs = &spi_cs;
554558
#endif
555559

0 commit comments

Comments
 (0)