summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarsh Sharma <harsh.sharma@multitech.com>2020-01-24 15:31:21 -0600
committerHarsh Sharma <harsh.sharma@multitech.com>2020-01-24 15:31:21 -0600
commitc08bf1d60c88179d791678a2db6db61f87fea032 (patch)
tree080bd58ec0981c2d09ae8697d2df296937ec3275
parenta9459f3548725e50b6d22ad04074fe2610be8808 (diff)
downloadlora_gateway_mtac_full-c08bf1d60c88179d791678a2db6db61f87fea032.tar.gz
lora_gateway_mtac_full-c08bf1d60c88179d791678a2db6db61f87fea032.tar.bz2
lora_gateway_mtac_full-c08bf1d60c88179d791678a2db6db61f87fea032.zip
Added spi device option to util spectral scan
-rw-r--r--util_spectral_scan/src/util_spectral_scan.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/util_spectral_scan/src/util_spectral_scan.c b/util_spectral_scan/src/util_spectral_scan.c
index cbc8377..91a358f 100644
--- a/util_spectral_scan/src/util_spectral_scan.c
+++ b/util_spectral_scan/src/util_spectral_scan.c
@@ -37,6 +37,7 @@ Maintainer: Michael Coracin
#include "loragw_hal.h"
#include "loragw_radio.h"
#include "loragw_fpga.h"
+#include "loragw_spi.h"
/* -------------------------------------------------------------------------- */
/* --- MACROS & CONSTANTS --------------------------------------------------- */
@@ -116,7 +117,7 @@ int main( int argc, char ** argv )
float rssi_thresh[] = {0.1,0.3,0.5,0.8,1};
/* Parse command line options */
- while((i = getopt(argc, argv, "hf:n:b:l:o:")) != -1) {
+ while((i = getopt(argc, argv, "hf:n:b:l:o:p:")) != -1) {
switch (i) {
case 'h':
printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
@@ -126,6 +127,7 @@ int main( int argc, char ** argv )
printf(" -n <uint> Total number of RSSI points [1..65535]\n");
printf(" -o <int> Offset in dB to be applied to the SX127x RSSI [-128..127]\n");
printf(" -l <char> Log file name\n");
+ printf(" -p <char> path of SPIDEV e.g. /dev/spidev0.0\n");
printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
return EXIT_SUCCESS;
@@ -206,6 +208,16 @@ int main( int argc, char ** argv )
}
break;
+ case 'p': /* -p <char> Path for spi device */
+ j = sscanf(optarg, "%s", arg_s);
+ if (j != 1) {
+ printf("ERROR: argument parsing of -p argument. -h for help.\n");
+ return EXIT_FAILURE;
+ } else {
+ lgw_spi_set_path(arg_s);
+ }
+ break;
+
default:
printf("ERROR: argument parsing options. -h for help.\n");
return EXIT_FAILURE;