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

examples/lorawan: add support for sx126x radio

This commit is contained in:
Alexandre Abadie 2021-03-12 16:14:46 +01:00
parent 18a0889bc4
commit 5da185c58f
No known key found for this signature in database
GPG Key ID: 1C919A403CAE1405

View File

@ -32,9 +32,17 @@
#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
/* Messages are sent every 20s to respect the duty cycle on each channel */
#define PERIOD (20U)
@ -114,9 +122,17 @@ int main(void)
fmt_hex_bytes(appkey, CONFIG_LORAMAC_APP_KEY_DEFAULT);
/* Initialize the radio driver */
#if IS_USED(MODULE_SX127X)
sx127x_setup(&sx127x, &sx127x_params[0], 0);
loramac.netdev = (netdev_t *)&sx127x;
loramac.netdev->driver = &sx127x_driver;
#endif
#if IS_USED(MODULE_SX126X)
sx126x_setup(&sx126x, &sx126x_params[0], 0);
loramac.netdev = (netdev_t *)&sx126x;
loramac.netdev->driver = &sx126x_driver;
#endif
/* Initialize the loramac stack */
semtech_loramac_init(&loramac);