diff options
author | Jason Reiss <jreiss@multitech.com> | 2019-09-25 10:21:05 -0500 |
---|---|---|
committer | Jason Reiss <jreiss@multitech.com> | 2019-09-25 10:21:05 -0500 |
commit | 6de119daaed517a0916ef889505bc6ccdaa372be (patch) | |
tree | 703f35f5f5f34e59204f9796b13d8d1f91ede900 /libloragw | |
parent | c9df9ed22788a5ebca6fef270d9377e74737be1b (diff) | |
download | lora_gateway_mtac_full-6de119daaed517a0916ef889505bc6ccdaa372be.tar.gz lora_gateway_mtac_full-6de119daaed517a0916ef889505bc6ccdaa372be.tar.bz2 lora_gateway_mtac_full-6de119daaed517a0916ef889505bc6ccdaa372be.zip |
Fix loragw reg and spi
Diffstat (limited to 'libloragw')
-rw-r--r-- | libloragw/src/loragw_reg.c | 2 | ||||
-rw-r--r-- | libloragw/src/loragw_spi.native.c | 10 |
2 files changed, 9 insertions, 3 deletions
diff --git a/libloragw/src/loragw_reg.c b/libloragw/src/loragw_reg.c index 4d689da..e707838 100644 --- a/libloragw/src/loragw_reg.c +++ b/libloragw/src/loragw_reg.c @@ -48,7 +48,7 @@ Maintainer: Sylvain Miermont #define PAGE_ADDR 0x00 #define PAGE_MASK 0x03 -const uint8_t FPGA_VERSION[] = { 28, 31, 32, 33 , 34}; /* several versions could be supported */ +const uint8_t FPGA_VERSION[] = { 28, 31, 32, 33 , 34, 35, 37 }; /* several versions could be supported */ /* auto generated register mapping for C code : 11-Jul-2013 13:20:40 diff --git a/libloragw/src/loragw_spi.native.c b/libloragw/src/loragw_spi.native.c index 4720603..2380ecb 100644 --- a/libloragw/src/loragw_spi.native.c +++ b/libloragw/src/loragw_spi.native.c @@ -56,7 +56,8 @@ Maintainer: Sylvain Miermont #define SPI_SPEED 8000000 #define SPI_DEV_PATH "/dev/spidev0.0" //#define SPI_DEV_PATH "/dev/spidev32766.0" -char spi_dev_path[60] = SPI_DEV_PATH; +//char* spi_dev_path = SPI_DEV_PATH; +static char spi_dev_path[64] = {0}; /* custom SPI device path */ /* -------------------------------------------------------------------------- */ /* --- PUBLIC FUNCTIONS DEFINITION ------------------------------------------ */ @@ -92,9 +93,14 @@ int lgw_spi_open(void **spi_target_ptr) { } /* open SPI device */ + + if (spi_dev_path[0] == '\0'){ + strncpy(spi_dev_path, SPI_DEV_PATH, sizeof(spi_dev_path)-1); //sets default path if none defined + } + dev = open(spi_dev_path, O_RDWR); if (dev < 0) { - DEBUG_PRINTF("ERROR: failed to open SPI device %s\n", SPI_DEV_PATH); + DEBUG_PRINTF("ERROR: failed to open SPI device %s\n", spi_dev_path); return LGW_SPI_ERROR; } |