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

examples/lorawan: adapt to new loramac initialization

This commit is contained in:
Alexandre Abadie 2021-03-12 10:33:29 +01:00
parent e4c54de2a6
commit f5ef94c86c
No known key found for this signature in database
GPG Key ID: 1C919A403CAE1405

View File

@ -32,6 +32,10 @@
#include "net/loramac.h"
#include "semtech_loramac.h"
#include "sx127x.h"
#include "sx127x_netdev.h"
#include "sx127x_params.h"
/* Messages are sent every 20s to respect the duty cycle on each channel */
#define PERIOD (20U)
@ -39,7 +43,8 @@
static kernel_pid_t sender_pid;
static char sender_stack[THREAD_STACKSIZE_MAIN / 2];
semtech_loramac_t loramac;
static semtech_loramac_t loramac;
static sx127x_t sx127x;
static const char *message = "This is RIOT!";
@ -108,6 +113,11 @@ int main(void)
fmt_hex_bytes(appeui, CONFIG_LORAMAC_APP_EUI_DEFAULT);
fmt_hex_bytes(appkey, CONFIG_LORAMAC_APP_KEY_DEFAULT);
/* Initialize the radio driver */
sx127x_setup(&sx127x, &sx127x_params[0], 0);
loramac.netdev = (netdev_t *)&sx127x;
loramac.netdev->driver = &sx127x_driver;
/* Initialize the loramac stack */
semtech_loramac_init(&loramac);
semtech_loramac_set_deveui(&loramac, deveui);