diff options
author | Harsh Sharma <harsh.sharma@multitech.com> | 2018-06-13 15:27:52 -0500 |
---|---|---|
committer | Harsh Sharma <harsh.sharma@multitech.com> | 2018-06-13 15:27:52 -0500 |
commit | dbe7ab10123eda8a4aaba5f66476da73e84a465f (patch) | |
tree | af463d01235c40a27b6926ac36c5e6e9c317ee14 /libloragw/src/loragw_reg.c | |
parent | 04036d3f88d5fa2077cbd9f3c59c1f2811b08ae3 (diff) | |
download | lora_gateway_mtac_full-dbe7ab10123eda8a4aaba5f66476da73e84a465f.tar.gz lora_gateway_mtac_full-dbe7ab10123eda8a4aaba5f66476da73e84a465f.tar.bz2 lora_gateway_mtac_full-dbe7ab10123eda8a4aaba5f66476da73e84a465f.zip |
Revert "Compiler warning fixes"
This reverts commit 04036d3f88d5fa2077cbd9f3c59c1f2811b08ae3
Diffstat (limited to 'libloragw/src/loragw_reg.c')
-rw-r--r-- | libloragw/src/loragw_reg.c | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/libloragw/src/loragw_reg.c b/libloragw/src/loragw_reg.c index 4d689da..aef9749 100644 --- a/libloragw/src/loragw_reg.c +++ b/libloragw/src/loragw_reg.c @@ -407,6 +407,30 @@ int page_switch(uint8_t target) { /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ +bool check_fpga_version(uint8_t version) { + int i; + + for (i = 0; i < (int)(sizeof FPGA_VERSION); i++) { + if (FPGA_VERSION[i] == version ) { + return true; + } + } + + return false; +} + +uint8_t read_fpga_version() { + uint8_t u = 0; + uint8_t spi_stat = lgw_spi_r(lgw_spi_target, LGW_SPI_MUX_MODE1, LGW_SPI_MUX_TARGET_FPGA, loregs[LGW_VERSION].addr, &u); + if (spi_stat != LGW_SPI_SUCCESS) { + DEBUG_MSG("ERROR READING VERSION REGISTER\n"); + return LGW_REG_ERROR; + } + return u; +} + +/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ + int reg_w_align32(void *spi_target, uint8_t spi_mux_mode, uint8_t spi_mux_target, struct lgw_reg_s r, int32_t reg_value) { int spi_stat = LGW_REG_SUCCESS; int i, size_byte; @@ -486,30 +510,6 @@ int reg_r_align32(void *spi_target, uint8_t spi_mux_mode, uint8_t spi_mux_target /* -------------------------------------------------------------------------- */ /* --- PUBLIC FUNCTIONS DEFINITION ------------------------------------------ */ -/* Read the FPGA version */ -uint8_t read_fpga_version() { - uint8_t u = 0; - uint8_t spi_stat = lgw_spi_r(lgw_spi_target, LGW_SPI_MUX_MODE1, LGW_SPI_MUX_TARGET_FPGA, loregs[LGW_VERSION].addr, &u); - if (spi_stat != LGW_SPI_SUCCESS) { - DEBUG_MSG("ERROR READING VERSION REGISTER\n"); - return LGW_REG_ERROR; - } - return u; -} - -/* Verify the FPGA version is supported */ -bool check_fpga_version(uint8_t version) { - int i; - - for (i = 0; i < (int)(sizeof FPGA_VERSION); i++) { - if (FPGA_VERSION[i] == version ) { - return true; - } - } - - return false; -} - /* Concentrator connect */ int lgw_connect(bool spi_only, uint32_t tx_notch_freq) { int spi_stat = LGW_SPI_SUCCESS; |