diff --git a/pkg/semtech-loramac/Makefile b/pkg/semtech-loramac/Makefile index f6a13c5edb..aab8f6235e 100644 --- a/pkg/semtech-loramac/Makefile +++ b/pkg/semtech-loramac/Makefile @@ -1,6 +1,6 @@ PKG_NAME=semtech-loramac PKG_URL=https://github.com/Lora-net/LoRaMac-node.git -PKG_VERSION=f42be67be402a40b3586724800771bfe13fb18e6 +PKG_VERSION=1cdd9ccec4c9f05b616e7112059be4a9e358c571 PKG_LICENSE=BSD-3-Clause .PHONY: all @@ -10,7 +10,7 @@ all: git-download @cp Makefile.loramac_mac $(PKG_BUILDDIR)/src/mac/Makefile @cp Makefile.loramac_region $(PKG_BUILDDIR)/src/mac/region/Makefile @cp Makefile.loramac_crypto $(PKG_BUILDDIR)/src/system/crypto/Makefile - @cp Makefile.loramac_arch $(PKG_BUILDDIR)/src/boards/mcu/stm32/Makefile + @cp Makefile.loramac_arch $(PKG_BUILDDIR)/src/boards/mcu/Makefile "$(MAKE)" -C $(PKG_BUILDDIR) include $(RIOTBASE)/pkg/pkg.mk diff --git a/pkg/semtech-loramac/Makefile.loramac b/pkg/semtech-loramac/Makefile.loramac index 75be4c5d20..f69a33033f 100644 --- a/pkg/semtech-loramac/Makefile.loramac +++ b/pkg/semtech-loramac/Makefile.loramac @@ -1,10 +1,10 @@ DIRS += src/mac DIRS += src/mac/region DIRS += src/system/crypto -DIRS += src/boards/mcu/stm32 +DIRS += src/boards/mcu INCLUDES += -I$(PKGDIRBASE)/semtech-loramac/src/mac \ - -I$(PKGDIRBASE)/semtech-loramac/src/boards/mcu/stm32 \ + -I$(PKGDIRBASE)/semtech-loramac/src/boards/mcu \ -I$(PKGDIRBASE)/semtech-loramac/src/system/crypto \ -I$(PKGDIRBASE)/semtech-loramac/src diff --git a/pkg/semtech-loramac/Makefile.loramac_arch b/pkg/semtech-loramac/Makefile.loramac_arch index da78e4622e..322226aa18 100644 --- a/pkg/semtech-loramac/Makefile.loramac_arch +++ b/pkg/semtech-loramac/Makefile.loramac_arch @@ -4,4 +4,6 @@ SRCS := utilities.c CFLAGS += -Wno-sign-compare +INCLUDES += -I$(PKGDIRBASE)/semtech-loramac/src/boards + include $(RIOTBASE)/Makefile.base diff --git a/pkg/semtech-loramac/Makefile.loramac_crypto b/pkg/semtech-loramac/Makefile.loramac_crypto index 57f8f7ef1e..d191c20add 100644 --- a/pkg/semtech-loramac/Makefile.loramac_crypto +++ b/pkg/semtech-loramac/Makefile.loramac_crypto @@ -1,3 +1,5 @@ MODULE := semtech_loramac_crypto +INCLUDES += -I$(PKGDIRBASE)/semtech-loramac/src/boards + include $(RIOTBASE)/Makefile.base diff --git a/pkg/semtech-loramac/Makefile.loramac_mac b/pkg/semtech-loramac/Makefile.loramac_mac index 87382dacb0..3fd69001a4 100644 --- a/pkg/semtech-loramac/Makefile.loramac_mac +++ b/pkg/semtech-loramac/Makefile.loramac_mac @@ -2,4 +2,7 @@ MODULE := semtech_loramac_mac CFLAGS += -Wno-sign-compare +INCLUDES += -I$(PKGDIRBASE)/semtech-loramac/src/boards \ + -I$(PKGDIRBASE)/semtech-loramac/src/radio + include $(RIOTBASE)/Makefile.base diff --git a/pkg/semtech-loramac/Makefile.loramac_region b/pkg/semtech-loramac/Makefile.loramac_region index 3d0769944e..1d9ce93aa2 100644 --- a/pkg/semtech-loramac/Makefile.loramac_region +++ b/pkg/semtech-loramac/Makefile.loramac_region @@ -2,4 +2,7 @@ MODULE := semtech_loramac_mac_region CFLAGS += -Wno-missing-field-initializers -Wno-unused-parameter -Wno-sign-compare +INCLUDES += -I$(PKGDIRBASE)/semtech-loramac/src/boards \ + -I$(PKGDIRBASE)/semtech-loramac/src/radio + include $(RIOTBASE)/Makefile.base diff --git a/pkg/semtech-loramac/contrib/Makefile b/pkg/semtech-loramac/contrib/Makefile index a8321f21eb..baadd04b0b 100644 --- a/pkg/semtech-loramac/contrib/Makefile +++ b/pkg/semtech-loramac/contrib/Makefile @@ -1,7 +1,8 @@ MODULE := semtech_loramac_contrib INCLUDES += -I$(PKGDIRBASE)/semtech-loramac/src/mac \ - -I$(PKGDIRBASE)/semtech-loramac/src/boards/mcu/stm32 \ + -I$(PKGDIRBASE)/semtech-loramac/src/boards \ + -I$(PKGDIRBASE)/semtech-loramac/src/radio \ -I$(PKGDIRBASE)/semtech-loramac/src/system/crypto \ -I$(PKGDIRBASE)/semtech-loramac/src diff --git a/pkg/semtech-loramac/contrib/semtech_loramac.c b/pkg/semtech-loramac/contrib/semtech_loramac.c index 0114d65576..468535aacc 100644 --- a/pkg/semtech-loramac/contrib/semtech_loramac.c +++ b/pkg/semtech-loramac/contrib/semtech_loramac.c @@ -38,30 +38,12 @@ #include "sx127x_netdev.h" #include "semtech_loramac.h" -#include "semtech-loramac/board.h" #include "LoRaMac.h" #include "region/Region.h" #define ENABLE_DEBUG (0) #include "debug.h" -#define LORAWAN_MAX_JOIN_RETRIES (3U) - -#if defined(REGION_EU868) -#define LORAWAN_DUTYCYCLE_ON (true) -#define USE_SEMTECH_DEFAULT_CHANNEL_LINEUP (1) - -#if (USE_SEMTECH_DEFAULT_CHANNEL_LINEUP) -#define LC4 { 867100000, 0, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 } -#define LC5 { 867300000, 0, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 } -#define LC6 { 867500000, 0, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 } -#define LC7 { 867700000, 0, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 } -#define LC8 { 867900000, 0, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 } -#define LC9 { 868800000, 0, { ( ( DR_7 << 4 ) | DR_7 ) }, 2 } -#define LC10 { 868300000, 0, { ( ( DR_6 << 4 ) | DR_6 ) }, 1 } -#endif /* USE_SEMTECH_DEFAULT_CHANNEL_LINEUP */ -#endif /* REGION_EU868 */ - #define SEMTECH_LORAMAC_MSG_QUEUE (16U) #define SEMTECH_LORAMAC_LORAMAC_STACKSIZE (THREAD_STACKSIZE_DEFAULT) static msg_t _semtech_loramac_msg_queue[SEMTECH_LORAMAC_MSG_QUEUE]; @@ -210,6 +192,20 @@ static void mcps_indication(McpsIndication_t *indication) } } + /* Check Multicast + Check Port + Check Datarate + Check FramePending */ + if (indication->FramePending == true) { + /* The server signals that it has pending data to be sent. + We schedule an uplink as soon as possible to flush the server. */ + DEBUG("[semtech-loramac] MCPS indication: pending data, schedule an " + "uplink\n"); + msg_t msg; + msg.type = MSG_TYPE_LORAMAC_TX_SCHEDULE; + msg_send(&msg, semtech_loramac_pid); + } + msg_t msg; if (indication->RxData) { DEBUG("[semtech-loramac] MCPS indication: data received\n"); @@ -222,7 +218,7 @@ static void mcps_indication(McpsIndication_t *indication) msg_send(&msg, semtech_loramac_pid); } -/*MLME-Confirm event function */ +/* MLME-Confirm event function */ static void mlme_confirm(MlmeConfirm_t *confirm) { DEBUG("[semtech-loramac] MLME confirm event\n"); @@ -260,6 +256,23 @@ static void mlme_confirm(MlmeConfirm_t *confirm) } } +/* MLME-Indication event function */ +static void mlme_indication(MlmeIndication_t *indication) +{ + switch (indication->MlmeIndication) { + case MLME_SCHEDULE_UPLINK: + /* The MAC signals that we shall provide an uplink + as soon as possible */ + DEBUG("[semtech-loramac] MLME indication: schedule an uplink\n"); + msg_t msg; + msg.type = MSG_TYPE_LORAMAC_TX_SCHEDULE; + msg_send(&msg, semtech_loramac_pid); + break; + default: + break; + } +} + void _init_loramac(semtech_loramac_t *mac, LoRaMacPrimitives_t * primitives, LoRaMacCallback_t *callbacks) { @@ -268,59 +281,11 @@ void _init_loramac(semtech_loramac_t *mac, primitives->MacMcpsConfirm = mcps_confirm; primitives->MacMcpsIndication = mcps_indication; primitives->MacMlmeConfirm = mlme_confirm; -#if defined(REGION_AS923) - DEBUG("[semtech-loramac] initialize loramac for AS923 region\n"); + primitives->MacMlmeIndication = mlme_indication; LoRaMacInitialization(&semtech_loramac_radio_events, primitives, callbacks, - LORAMAC_REGION_AS923); -#elif defined(REGION_AU915) - DEBUG("[semtech-loramac] initialize loramac for AU915 region\n"); - LoRaMacInitialization(&semtech_loramac_radio_events, primitives, callbacks, - LORAMAC_REGION_AU915); -#elif defined(REGION_CN779) - DEBUG("[semtech-loramac] initialize loramac for CN779 region\n"); - LoRaMacInitialization(&semtech_loramac_radio_events, primitives, callbacks, - LORAMAC_REGION_CN779); -#elif defined(REGION_EU868) - DEBUG("[semtech-loramac] initialize loramac for EU868 region\n"); - LoRaMacInitialization(&semtech_loramac_radio_events, primitives, callbacks, - LORAMAC_REGION_EU868); -#elif defined(REGION_IN865) - DEBUG("[semtech-loramac] initialize loramac for IN865 region\n"); - LoRaMacInitialization(&semtech_loramac_radio_events, primitives, callbacks, - LORAMAC_REGION_IN865); -#elif defined(REGION_KR920) - DEBUG("[semtech-loramac] initialize loramac for KR920 region\n"); - LoRaMacInitialization(&semtech_loramac_radio_events, primitives, callbacks, - LORAMAC_REGION_KR920); -#elif defined(REGION_US915) - DEBUG("[semtech-loramac] initialize loramac for US915 region\n"); - LoRaMacInitialization(&semtech_loramac_radio_events, primitives, callbacks, - LORAMAC_REGION_US915); -#elif defined(REGION_US915_HYBRID) - DEBUG("[semtech-loramac] initialize loramac for US915 hybrid region\n"); - LoRaMacInitialization(&semtech_loramac_radio_events, primitives, callbacks, - LORAMAC_REGION_US915_HYBRID); -#else -#error "Please define a region in the compiler options." -#endif + LORAMAC_ACTIVE_REGION); mutex_unlock(&mac->lock); -#if defined(REGION_EU868) && USE_SEMTECH_DEFAULT_CHANNEL_LINEUP - DEBUG("[semtech-loramac] EU868 region: use default channels\n"); - mutex_lock(&mac->lock); - LoRaMacChannelAdd(3, (ChannelParams_t)LC4); - LoRaMacChannelAdd(4, (ChannelParams_t)LC5); - LoRaMacChannelAdd(5, (ChannelParams_t)LC6); - LoRaMacChannelAdd(6, (ChannelParams_t)LC7); - LoRaMacChannelAdd(7, (ChannelParams_t)LC8); - LoRaMacChannelAdd(8, (ChannelParams_t)LC9); - LoRaMacChannelAdd(9, (ChannelParams_t)LC10); - mutex_unlock(&mac->lock); - - semtech_loramac_set_rx2_dr(mac, LORAMAC_DEFAULT_RX2_DR); - semtech_loramac_set_rx2_freq(mac, LORAMAC_DEFAULT_RX2_FREQ); -#endif - semtech_loramac_set_dr(mac, LORAMAC_DEFAULT_DR); semtech_loramac_set_adr(mac, LORAMAC_DEFAULT_ADR); semtech_loramac_set_public_network(mac, LORAMAC_DEFAULT_PUBLIC_NETWORK); @@ -334,6 +299,8 @@ static void _join_otaa(semtech_loramac_t *mac) { DEBUG("[semtech-loramac] starting OTAA join\n"); + uint8_t dr = semtech_loramac_get_dr(mac); + mutex_lock(&mac->lock); MibRequestConfirm_t mibReq; mibReq.Type = MIB_NETWORK_JOINED; @@ -345,9 +312,35 @@ static void _join_otaa(semtech_loramac_t *mac) mlmeReq.Req.Join.DevEui = mac->deveui; mlmeReq.Req.Join.AppEui = mac->appeui; mlmeReq.Req.Join.AppKey = mac->appkey; - mlmeReq.Req.Join.NbTrials = LORAWAN_MAX_JOIN_RETRIES; - LoRaMacMlmeRequest(&mlmeReq); - mutex_unlock(&mac->lock); + mlmeReq.Req.Join.Datarate = dr; + uint8_t ret = LoRaMacMlmeRequest(&mlmeReq); + switch(ret) { + case LORAMAC_STATUS_OK: + mutex_unlock(&mac->lock); + return; + case LORAMAC_STATUS_DUTYCYCLE_RESTRICTED: + { + mutex_unlock(&mac->lock); + DEBUG("[semtech-loramac] Duty cycle restricted\n"); + /* Cannot join. */ + msg_t msg; + msg.type = MSG_TYPE_LORAMAC_JOIN; + msg.content.value = SEMTECH_LORAMAC_RESTRICTED; + msg_send(&msg, semtech_loramac_pid); + return; + } + default: + { + mutex_unlock(&mac->lock); + DEBUG("[semtech-loramac] join not successful: %d\n", ret); + /* Cannot join. */ + msg_t msg; + msg.type = MSG_TYPE_LORAMAC_JOIN; + msg.content.value = SEMTECH_LORAMAC_JOIN_FAILED; + msg_send(&msg, semtech_loramac_pid); + return; + } + } } static void _join_abp(semtech_loramac_t *mac) @@ -560,6 +553,15 @@ void *_semtech_loramac_event_loop(void *arg) mac->state = SEMTECH_LORAMAC_STATE_IDLE; break; } + case MSG_TYPE_LORAMAC_TX_SCHEDULE: + { + DEBUG("[semtech-loramac] schedule immediate TX\n"); + uint8_t prev_port = mac->port; + mac->port = 0; + _semtech_loramac_send(mac, NULL, 0); + mac->port = prev_port; + break; + } case MSG_TYPE_LORAMAC_TX_CNF_FAILED: DEBUG("[semtech-loramac] loramac TX failed\n"); msg_t msg_ret; @@ -702,7 +704,7 @@ uint8_t semtech_loramac_recv(semtech_loramac_t *mac) default: ret = SEMTECH_LORAMAC_TX_DONE; break; - } + } DEBUG("[semtech-loramac] MAC reply received: %d\n", ret); diff --git a/pkg/semtech-loramac/contrib/semtech_loramac_getset.c b/pkg/semtech-loramac/contrib/semtech_loramac_getset.c index dda98097f7..e007d77bf8 100644 --- a/pkg/semtech-loramac/contrib/semtech_loramac_getset.c +++ b/pkg/semtech-loramac/contrib/semtech_loramac_getset.c @@ -24,7 +24,6 @@ #include "net/loramac.h" -#include "semtech-loramac/board.h" #include "LoRaMac.h" #define ENABLE_DEBUG (0) diff --git a/pkg/semtech-loramac/contrib/semtech_loramac_radio.c b/pkg/semtech-loramac/contrib/semtech_loramac_radio.c index a81c1ad823..0ba549cd90 100644 --- a/pkg/semtech-loramac/contrib/semtech_loramac_radio.c +++ b/pkg/semtech-loramac/contrib/semtech_loramac_radio.c @@ -26,8 +26,6 @@ #include "sx127x_internal.h" #include "sx127x_netdev.h" -#include "semtech-loramac/board.h" - #include "radio/radio.h" #define ENABLE_DEBUG (0) @@ -35,8 +33,6 @@ extern sx127x_t sx127x; -#define LORAMAC_RX_WINDOW_DURATION (600UL * US_PER_MS) - /* * Radio driver functions implementation wrappers, the netdev2 object * is known within the scope of the function @@ -88,7 +84,6 @@ void SX127XSetRxConfig(RadioModems_t modem, uint32_t bandwidth, bool iqInverted, bool rxContinuous) { (void) bandwidthAfc; - (void) symbTimeout; (void) fixLen; sx127x_set_modem(&sx127x, modem); sx127x_set_bandwidth(&sx127x, bandwidth); @@ -101,9 +96,8 @@ void SX127XSetRxConfig(RadioModems_t modem, uint32_t bandwidth, sx127x_set_freq_hop(&sx127x, freqHopOn); sx127x_set_hop_period(&sx127x, hopPeriod); sx127x_set_iq_invert(&sx127x, iqInverted); - sx127x_set_rx_timeout(&sx127x, LORAMAC_RX_WINDOW_DURATION); + sx127x_set_symbol_timeout(&sx127x, 2 * symbTimeout); sx127x_set_rx_single(&sx127x, !rxContinuous); - sx127x_set_rx(&sx127x); } void SX127XSetTxConfig(RadioModems_t modem, int8_t power, uint32_t fdev, @@ -131,7 +125,7 @@ void SX127XSetTxConfig(RadioModems_t modem, int8_t power, uint32_t fdev, sx127x_set_tx_timeout(&sx127x, timeout * US_PER_MS); /* base unit us, LoRaMAC ms */ } -uint32_t SX127XGetTimeOnAir(RadioModems_t modem, uint8_t pktLen) +uint32_t SX127XTimeOnAir(RadioModems_t modem, uint8_t pktLen) { (void) modem; return sx127x_get_time_on_air(&sx127x, pktLen); @@ -147,19 +141,19 @@ void SX127XSend(uint8_t *buffer, uint8_t size) dev->driver->send(dev, &iol); } -void SX127XSetSleep(void) +void SX127XSleep(void) { sx127x_set_sleep(&sx127x); } -void SX127XSetStby(void) +void SX127XStandby(void) { sx127x_set_standby(&sx127x); } -void SX127XSetRx(uint32_t timeout) +void SX127XRx(uint32_t timeout) { - (void) timeout; + sx127x_set_rx_timeout(&sx127x, timeout * US_PER_MS); sx127x_set_rx(&sx127x); } @@ -168,28 +162,28 @@ void SX127XStartCad(void) sx127x_start_cad(&sx127x); } -int16_t SX127XReadRssi(RadioModems_t modem) +int16_t SX127XRssi(RadioModems_t modem) { sx127x_set_modem(&sx127x, (uint8_t)modem); return sx127x_read_rssi(&sx127x); } -void SX127XWrite(uint8_t addr, uint8_t data) +void SX127XWrite(uint16_t addr, uint8_t data) { sx127x_reg_write(&sx127x, addr, data); } -uint8_t SX127XRead(uint8_t addr) +uint8_t SX127XRead(uint16_t addr) { return sx127x_reg_read(&sx127x, addr); } -void SX127XWriteBuffer(uint8_t addr, uint8_t *buffer, uint8_t size) +void SX127XWriteBuffer(uint16_t addr, uint8_t *buffer, uint8_t size) { sx127x_reg_write_burst(&sx127x, addr, buffer, size); } -void SX127XReadBuffer(uint8_t addr, uint8_t *buffer, uint8_t size) +void SX127XReadBuffer(uint16_t addr, uint8_t *buffer, uint8_t size) { sx127x_reg_read_burst(&sx127x, addr, buffer, size); } @@ -227,6 +221,29 @@ void SX127XSetPublicNetwork(bool enable) } } +uint32_t SX127XGetWakeupTime(void) +{ + return 0; +} + +void SX127XIrqProcess(void) +{ + return; +} + +void SX127XRxBoosted(uint32_t timeout) +{ + (void) timeout; + return; +} + +void SX127XSetRxDutyCycle(uint32_t rx_time, uint32_t sleep_time) +{ + (void) rx_time; + (void) sleep_time; + return; +} + /** * LoRa function callbacks */ @@ -241,18 +258,22 @@ const struct Radio_s Radio = SX127XSetRxConfig, SX127XSetTxConfig, SX127XCheckRfFrequency, - SX127XGetTimeOnAir, + SX127XTimeOnAir, SX127XSend, - SX127XSetSleep, - SX127XSetStby, - SX127XSetRx, + SX127XSleep, + SX127XStandby, + SX127XRx, SX127XStartCad, SX127XSetTxContinuousWave, - SX127XReadRssi, + SX127XRssi, SX127XWrite, SX127XRead, SX127XWriteBuffer, SX127XReadBuffer, SX127XSetMaxPayloadLength, - SX127XSetPublicNetwork + SX127XSetPublicNetwork, + SX127XGetWakeupTime, + SX127XIrqProcess, + SX127XRxBoosted, + SX127XSetRxDutyCycle, }; diff --git a/pkg/semtech-loramac/contrib/semtech_loramac_timer.c b/pkg/semtech-loramac/contrib/semtech_loramac_timer.c index 0c62722c7d..9fda0f40a6 100644 --- a/pkg/semtech-loramac/contrib/semtech_loramac_timer.c +++ b/pkg/semtech-loramac/contrib/semtech_loramac_timer.c @@ -19,9 +19,9 @@ * @} */ -#include "semtech-loramac/board.h" #include "xtimer.h" #include "thread.h" +#include "semtech-loramac/timer.h" extern kernel_pid_t semtech_loramac_pid; @@ -62,27 +62,27 @@ void TimerSetValue(TimerEvent_t *obj, uint32_t value) /* According to the lorawan specifications, the data sent from the gateway could arrive with a short shift in time of +/- 20ms. Here the timeout is - triggered 50ms in advance to make sure the radio switches to RX mode on + triggered 22ms in advance to make sure the radio switches to RX mode on time and doesn't miss any downlink messages. */ - obj->timeout = (value - 50) * 1000; + obj->timeout = (value - 22) * US_PER_MS; } TimerTime_t TimerGetCurrentTime(void) { uint64_t CurrentTime = xtimer_now_usec64(); - return (TimerTime_t)CurrentTime; + return (TimerTime_t)CurrentTime / US_PER_MS; } TimerTime_t TimerGetElapsedTime(TimerTime_t savedTime) { uint64_t CurrentTime = xtimer_now_usec64(); - return (TimerTime_t)(CurrentTime - savedTime); + return (TimerTime_t)(CurrentTime - savedTime) / US_PER_MS; } TimerTime_t TimerGetFutureTime(TimerTime_t eventInFuture) { uint64_t CurrentTime = xtimer_now_usec64(); - return (TimerTime_t)(CurrentTime + eventInFuture); + return (TimerTime_t)(CurrentTime + eventInFuture) / US_PER_MS; } void TimerLowPowerHandler( void ) diff --git a/pkg/semtech-loramac/include/semtech-loramac/board.h b/pkg/semtech-loramac/include/semtech-loramac/board.h deleted file mode 100644 index 279abe2a48..0000000000 --- a/pkg/semtech-loramac/include/semtech-loramac/board.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2017 Fundacion Inria Chile - * 2017 Inria - * - * This file is subject to the terms and conditions of the GNU Lesser - * General Public License v2.1. See the file LICENSE in the top level - * directory for more details. - */ - -/** - * @ingroup pkg_semtech-loramac - * @brief Internal required Semtech LoRaMAC definitions for radio - * @{ - * - * @file - * - * @author José Ignacio Alamos - * @author Alexandre Abadie - * @author Francisco Molina - */ - -#ifndef SEMTECH_LORAMAC_BOARD_H -#define SEMTECH_LORAMAC_BOARD_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include -#include "semtech-loramac/timer.h" - -/** - * @brief Radio wakeup time from SLEEP mode - */ -#define RADIO_OSC_STARTUP (1U) /* [ms] */ - -/** - * @brief Radio PLL lock and Mode Ready delay which can vary with the temperature - */ -#define RADIO_SLEEP_TO_RX (2U) /* [ms] */ - -/** - * @brief Radio complete Wake-up Time with margin for temperature compensation - */ -#define RADIO_WAKEUP_TIME ( RADIO_OSC_STARTUP + RADIO_SLEEP_TO_RX ) - -#ifdef __cplusplus -} -#endif - -#endif /* SEMTECH_LORAMAC_BOARD_H */ -/** @} */ diff --git a/pkg/semtech-loramac/include/semtech_loramac.h b/pkg/semtech-loramac/include/semtech_loramac.h index c0e07750cf..f9aaff738c 100644 --- a/pkg/semtech-loramac/include/semtech_loramac.h +++ b/pkg/semtech-loramac/include/semtech_loramac.h @@ -46,6 +46,7 @@ extern "C" { #define MSG_TYPE_LORAMAC_RX (0x3463) /**< Some data received */ #define MSG_TYPE_LORAMAC_LINK_CHECK (0x3464) /**< Link check info received */ #define MSG_TYPE_LORAMAC_TX_CNF_FAILED (0x3465) /**< MAC TX confirmed failed */ +#define MSG_TYPE_LORAMAC_TX_SCHEDULE (0x3466) /**< MAC TX schedule */ /** @} */ /** @@ -64,7 +65,8 @@ enum { SEMTECH_LORAMAC_TX_DONE, /**< Transmission completed */ SEMTECH_LORAMAC_TX_CNF_FAILED, /**< Confirmable transmission failed */ SEMTECH_LORAMAC_DATA_RECEIVED, /**< Data received */ - SEMTECH_LORAMAC_BUSY /**< Internal MAC is busy */ + SEMTECH_LORAMAC_BUSY, /**< Internal MAC is busy */ + SEMTECH_LORAMAC_RESTRICTED /**< Restricted access to channels */ }; /** diff --git a/pkg/semtech-loramac/patches/0001-adapt-for-RIOT.patch b/pkg/semtech-loramac/patches/0001-adapt-for-RIOT.patch deleted file mode 100644 index ab230c8784..0000000000 Binary files a/pkg/semtech-loramac/patches/0001-adapt-for-RIOT.patch and /dev/null differ diff --git a/pkg/semtech-loramac/patches/0001-adapt-to-riot.patch b/pkg/semtech-loramac/patches/0001-adapt-to-riot.patch new file mode 100644 index 0000000000..5e55a3ff4c Binary files /dev/null and b/pkg/semtech-loramac/patches/0001-adapt-to-riot.patch differ diff --git a/pkg/semtech-loramac/patches/0002-adapt-utilities-to-riot.patch b/pkg/semtech-loramac/patches/0002-adapt-utilities-to-riot.patch new file mode 100644 index 0000000000..da3d93773a Binary files /dev/null and b/pkg/semtech-loramac/patches/0002-adapt-utilities-to-riot.patch differ diff --git a/pkg/semtech-loramac/patches/0002-eu868-join-retries.patch b/pkg/semtech-loramac/patches/0002-eu868-join-retries.patch deleted file mode 100644 index 6365d3698d..0000000000 Binary files a/pkg/semtech-loramac/patches/0002-eu868-join-retries.patch and /dev/null differ diff --git a/pkg/semtech-loramac/patches/0003-adapt-utilities-functions.patch b/pkg/semtech-loramac/patches/0003-adapt-utilities-functions.patch deleted file mode 100644 index 9b03b14d18..0000000000 Binary files a/pkg/semtech-loramac/patches/0003-adapt-utilities-functions.patch and /dev/null differ diff --git a/pkg/semtech-loramac/patches/0004-fix-uninitialized-variable.patch b/pkg/semtech-loramac/patches/0004-fix-uninitialized-variable.patch deleted file mode 100644 index a69b379762..0000000000 Binary files a/pkg/semtech-loramac/patches/0004-fix-uninitialized-variable.patch and /dev/null differ