From ba330ec765bc0df8e4c0c28a79425cb6d6e0b001 Mon Sep 17 00:00:00 2001 From: Andreas Sandberg Date: Tue, 5 May 2020 21:50:44 +0100 Subject: [PATCH] drivers: lora: Prepare Kconfig for additional radios Add a new configuration option, LORA_SX12XX, that is shared for all of the LoRaMAC-node-based radio drivers. By default, the appropriate driver for the LoRa radio in the device tree is included is included in the build. Signed-off-by: Andreas Sandberg --- drivers/lora/Kconfig | 2 +- drivers/lora/Kconfig.sx1276 | 14 ----------- drivers/lora/Kconfig.sx12xx | 35 +++++++++++++++++++++++++++ samples/drivers/lora/receive/prj.conf | 2 +- samples/drivers/lora/send/prj.conf | 2 +- 5 files changed, 38 insertions(+), 17 deletions(-) delete mode 100644 drivers/lora/Kconfig.sx1276 create mode 100644 drivers/lora/Kconfig.sx12xx diff --git a/drivers/lora/Kconfig b/drivers/lora/Kconfig index f99e7772ca3..dfb9d63254d 100644 --- a/drivers/lora/Kconfig +++ b/drivers/lora/Kconfig @@ -31,6 +31,6 @@ config LORA_INIT_PRIORITY help System initialization priority for LoRa drivers. -source "drivers/lora/Kconfig.sx1276" +source "drivers/lora/Kconfig.sx12xx" endif # LORA diff --git a/drivers/lora/Kconfig.sx1276 b/drivers/lora/Kconfig.sx1276 deleted file mode 100644 index 0da357c36a7..00000000000 --- a/drivers/lora/Kconfig.sx1276 +++ /dev/null @@ -1,14 +0,0 @@ -# -# Copyright (c) 2019 Manivannan Sadhasivam -# -# SPDX-License-Identifier: Apache-2.0 -# - -config LORA_SX1276 - bool "Semtech SX1276 driver" - select HAS_SEMTECH_RADIO_DRIVERS - select HAS_SEMTECH_LORAMAC - select HAS_SEMTECH_SX1276 - depends on SPI - help - Enable LoRa driver for Semtech SX1276. diff --git a/drivers/lora/Kconfig.sx12xx b/drivers/lora/Kconfig.sx12xx new file mode 100644 index 00000000000..2814121bdae --- /dev/null +++ b/drivers/lora/Kconfig.sx12xx @@ -0,0 +1,35 @@ +# +# Copyright (c) 2019 Manivannan Sadhasivam +# +# SPDX-License-Identifier: Apache-2.0 +# + +DT_COMPAT_SEMTECH_SX1276 := semtech,sx1276 + +menuconfig LORA_SX12XX + bool "Semtech SX-series driver" + select HAS_SEMTECH_RADIO_DRIVERS + select HAS_SEMTECH_LORAMAC + depends on SPI + help + Enable LoRa driver for Semtech SX12xx. + +if LORA_SX12XX + +choice + prompt "LoRa Radio chipset" + default LORA_SX1276 if $(dt_compat_enabled,$(DT_COMPAT_SEMTECH_SX1276)) + help + Select the LoRa modem used on your board. The default value + is discovered from the device tree and should be correct for + most users. + +config LORA_SX1276 + bool "Semtech SX1276 driver" + select HAS_SEMTECH_SX1276 + help + Enable LoRa driver for Semtech SX1276. + +endchoice + +endif diff --git a/samples/drivers/lora/receive/prj.conf b/samples/drivers/lora/receive/prj.conf index c74bc7260cb..b7ec7ad24bc 100644 --- a/samples/drivers/lora/receive/prj.conf +++ b/samples/drivers/lora/receive/prj.conf @@ -2,5 +2,5 @@ CONFIG_LOG=y CONFIG_SPI=y CONFIG_GPIO=y CONFIG_LORA=y -CONFIG_LORA_SX1276=y +CONFIG_LORA_SX12XX=y CONFIG_PRINTK=y diff --git a/samples/drivers/lora/send/prj.conf b/samples/drivers/lora/send/prj.conf index c74bc7260cb..b7ec7ad24bc 100644 --- a/samples/drivers/lora/send/prj.conf +++ b/samples/drivers/lora/send/prj.conf @@ -2,5 +2,5 @@ CONFIG_LOG=y CONFIG_SPI=y CONFIG_GPIO=y CONFIG_LORA=y -CONFIG_LORA_SX1276=y +CONFIG_LORA_SX12XX=y CONFIG_PRINTK=y