From ba9b626b6d26efc2d469ef9d14a480775e94edec Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Fri, 12 Mar 2021 16:15:03 +0100 Subject: [PATCH] sys/auto_init/loramac: add support for sx126x radio --- sys/auto_init/loramac/auto_init_loramac.c | 27 +++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/sys/auto_init/loramac/auto_init_loramac.c b/sys/auto_init/loramac/auto_init_loramac.c index 88752c2e1de9..fd0ca3cd593d 100644 --- a/sys/auto_init/loramac/auto_init_loramac.c +++ b/sys/auto_init/loramac/auto_init_loramac.c @@ -18,19 +18,46 @@ */ #include "log.h" +#include "kernel_defines.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 + #include "semtech_loramac.h" semtech_loramac_t loramac; + +#if IS_USED(MODULE_SX127X) static sx127x_t sx127x; +#endif + +#if IS_USED(MODULE_SX126X) +static sx126x_t sx126x; +#endif void auto_init_loramac(void) { +#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 + semtech_loramac_init(&loramac); } /** @} */