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

examples/lorawan : Update macros

Updates macros to allow for changes via Kconfig
This commit is contained in:
Akshai M 2020-11-25 22:13:37 +01:00
parent a2f505f116
commit ae1c8497f2
3 changed files with 18 additions and 8 deletions

View File

@ -34,8 +34,8 @@
#include "net/gnrc/pktbuf.h"
#include "net/gnrc/pktdump.h"
#include "net/gnrc/netreg.h"
#include "net/loramac.h"
#define LORAWAN_PORT (2U)
#define LORAWAN_QUEUE_SIZE (4U)
static void _usage(void)
@ -46,7 +46,7 @@ static void _usage(void)
int tx_cmd(int argc, char **argv)
{
gnrc_pktsnip_t *pkt;
uint8_t port = LORAWAN_PORT; /* Default: 2 */
uint8_t port = CONFIG_LORAMAC_DEFAULT_TX_PORT; /* Default: 2 */
int interface;
if (argc < 3) {
@ -100,7 +100,7 @@ int main(void)
{
/* start the shell */
puts("Initialization successful - starting the shell now");
gnrc_netreg_entry_t dump = GNRC_NETREG_ENTRY_INIT_PID(LORAWAN_PORT,
gnrc_netreg_entry_t dump = GNRC_NETREG_ENTRY_INIT_PID(CONFIG_LORAMAC_DEFAULT_TX_PORT,
gnrc_pktdump_pid);
gnrc_netreg_register(GNRC_NETTYPE_LORAWAN, &dump);

View File

@ -24,8 +24,6 @@ USEMODULE += $(DRIVER)
USEMODULE += fmt
FEATURES_REQUIRED += periph_rtc
CFLAGS += -DDEVEUI=\"$(DEVEUI)\" -DAPPEUI=\"$(APPEUI)\" -DAPPKEY=\"$(APPKEY)\"
# Comment this out to disable code in RIOT that does safety checking
# which is not needed in a production environment but helps in the
# development process:
@ -47,3 +45,15 @@ ifneq (,$(filter test,$(MAKECMDGOALS)))
endif
include $(RIOTBASE)/Makefile.include
# OTAA compile time configuration keys
ifeq (,$(CONFIG_LORAMAC_APP_KEY_DEFAULT)$(CONFIG_LORAMAC_APP_EUI_DEFAULT)$(CONFIG_LORAMAC_DEV_EUI_DEFAULT))
CFLAGS += -DCONFIG_LORAMAC_APP_KEY_DEFAULT=\"$(APPKEY)\"
CFLAGS += -DCONFIG_LORAMAC_APP_EUI_DEFAULT=\"$(APPEUI)\"
CFLAGS += -DCONFIG_LORAMAC_DEV_EUI_DEFAULT=\"$(DEVEUI)\"
endif
# Set network as public
ifndef CONFIG_LORAMAC_DEFAULT_PUBLIC_NETWORK
CFLAGS += -DCONFIG_LORAMAC_DEFAULT_PUBLIC_NETWORK=1
endif

View File

@ -104,9 +104,9 @@ int main(void)
puts("=====================================");
/* Convert identifiers and application key */
fmt_hex_bytes(deveui, DEVEUI);
fmt_hex_bytes(appeui, APPEUI);
fmt_hex_bytes(appkey, APPKEY);
fmt_hex_bytes(deveui, CONFIG_LORAMAC_DEV_EUI_DEFAULT);
fmt_hex_bytes(appeui, CONFIG_LORAMAC_APP_EUI_DEFAULT);
fmt_hex_bytes(appkey, CONFIG_LORAMAC_APP_KEY_DEFAULT);
/* Initialize the loramac stack */
semtech_loramac_init(&loramac);