diff --git a/examples/lorawan/main.c b/examples/lorawan/main.c index e8dbd1cd75..a8078fcd38 100644 --- a/examples/lorawan/main.c +++ b/examples/lorawan/main.c @@ -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);