1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/drivers/sx126x/Kconfig
Marian Buschsieweke 276ad5716a
sys/net/gnrc/netif: allow checking if a netdev is legacy or new API
A if `netdev_driver_t::confirm_send()` is provided, it provides the
new netdev API. However, detecting the API at runtime and handling
both API styles comes at a cost. This can be optimized in case only
new or only old style netdevs are in use.

To do so, this adds the pseudo modules `netdev_legacy_api` and
`netdev_new_api`. As right now no netdev actually implements the new
API, all netdevs pull in `netdev_legacy_api`. If `netdev_legacy_api` is
in used but `netdev_new_api` is not, we can safely assume at compile
time that only legacy netdevs are in use. Similar, if only
`netdev_new_api` is used, only support for the new API is needed. Only
when both are in use, run time checks are needed.

This provides two helper function to check for a netif if the
corresponding netdev implements the old or the new API. (With one
being the inverse of the other.) They are suitable for constant folding
when only new or only legacy devices are in use. Consequently, dead
branches should be eliminated by the optimizer.
2022-08-17 12:56:07 +02:00

86 lines
2.0 KiB
Plaintext

# Copyright (c) 2021 Inria
# Copyright (c) 2021 HAW Hamburg
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
menuconfig MODULE_SX126X
bool
prompt "SX1261/2/8 and LLCC68 LoRa radio driver" if !(HAVE_SX126X && MODULE_NETDEV_DEFAULT)
default y if (HAVE_SX126X && MODULE_NETDEV_DEFAULT)
depends on TEST_KCONFIG
depends on HAS_PERIPH_SPI
depends on HAS_PERIPH_GPIO
depends on HAS_PERIPH_GPIO_IRQ
select MODULE_IOLIST
select MODULE_NETDEV_LEGACY_API
select MODULE_PERIPH_GPIO
select MODULE_PERIPH_SPI
select PACKAGE_DRIVER_SX126X
choice
bool "Radio variant"
depends on MODULE_SX126X
default MODULE_SX1261 if HAVE_SX1261
default MODULE_SX1262 if HAVE_SX1262
default MODULE_SX1268 if HAVE_SX1268
default MODULE_LLCC68 if HAVE_LLCC68
default MODULE_SX126X_STM32WL if HAVE_SX126X_STM32WL
config MODULE_SX1261
bool "SX1261"
select MODULE_PERIPH_GPIO_IRQ
config MODULE_SX1262
bool "SX1262"
select MODULE_PERIPH_GPIO_IRQ
config MODULE_SX1268
bool "SX1268"
select MODULE_PERIPH_GPIO_IRQ
config MODULE_LLCC68
bool "LLCC68"
select MODULE_PERIPH_GPIO_IRQ
config MODULE_SX126X_STM32WL
bool "SX126X-STM32WL"
endchoice
config HAVE_SX1261
bool
select HAVE_SX126X
help
Indicates that an sx1261 transceiver is present.
config HAVE_SX1262
bool
select HAVE_SX126X
help
Indicates that an sx1262 transceiver is present.
config HAVE_SX1268
bool
select HAVE_SX126X
help
Indicates that an sx1268 transceiver is present.
config HAVE_LLCC68
bool
select HAVE_SX126X
help
Indicates that an llcc68 transceiver is present.
config HAVE_SX126X_STM32WL
bool
select HAVE_SX126X
help
Indicates that an sx126x_stm32wl transceiver is present.
config HAVE_SX126X
bool
help
Indicates that an sx126x transceiver is present.