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

examples/lorawan: use auto_init_loramac

This commit is contained in:
Francisco Molina 2022-02-24 09:30:30 +01:00
parent e64b1bd764
commit af6acdd934
2 changed files with 2 additions and 35 deletions

View File

@ -40,6 +40,7 @@ LORA_REGION ?= EU868
# Include the Semtech-loramac package
USEPKG += semtech-loramac
USEMODULE += auto_init_loramac
USEMODULE += $(DRIVER)
USEMODULE += fmt

View File

@ -38,18 +38,6 @@
#include "net/loramac.h"
#include "semtech_loramac.h"
#if IS_USED(MODULE_SX127X)
#include "sx127x.h"
#include "sx127x_netdev.h"
#include "sx127x_params.h"
#endif
#if IS_USED(MODULE_SX126X)
#include "sx126x.h"
#include "sx126x_netdev.h"
#include "sx126x_params.h"
#endif
/* By default, messages are sent every 20s to respect the duty cycle
on each channel */
#ifndef SEND_PERIOD_S
@ -63,13 +51,7 @@
static kernel_pid_t sender_pid;
static char sender_stack[THREAD_STACKSIZE_MAIN / 2];
static semtech_loramac_t loramac;
#if IS_USED(MODULE_SX127X)
static sx127x_t sx127x;
#endif
#if IS_USED(MODULE_SX126X)
static sx126x_t sx126x;
#endif
extern semtech_loramac_t loramac;
#if !IS_USED(MODULE_PERIPH_RTC)
static ztimer_t timer;
#endif
@ -159,22 +141,6 @@ int main(void)
}
#endif
/* Initialize the radio driver */
#if IS_USED(MODULE_SX127X)
sx127x_setup(&sx127x, &sx127x_params[0], 0);
loramac.netdev = &sx127x.netdev;
loramac.netdev->driver = &sx127x_driver;
#endif
#if IS_USED(MODULE_SX126X)
sx126x_setup(&sx126x, &sx126x_params[0], 0);
loramac.netdev = &sx126x.netdev;
loramac.netdev->driver = &sx126x_driver;
#endif
/* Initialize the loramac stack */
semtech_loramac_init(&loramac);
#ifdef USE_OTAA /* OTAA activation mode */
/* Convert identifiers and keys strings to byte arrays */
fmt_hex_bytes(deveui, CONFIG_LORAMAC_DEV_EUI_DEFAULT);