net/ieee802154: Add a Kconfig option to set a default tx power

Change-Id: Ife2af22c13954286d8e44c3e0b1f60962c617c52
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
Tomasz Bursztyka 2017-04-12 13:34:44 +02:00 committed by Jukka Rissanen
commit 26b5f94a79
2 changed files with 13 additions and 1 deletions

View file

@ -4,7 +4,14 @@
# SPDX-License-Identifier: Apache-2.0
#
menu "IEEE 802.15.4 Radio protocol"
menu "IEEE 802.15.4 Radio"
config NET_L2_IEEE802154_RADIO_DFLT_TX_POWER
int "Default radio transmission power"
default 0
help
TX power in dbm. Valid setting are: -18, -7, -4, -2, 0, 1, 2, 3, 5
If wrongly set, it will silently fail.
config NET_L2_IEEE802154_RADIO_TX_RETRIES
int "Radio Transmission attempts"

View file

@ -334,5 +334,10 @@ void ieee802154_init(struct net_if *iface)
radio->set_ieee_addr(iface->dev, long_addr);
memcpy(ctx->ext_addr, long_addr, 8);
if (!radio->set_txpower(iface->dev,
CONFIG_NET_L2_IEEE802154_RADIO_DFLT_TX_POWER)) {
ctx->tx_power = CONFIG_NET_L2_IEEE802154_RADIO_DFLT_TX_POWER;
}
radio->start(iface->dev);
}