examples/lorawan: add support for sx126x radio
This commit is contained in:
parent
18a0889bc4
commit
5da185c58f
@ -32,9 +32,17 @@
|
|||||||
#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.h"
|
||||||
#include "sx127x_netdev.h"
|
#include "sx127x_netdev.h"
|
||||||
#include "sx127x_params.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 */
|
/* Messages are sent every 20s to respect the duty cycle on each channel */
|
||||||
#define PERIOD (20U)
|
#define PERIOD (20U)
|
||||||
@ -114,9 +122,17 @@ int main(void)
|
|||||||
fmt_hex_bytes(appkey, CONFIG_LORAMAC_APP_KEY_DEFAULT);
|
fmt_hex_bytes(appkey, CONFIG_LORAMAC_APP_KEY_DEFAULT);
|
||||||
|
|
||||||
/* Initialize the radio driver */
|
/* Initialize the radio driver */
|
||||||
|
#if IS_USED(MODULE_SX127X)
|
||||||
sx127x_setup(&sx127x, &sx127x_params[0], 0);
|
sx127x_setup(&sx127x, &sx127x_params[0], 0);
|
||||||
loramac.netdev = (netdev_t *)&sx127x;
|
loramac.netdev = (netdev_t *)&sx127x;
|
||||||
loramac.netdev->driver = &sx127x_driver;
|
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 */
|
/* Initialize the loramac stack */
|
||||||
semtech_loramac_init(&loramac);
|
semtech_loramac_init(&loramac);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user