diff options
-rw-r--r-- | VERSION | 2 | ||||
-rw-r--r-- | libloragw/Makefile | 15 | ||||
-rw-r--r-- | libloragw/library.cfg | 7 | ||||
-rw-r--r-- | libloragw/src/loragw_hal.c | 35 | ||||
-rw-r--r-- | readme.md | 4 |
5 files changed, 57 insertions, 6 deletions
@@ -1 +1 @@ -1.4.1
\ No newline at end of file +1.5.0
\ No newline at end of file diff --git a/libloragw/Makefile b/libloragw/Makefile index 1e2d872..f6ba783 100644 --- a/libloragw/Makefile +++ b/libloragw/Makefile @@ -98,6 +98,18 @@ else CFG_BRD_OPT := CFG_BRD_NONE endif +ifeq ($(CFG_NET),private) + CFG_NET_MSG := Private network + CFG_NET_OPT := CFG_NET_PRIVATE +else ifeq ($(CFG_NET),lora_mac) + CFG_NET_MSG := LoRa MAC network + CFG_NET_OPT := CFG_NET_LORAMAC +else + $(warning [Warning] No network type selected, assume private network by default.) + CFG_NET_MSG := Private network + CFG_NET_OPT := CFG_NET_PRIVATE +endif + ### linking options ifeq ($(CFG_SPI),native) @@ -142,6 +154,9 @@ inc/config.h: ../VERSION library.cfg # Board misc. parameters @echo "Board misc. param : $(CFG_BRD_MSG)" @echo " #define $(CFG_BRD_OPT) 1" >> $@ + # Network type + @echo "Network type : $(CFG_NET_MSG)" + @echo " #define $(CFG_NET_OPT) 1" >> $@ # Debug options @echo " #define DEBUG_AUX $(DEBUG_AUX)" >> $@ @echo " #define DEBUG_SPI $(DEBUG_SPI)" >> $@ diff --git a/libloragw/library.cfg b/libloragw/library.cfg index 34e31bb..1db5195 100644 --- a/libloragw/library.cfg +++ b/libloragw/library.cfg @@ -45,6 +45,13 @@ CFG_BAND= eu868 CFG_BRD= ref_1301_868 +### Network Type ### +# Accepted values: +# private Default +# lora_mac Only compliant with devices running LoRa MAC + +CFG_NET= private + ### Debug options ### # Set the DEBUG_* to 1 to activate debug mode in individual modules. # Warning: that makes the module *very verbose*, do not use for production diff --git a/libloragw/src/loragw_hal.c b/libloragw/src/loragw_hal.c index 5f7d141..2acef58 100644 --- a/libloragw/src/loragw_hal.c +++ b/libloragw/src/loragw_hal.c @@ -332,8 +332,16 @@ typedef struct { #define CFG_BRD_STR "brd?" #endif +#if (CFG_NET_PRIVATE == 1) + #define CFG_NET_STR "private" +#elif (CFG_NET_LORAMAC == 1) + #define CFG_NET_STR "lora_mac" +#else + #define CFG_NET_STR "network?" +#endif + /* Version string, used to identify the library version/options once compiled */ -const char lgw_version_string[] = "Version: " LIBLORAGW_VERSION "; Options: " CFG_SPI_STR " " CFG_CHIP_STR " " CFG_RADIO_STR " " CFG_BAND_STR " " CFG_BRD_STR ";"; +const char lgw_version_string[] = "Version: " LIBLORAGW_VERSION "; Options: " CFG_SPI_STR " " CFG_CHIP_STR " " CFG_RADIO_STR " " CFG_BAND_STR " " CFG_BRD_STR " " CFG_NET_STR ";"; /* -------------------------------------------------------------------------- */ /* --- PRIVATE VARIABLES ---------------------------------------------------- */ @@ -642,8 +650,13 @@ void lgw_constant_adjust(void) { // lgw_reg_w(LGW_SYNCH_DETECT_TH,1); /* default 1 */ // lgw_reg_w(LGW_ZERO_PAD,0); /* default 0 */ lgw_reg_w(LGW_SNR_AVG_CST,3); /* default 2 */ - // lgw_reg_w(LGW_FRAME_SYNCH_PEAK1_POS,1); /* default 1 */ - // lgw_reg_w(LGW_FRAME_SYNCH_PEAK2_POS,2); /* default 2 */ + #if (CFG_NET_LORAMAC == 1) + lgw_reg_w(LGW_FRAME_SYNCH_PEAK1_POS,3); /* default 1 */ + lgw_reg_w(LGW_FRAME_SYNCH_PEAK2_POS,4); /* default 2 */ + #elif (CFG_NET_PRIVATE == 1) + //lgw_reg_w(LGW_FRAME_SYNCH_PEAK1_POS,1); /* default 1 */ + //lgw_reg_w(LGW_FRAME_SYNCH_PEAK2_POS,2); /* default 2 */ + #endif // lgw_reg_w(LGW_PREAMBLE_FINE_TIMING_GAIN,1); /* default 1 */ // lgw_reg_w(LGW_ONLY_CRC_EN,1); /* default 1 */ // lgw_reg_w(LGW_PAYLOAD_FINE_TIMING_GAIN,2); /* default 2 */ @@ -658,8 +671,13 @@ void lgw_constant_adjust(void) { // lgw_reg_w(LGW_MBWSSF_FRAME_SYNCH_GAIN,1); /* default 1 */ // lgw_reg_w(LGW_MBWSSF_SYNCH_DETECT_TH,1); /* default 1 */ // lgw_reg_w(LGW_MBWSSF_ZERO_PAD,0); /* default 0 */ - // lgw_reg_w(LGW_MBWSSF_FRAME_SYNCH_PEAK1_POS,1); /* default 1 */ - // lgw_reg_w(LGW_MBWSSF_FRAME_SYNCH_PEAK2_POS,2); /* default 2 */ + #if (CFG_NET_LORAMAC == 1) + lgw_reg_w(LGW_MBWSSF_FRAME_SYNCH_PEAK1_POS,3); /* default 1 */ + lgw_reg_w(LGW_MBWSSF_FRAME_SYNCH_PEAK2_POS,4); /* default 2 */ + #elif (CFG_NET_PRIVATE == 1) + //lgw_reg_w(LGW_MBWSSF_FRAME_SYNCH_PEAK1_POS,1); /* default 1 */ + //lgw_reg_w(LGW_MBWSSF_FRAME_SYNCH_PEAK2_POS,2); /* default 2 */ + #endif // lgw_reg_w(LGW_MBWSSF_ONLY_CRC_EN,1); /* default 1 */ // lgw_reg_w(LGW_MBWSSF_PAYLOAD_FINE_TIMING_GAIN,2); /* default 2 */ // lgw_reg_w(LGW_MBWSSF_PREAMBLE_FINE_TIMING_GAIN,1); /* default 1 */ @@ -692,6 +710,13 @@ void lgw_constant_adjust(void) { /* TX LoRa */ // lgw_reg_w(LGW_TX_MODE,0); /* default 0 */ lgw_reg_w(LGW_TX_SWAP_IQ,1); /* "normal" polarity; default 0 */ + #if (CFG_NET_LORAMAC == 1) + lgw_reg_w(LGW_TX_FRAME_SYNCH_PEAK1_POS,3); /* default 1 */ + lgw_reg_w(LGW_TX_FRAME_SYNCH_PEAK2_POS,4); /* default 2 */ + #elif (CFG_NET_PRIVATE == 1) + //lgw_reg_w(LGW_TX_FRAME_SYNCH_PEAK1_POS,1); /* default 1 */ + //lgw_reg_w(LGW_TX_FRAME_SYNCH_PEAK2_POS,2); /* default 2 */ + #endif /* TX FSK */ // lgw_reg_w(LGW_FSK_TX_GAUSSIAN_EN,1); /* default 1 */ @@ -56,6 +56,10 @@ gateways as receivers. 3. Changelog ------------- +### v1.5.0 ### + +* Adding option to discriminate LoRa MAC networks from private LoRa networks at PHY level. + ### v1.4.1 ### * Enabling support for FSK per LoRa MAC specification |