From 1e66084295f37f0d7f5f0a3518e43ae0cc613898 Mon Sep 17 00:00:00 2001 From: Harsh Sharma Date: Thu, 9 Aug 2018 15:10:43 -0500 Subject: Changed attenuation setup to be the difference between the LUT power and the tx packet power and make it automatically set --- util_tx_continuous/src/util_tx_continuous.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'util_tx_continuous') diff --git a/util_tx_continuous/src/util_tx_continuous.c b/util_tx_continuous/src/util_tx_continuous.c index 79cf4b4..7768c22 100644 --- a/util_tx_continuous/src/util_tx_continuous.c +++ b/util_tx_continuous/src/util_tx_continuous.c @@ -59,6 +59,7 @@ Maintainer: Matthieu Leurent #define DEFAULT_FDEV_KHZ 25 #define DEFAULT_BT 2 #define DEFAULT_NOTCH_FREQ 129000U +#define DEFAULT_ATTENUATION 0.0 /* -------------------------------------------------------------------------- */ /* --- GLOBAL VARIABLES ----------------------------------------------------- */ @@ -95,6 +96,7 @@ int main(int argc, char **argv) {"fdev", 1, 0, 0}, {"bt", 1, 0, 0}, {"notch", 1, 0, 0}, + {"attn", 1, 0, 0}, {0, 0, 0, 0} }; unsigned int arg_u; @@ -107,6 +109,7 @@ int main(int argc, char **argv) uint8_t g_dac = DEFAULT_DAC_GAIN; uint8_t g_mix = DEFAULT_MIXER_GAIN; uint8_t g_pa = DEFAULT_PA_GAIN; + float g_atten = DEFAULT_ATTENUATION; char mod[64] = DEFAULT_MODULATION; uint8_t sf = DEFAULT_SF; unsigned int bw_khz = DEFAULT_BW_KHZ; @@ -146,6 +149,7 @@ int main(int argc, char **argv) printf(" --br FSK bitrate in kbps, [0.5:250]\n"); printf(" --fdev FSK frequency deviation in kHz, [1:250]\n"); printf(" --bt FSK gaussian filter BT trim, [0:3]\n"); + printf(" --attn Attenuator value in dB, Full Card Only [0.0:31.75]\n"); printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); return EXIT_SUCCESS; break; @@ -262,6 +266,16 @@ int main(int argc, char **argv) tx_notch_freq = (uint32_t)arg_u * 1000U; } } + else if (strcmp(long_options[option_index].name,"attn") == 0) { + i = sscanf(optarg, "%f", &arg_f); + if ((i != 1) || (arg_f < 0.0) || (arg_f > 31.75)) { + printf("ERROR: argument parsing of --br argument. Use -h to print help\n"); + return EXIT_FAILURE; + } + else { + g_atten = arg_f; + } + } else { printf("ERROR: argument parsing options. Use -h to print help\n"); return EXIT_FAILURE; @@ -349,6 +363,10 @@ int main(int argc, char **argv) txpkt.tx_mode = IMMEDIATE; txpkt.rf_chain = TX_RF_CHAIN; txpkt.rf_power = 0; + if (read_fpga_version() == 32) { + i = lgw_set_attenuation(g_atten); + } + if (strcmp(mod, "FSK") == 0) { txpkt.modulation = MOD_FSK; txpkt.datarate = br_kbps * 1e3; -- cgit v1.2.3