diff options
author | Harsh Sharma <harsh.sharma@multitech.com> | 2020-01-02 13:41:52 -0600 |
---|---|---|
committer | Harsh Sharma <harsh.sharma@multitech.com> | 2020-01-02 13:41:52 -0600 |
commit | 583ef0e2aa87d5e0c7ca71b3a681c801ff7b952a (patch) | |
tree | 3b9931117bf9eca8a24a730a2d0d99e8a5462cd8 /util_tx_continuous | |
parent | f870877782ba8a279580f2df0ab7c244a4849ab0 (diff) | |
download | lora_gateway_mtac_full-583ef0e2aa87d5e0c7ca71b3a681c801ff7b952a.tar.gz lora_gateway_mtac_full-583ef0e2aa87d5e0c7ca71b3a681c801ff7b952a.tar.bz2 lora_gateway_mtac_full-583ef0e2aa87d5e0c7ca71b3a681c801ff7b952a.zip |
Added spi path as a command line option for util_tx_continuous and test_loragw_spi
Diffstat (limited to 'util_tx_continuous')
-rw-r--r-- | util_tx_continuous/src/util_tx_continuous.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/util_tx_continuous/src/util_tx_continuous.c b/util_tx_continuous/src/util_tx_continuous.c index 54d77f7..b8b59e9 100644 --- a/util_tx_continuous/src/util_tx_continuous.c +++ b/util_tx_continuous/src/util_tx_continuous.c @@ -37,6 +37,7 @@ Maintainer: Matthieu Leurent #include "loragw_hal.h" #include "loragw_reg.h" #include "loragw_aux.h" +#include "loragw_spi.h" /* -------------------------------------------------------------------------- */ /* --- MACROS & CONSTANTS --------------------------------------------------- */ @@ -97,6 +98,7 @@ int main(int argc, char **argv) {"bt", 1, 0, 0}, {"notch", 1, 0, 0}, {"attn", 1, 0, 0}, + {"path", 1, 0, 0}, {0, 0, 0, 0} }; unsigned int arg_u; @@ -117,7 +119,6 @@ int main(int argc, char **argv) uint8_t fdev_khz = DEFAULT_FDEV_KHZ; uint8_t bt = DEFAULT_BT; uint32_t tx_notch_freq = DEFAULT_NOTCH_FREQ; - int32_t offset_i, offset_q; /* RF configuration (TX fail if RF chain is not enabled) */ @@ -150,6 +151,7 @@ int main(int argc, char **argv) printf(" --fdev <uint> FSK frequency deviation in kHz, [1:250]\n"); printf(" --bt <uint> FSK gaussian filter BT trim, [0:3]\n"); printf(" --attn <float> Attenuator value in dB, required LGA module or MTAC full card\n"); + printf(" --path <string> Path of SPIDEV e.g. /dev/spidev0.0\n"); printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); return EXIT_SUCCESS; break; @@ -275,7 +277,16 @@ int main(int argc, char **argv) else { g_atten = arg_u; } - } + } else if (strcmp(long_options[option_index].name,"path") == 0) { + i = sscanf(optarg, "%s", arg_s); + if ((i != 1) || (strncmp(arg_s, "/dev/", 5 ) != 0)) { + printf("ERROR: argument parsing of --path argument. Use -h to print help\n"); + return EXIT_FAILURE; + } + else { + lgw_spi_set_path(arg_s); + } + } else { printf("ERROR: argument parsing options. Use -h to print help\n"); return EXIT_FAILURE; |