1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #13315 from jia200x/pr/kconfig/ieee802154

ieee802154: Expose configurations to Kconfig
This commit is contained in:
Leandro Lanzieri 2020-04-08 19:34:55 +02:00 committed by GitHub
commit a06d9bbb66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 91 additions and 45 deletions

View File

@ -55,8 +55,8 @@ extern "C" {
#define CC2538_MIN_FREQ (2394)
#define CC2538_MAX_FREQ (2507)
#define CC2538_RF_POWER_DEFAULT (IEEE802154_DEFAULT_TXPOWER) /**< Default output power in dBm */
#define CC2538_RF_CHANNEL_DEFAULT (IEEE802154_DEFAULT_CHANNEL)
#define CC2538_RF_POWER_DEFAULT (CONFIG_IEEE802154_DEFAULT_TXPOWER) /**< Default output power in dBm */
#define CC2538_RF_CHANNEL_DEFAULT (CONFIG_IEEE802154_DEFAULT_CHANNEL)
#define OUTPUT_POWER_MIN (-24) /**< Min output power in dBm */
#define OUTPUT_POWER_MAX (7) /**< Max output power in dBm */

View File

@ -294,7 +294,7 @@ static int _init(netdev_t *netdev)
netdev_ieee802154_reset(&dev->netdev);
assert(dev != NULL);
dev->netdev.chan = IEEE802154_DEFAULT_CHANNEL;
dev->netdev.chan = CONFIG_IEEE802154_DEFAULT_CHANNEL;
return 0;
}

View File

@ -51,10 +51,10 @@ netdev_ieee802154_t nrf802154_dev = {
.proto = GNRC_NETTYPE_UNDEF,
#endif
#endif
.pan = IEEE802154_DEFAULT_PANID,
.pan = CONFIG_IEEE802154_DEFAULT_PANID,
.short_addr = { 0, 0 },
.long_addr = { 0, 0, 0, 0, 0, 0, 0, 0 },
.chan = IEEE802154_DEFAULT_CHANNEL,
.chan = CONFIG_IEEE802154_DEFAULT_CHANNEL,
.flags = 0
};

View File

@ -71,7 +71,7 @@ void at86rf215_reset_and_cfg(at86rf215_t *dev)
dev->netdev.chan = AT86RF215_DEFAULT_CHANNEL;
}
dev->netdev.pan = IEEE802154_DEFAULT_PANID;
dev->netdev.pan = CONFIG_IEEE802154_DEFAULT_PANID;
/* set default options */
dev->retries_max = AT86RF215_RETRIES_MAX_DEFAULT;

View File

@ -96,14 +96,14 @@ typedef void (*at86rf215_batmon_cb_t)(void *arg);
* @name Channel configuration
* @{
*/
#define AT86RF215_DEFAULT_CHANNEL (IEEE802154_DEFAULT_CHANNEL)
#define AT86RF215_DEFAULT_SUBGHZ_CHANNEL (IEEE802154_DEFAULT_SUBGHZ_CHANNEL)
#define AT86RF215_DEFAULT_CHANNEL (CONFIG_IEEE802154_DEFAULT_CHANNEL)
#define AT86RF215_DEFAULT_SUBGHZ_CHANNEL (CONFIG_IEEE802154_DEFAULT_SUBGHZ_CHANNEL)
/** @} */
/**
* @brief Default TX power (0dBm)
*/
#define AT86RF215_DEFAULT_TXPOWER (IEEE802154_DEFAULT_TXPOWER)
#define AT86RF215_DEFAULT_TXPOWER (CONFIG_IEEE802154_DEFAULT_TXPOWER)
/**
* @name Flags for device internal states (see datasheet)

View File

@ -60,13 +60,13 @@ extern "C" {
/* the AT86RF212B has a sub-1GHz radio */
#define AT86RF2XX_MIN_CHANNEL (IEEE802154_CHANNEL_MIN_SUBGHZ)
#define AT86RF2XX_MAX_CHANNEL (IEEE802154_CHANNEL_MAX_SUBGHZ)
#define AT86RF2XX_DEFAULT_CHANNEL (IEEE802154_DEFAULT_SUBGHZ_CHANNEL)
#define AT86RF2XX_DEFAULT_CHANNEL (CONFIG_IEEE802154_DEFAULT_SUBGHZ_CHANNEL)
/* Page 2 is O-QPSK 100 kbit/s (channel 0), or 250 kbit/s (channels 1-10) */
#define AT86RF2XX_DEFAULT_PAGE (IEEE802154_DEFAULT_SUBGHZ_PAGE)
#define AT86RF2XX_DEFAULT_PAGE (CONFIG_IEEE802154_DEFAULT_SUBGHZ_PAGE)
#else
#define AT86RF2XX_MIN_CHANNEL (IEEE802154_CHANNEL_MIN)
#define AT86RF2XX_MAX_CHANNEL (IEEE802154_CHANNEL_MAX)
#define AT86RF2XX_DEFAULT_CHANNEL (IEEE802154_DEFAULT_CHANNEL)
#define AT86RF2XX_DEFAULT_CHANNEL (CONFIG_IEEE802154_DEFAULT_CHANNEL)
/* Only page 0 is supported in the 2.4 GHz band */
#endif
/** @} */
@ -74,7 +74,7 @@ extern "C" {
/**
* @brief Default TX power (0dBm)
*/
#define AT86RF2XX_DEFAULT_TXPOWER (IEEE802154_DEFAULT_TXPOWER)
#define AT86RF2XX_DEFAULT_TXPOWER (CONFIG_IEEE802154_DEFAULT_TXPOWER)
/**
* @brief Base (minimal) RSSI value in dBm

View File

@ -44,7 +44,7 @@ extern "C" {
*/
#define CC2420_CHAN_MIN (IEEE802154_CHANNEL_MIN)
#define CC2420_CHAN_MAX (IEEE802154_CHANNEL_MAX)
#define CC2420_CHAN_DEFAULT (IEEE802154_DEFAULT_CHANNEL)
#define CC2420_CHAN_DEFAULT (CONFIG_IEEE802154_DEFAULT_CHANNEL)
/** @} */
/**
@ -53,7 +53,7 @@ extern "C" {
*/
#define CC2420_TXPOWER_MIN (-25)
#define CC2420_TXPOWER_MAX (0)
#define CC2420_TXPOWER_DEFAULT (IEEE802154_DEFAULT_TXPOWER)
#define CC2420_TXPOWER_DEFAULT (CONFIG_IEEE802154_DEFAULT_TXPOWER)
/** @} */
/**

View File

@ -48,7 +48,7 @@ extern "C" {
* @{
*/
#ifndef KW2XRF_DEFAULT_CHANNEL
#define KW2XRF_DEFAULT_CHANNEL (IEEE802154_DEFAULT_CHANNEL)
#define KW2XRF_DEFAULT_CHANNEL (CONFIG_IEEE802154_DEFAULT_CHANNEL)
#endif
/** @} */
@ -64,7 +64,7 @@ extern "C" {
/**
* @brief Default TX_POWER in dbm used after initialization
*/
#define KW2XRF_DEFAULT_TX_POWER (IEEE802154_DEFAULT_TXPOWER)
#define KW2XRF_DEFAULT_TX_POWER (CONFIG_IEEE802154_DEFAULT_TXPOWER)
/**
* @brief Maximum output power of the kw2x device in dBm

View File

@ -44,7 +44,7 @@ extern "C" {
* @{
*/
#ifndef KW41ZRF_DEFAULT_CHANNEL
#define KW41ZRF_DEFAULT_CHANNEL (IEEE802154_DEFAULT_CHANNEL)
#define KW41ZRF_DEFAULT_CHANNEL (CONFIG_IEEE802154_DEFAULT_CHANNEL)
#endif
/** @} */
@ -80,7 +80,7 @@ extern "C" {
/**
* @brief Default TX_POWER in dbm used after initialization
*/
#define KW41ZRF_DEFAULT_TX_POWER (IEEE802154_DEFAULT_TXPOWER)
#define KW41ZRF_DEFAULT_TX_POWER (CONFIG_IEEE802154_DEFAULT_TXPOWER)
/**
* @brief Maximum output power of the kw41z device in dBm

View File

@ -73,12 +73,12 @@ extern "C" {
/**
* @brief Default PAN ID used after initialization
*/
#define XBEE_DEFAULT_PANID (IEEE802154_DEFAULT_PANID)
#define XBEE_DEFAULT_PANID (CONFIG_IEEE802154_DEFAULT_PANID)
/**
* @brief Default channel used after initialization
*/
#define XBEE_DEFAULT_CHANNEL (IEEE802154_DEFAULT_CHANNEL)
#define XBEE_DEFAULT_CHANNEL (CONFIG_IEEE802154_DEFAULT_CHANNEL)
/**
* @name Address flags

View File

@ -60,7 +60,7 @@ int mrf24j40_reset(mrf24j40_t *dev)
mrf24j40_set_addr_long(dev, ntohll(addr_long.uint64.u64));
mrf24j40_set_addr_short(dev, ntohs(addr_long.uint16[0].u16));
mrf24j40_set_chan(dev, IEEE802154_DEFAULT_CHANNEL);
mrf24j40_set_chan(dev, CONFIG_IEEE802154_DEFAULT_CHANNEL);
/* configure Immediate Sleep and Wake-Up mode */
mrf24j40_reg_write_short(dev, MRF24J40_REG_WAKECON, MRF24J40_WAKECON_IMMWAKE);

View File

@ -67,7 +67,7 @@ void netdev_ieee802154_reset(netdev_ieee802154_t *dev)
#endif
/* Initialize PAN ID and call netdev::set to propagate it */
dev->pan = IEEE802154_DEFAULT_PANID;
dev->pan = CONFIG_IEEE802154_DEFAULT_PANID;
dev->netdev.driver->set(&dev->netdev, NETOPT_NID, &dev->pan, sizeof(dev->pan));
}

View File

@ -1,17 +1,19 @@
# Set a custom channel if needed
ifneq (,$(DEFAULT_CHANNEL))
ifneq (,$(filter cc110x,$(USEMODULE))) # radio is cc110x sub-GHz
CFLAGS += -DCC110X_DEFAULT_CHANNEL=$(DEFAULT_CHANNEL)
ifndef CONFIG_KCONFIG_MODULE_IEEE802154
ifneq (,$(DEFAULT_CHANNEL))
ifneq (,$(filter cc110x,$(USEMODULE))) # radio is cc110x sub-GHz
CFLAGS += -DCC110X_DEFAULT_CHANNEL=$(DEFAULT_CHANNEL)
endif
ifneq (,$(filter at86rf212b,$(USEMODULE))) # radio is IEEE 802.15.4 sub-GHz
CFLAGS += -DCONFIG_IEEE802154_DEFAULT_SUBGHZ_CHANNEL=$(DEFAULT_CHANNEL)
else # radio is IEEE 802.15.4 2.4 GHz
CFLAGS += -DCONFIG_IEEE802154_DEFAULT_CHANNEL=$(DEFAULT_CHANNEL)
endif
endif
ifneq (,$(filter at86rf212b,$(USEMODULE))) # radio is IEEE 802.15.4 sub-GHz
CFLAGS += -DIEEE802154_DEFAULT_SUBGHZ_CHANNEL=$(DEFAULT_CHANNEL)
else # radio is IEEE 802.15.4 2.4 GHz
CFLAGS += -DIEEE802154_DEFAULT_CHANNEL=$(DEFAULT_CHANNEL)
# Set a custom PAN ID if needed
ifneq (,$(DEFAULT_PAN_ID))
CFLAGS += -DCONFIG_IEEE802154_DEFAULT_PANID=$(DEFAULT_PAN_ID)
endif
endif
# Set a custom PAN ID if needed
ifneq (,$(DEFAULT_PAN_ID))
CFLAGS += -DIEEE802154_DEFAULT_PANID=$(DEFAULT_PAN_ID)
endif

View File

@ -124,29 +124,29 @@ extern const uint8_t ieee802154_addr_bcast[IEEE802154_ADDR_BCAST_LEN];
/**
* @brief IEEE802.15.4 default sub-GHZ channel
*/
#ifndef IEEE802154_DEFAULT_SUBGHZ_CHANNEL
#define IEEE802154_DEFAULT_SUBGHZ_CHANNEL (5U)
#ifndef CONFIG_IEEE802154_DEFAULT_SUBGHZ_CHANNEL
#define CONFIG_IEEE802154_DEFAULT_SUBGHZ_CHANNEL (5U)
#endif
/**
* @brief IEEE802.15.4 default channel
*/
#ifndef IEEE802154_DEFAULT_CHANNEL
#define IEEE802154_DEFAULT_CHANNEL (26U)
#ifndef CONFIG_IEEE802154_DEFAULT_CHANNEL
#define CONFIG_IEEE802154_DEFAULT_CHANNEL (26U)
#endif
/**
* @brief IEEE802.15.4 default sub-GHZ page
*/
#ifndef IEEE802154_DEFAULT_SUBGHZ_PAGE
#define IEEE802154_DEFAULT_SUBGHZ_PAGE (2U)
#ifndef CONFIG_IEEE802154_DEFAULT_SUBGHZ_PAGE
#define CONFIG_IEEE802154_DEFAULT_SUBGHZ_PAGE (2U)
#endif
/**
* @brief IEEE802.15.4 default PANID
*/
#ifndef IEEE802154_DEFAULT_PANID
#define IEEE802154_DEFAULT_PANID (0x0023U)
#ifndef CONFIG_IEEE802154_DEFAULT_PANID
#define CONFIG_IEEE802154_DEFAULT_PANID (0x0023U)
#endif
/**
@ -159,8 +159,8 @@ extern const uint8_t ieee802154_addr_bcast[IEEE802154_ADDR_BCAST_LEN];
/**
* @brief IEEE802.15.4 default TX power (in dBm)
*/
#ifndef IEEE802154_DEFAULT_TXPOWER
#define IEEE802154_DEFAULT_TXPOWER (0)
#ifndef CONFIG_IEEE802154_DEFAULT_TXPOWER
#define CONFIG_IEEE802154_DEFAULT_TXPOWER (0)
#endif
/** @} */

View File

@ -9,5 +9,6 @@ menu "Networking"
rsource "application_layer/Kconfig"
rsource "gnrc/Kconfig"
rsource "sock/Kconfig"
rsource "link_layer/Kconfig"
endmenu # Networking

View File

@ -0,0 +1,7 @@
# Copyright (c) 2019 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.
rsource "ieee802154/Kconfig"

View File

@ -0,0 +1,36 @@
# Copyright (c) 2020 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 KCONFIG_MODULE_IEEE802154
bool "Configure IEEE802.15.4"
depends on MODULE_IEEE802154
help
Configure IEEE802.15.4 module using Kconfig
if KCONFIG_MODULE_IEEE802154
config IEEE802154_DEFAULT_SUBGHZ_CHANNEL
int "IEEE802.15.4 default sub-GHZ channel"
default 5
config IEEE802154_DEFAULT_SUBGHZ_PAGE
int "IEEE802.15.4 default sub-GHZ page"
default 2
config IEEE802154_DEFAULT_CHANNEL
int "IEEE802.15.4 default channel"
default 26
config IEEE802154_DEFAULT_PANID
hex "IEEE802.15.4 default PANID"
default 0x0023
range 0x0 0xFFFF
config IEEE802154_DEFAULT_TXPOWER
int "IEEE802.15.4 default TX power (in dBm)"
default 0
endif # KCONFIG_MODULE_IEEE802154