mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-17 05:12:57 +01:00
examples/lorawan: use auto_init_loramac
This commit is contained in:
parent
e64b1bd764
commit
af6acdd934
@ -40,6 +40,7 @@ LORA_REGION ?= EU868
|
|||||||
|
|
||||||
# Include the Semtech-loramac package
|
# Include the Semtech-loramac package
|
||||||
USEPKG += semtech-loramac
|
USEPKG += semtech-loramac
|
||||||
|
USEMODULE += auto_init_loramac
|
||||||
|
|
||||||
USEMODULE += $(DRIVER)
|
USEMODULE += $(DRIVER)
|
||||||
USEMODULE += fmt
|
USEMODULE += fmt
|
||||||
|
@ -38,18 +38,6 @@
|
|||||||
#include "net/loramac.h"
|
#include "net/loramac.h"
|
||||||
#include "semtech_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
|
/* By default, messages are sent every 20s to respect the duty cycle
|
||||||
on each channel */
|
on each channel */
|
||||||
#ifndef SEND_PERIOD_S
|
#ifndef SEND_PERIOD_S
|
||||||
@ -63,13 +51,7 @@
|
|||||||
static kernel_pid_t sender_pid;
|
static kernel_pid_t sender_pid;
|
||||||
static char sender_stack[THREAD_STACKSIZE_MAIN / 2];
|
static char sender_stack[THREAD_STACKSIZE_MAIN / 2];
|
||||||
|
|
||||||
static semtech_loramac_t loramac;
|
extern semtech_loramac_t loramac;
|
||||||
#if IS_USED(MODULE_SX127X)
|
|
||||||
static sx127x_t sx127x;
|
|
||||||
#endif
|
|
||||||
#if IS_USED(MODULE_SX126X)
|
|
||||||
static sx126x_t sx126x;
|
|
||||||
#endif
|
|
||||||
#if !IS_USED(MODULE_PERIPH_RTC)
|
#if !IS_USED(MODULE_PERIPH_RTC)
|
||||||
static ztimer_t timer;
|
static ztimer_t timer;
|
||||||
#endif
|
#endif
|
||||||
@ -159,22 +141,6 @@ int main(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#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 */
|
#ifdef USE_OTAA /* OTAA activation mode */
|
||||||
/* Convert identifiers and keys strings to byte arrays */
|
/* Convert identifiers and keys strings to byte arrays */
|
||||||
fmt_hex_bytes(deveui, CONFIG_LORAMAC_DEV_EUI_DEFAULT);
|
fmt_hex_bytes(deveui, CONFIG_LORAMAC_DEV_EUI_DEFAULT);
|
||||||
|
Loading…
Reference in New Issue
Block a user