lorawan: Add LORAWAN_PUBLIC_NETWORK configuration choice

Provides a toggle between public and private network selections.

Signed-off-by: Lucas Dietrich <lucas.dietrich@socomec.com>
This commit is contained in:
Lucas Dietrich 2023-09-19 14:43:24 +02:00 committed by Carles Cufí
commit a59666754e
2 changed files with 8 additions and 1 deletions

View file

@ -27,6 +27,13 @@ config LORAWAN_SYSTEM_MAX_RX_ERROR
System Max Rx timing error value in ms to be used by LoRaWAN stack System Max Rx timing error value in ms to be used by LoRaWAN stack
for calculating the RX1/RX2 window timing. for calculating the RX1/RX2 window timing.
config LORAWAN_PUBLIC_NETWORK
bool "LoRaWAN Public Network"
default y
help
Enable this option to use a public LoRaWAN network.
Disable for private LoRaWAN networks.
config LORAMAC_REGION_AS923 config LORAMAC_REGION_AS923
bool "Asia 923MHz Frequency band" bool "Asia 923MHz Frequency band"

View file

@ -369,7 +369,7 @@ int lorawan_join(const struct lorawan_join_config *join_cfg)
/* MIB_PUBLIC_NETWORK powers on the radio and does not turn it off */ /* MIB_PUBLIC_NETWORK powers on the radio and does not turn it off */
mib_req.Type = MIB_PUBLIC_NETWORK; mib_req.Type = MIB_PUBLIC_NETWORK;
mib_req.Param.EnablePublicNetwork = true; mib_req.Param.EnablePublicNetwork = IS_ENABLED(CONFIG_LORAWAN_PUBLIC_NETWORK);
LoRaMacMibSetRequestConfirm(&mib_req); LoRaMacMibSetRequestConfirm(&mib_req);
if (join_cfg->mode == LORAWAN_ACT_OTAA) { if (join_cfg->mode == LORAWAN_ACT_OTAA) {