diff options
Diffstat (limited to 'libloragw/src/loragw_fpga.c')
-rw-r--r-- | libloragw/src/loragw_fpga.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/libloragw/src/loragw_fpga.c b/libloragw/src/loragw_fpga.c index 832152b..c2cb305 100644 --- a/libloragw/src/loragw_fpga.c +++ b/libloragw/src/loragw_fpga.c @@ -130,7 +130,7 @@ float lgw_fpga_get_tx_notch_delay(void) { /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ -int lgw_fpga_configure(uint32_t tx_notch_freq) { +int lgw_fpga_configure(uint32_t tx_notch_freq, bool fpga_attn_used) { int x; int32_t val; bool spectral_scan_support, lbt_support; @@ -175,6 +175,19 @@ int lgw_fpga_configure(uint32_t tx_notch_freq) { DEBUG_MSG("ERROR: Failed to configure FPGA polarity\n"); return LGW_REG_ERROR; } + /* Set Attenuator mode to be used or not depending on if a full card with valid conf settings are given*/ + if (fpga_version == 32) { + printf("INFO: Full Card with FPGA version %u detected\n", fpga_version); + if (fpga_attn_used == true) { + lgw_reg_w(LGW_FPGA_RF_ATTN_MODE, 0); + printf("INFO: Valid config detected. Using Attenuator mode\n"); + } else { + printf("INFO: Invalid config detected. Using Legacy mode\n"); + lgw_reg_w(LGW_FPGA_RF_ATTN_MODE, 1); + } + } else { + lgw_reg_w(LGW_FPGA_RF_ATTN_MODE, 1); + } } /* Configure TX notch filter */ |