]> git.rkrishnan.org Git - pihpsdr.git/commitdiff
fixes to get CW working
authorRamakrishnan Muthukrishnan <ram@leastauthority.com>
Mon, 21 Feb 2022 12:18:08 +0000 (17:48 +0530)
committerRamakrishnan Muthukrishnan <ram@leastauthority.com>
Mon, 21 Feb 2022 12:18:08 +0000 (17:48 +0530)
gpio.c

diff --git a/gpio.c b/gpio.c
index e5afe7e229ddae763c6db12acde9e5d30a8628cb..6bb2132db1bbcc8534db76056a905b5611418348 100644 (file)
--- a/gpio.c
+++ b/gpio.c
@@ -518,7 +518,7 @@ static void process_edge(int offset,int value) {
       keyer_event(1, CW_ACTIVE_LOW ? (value==PRESSED) : value);
       found=TRUE;
     } else if(offset==CWR_BUTTON) {
-      keyer_event(1, CW_ACTIVE_LOW ? (value==PRESSED) : value);
+      keyer_event(0, CW_ACTIVE_LOW ? (value==PRESSED) : value);
       found=TRUE;
     }
   }
@@ -977,6 +977,20 @@ int gpio_init() {
     goto err;
   }
 
+
+#ifdef LOCALCW
+       if(controller == NO_CONTROLLER) {
+               // radioberry plugged into the RPI
+               // GPIO is on only for LOCALCW.
+               // Users do have to choose for no controller;
+               // for local CW the following pins are set.
+               CWL_BUTTON=17;
+               CWR_BUTTON=21;
+               g_print("LOCALCW is on ; NO controller selected; CW Buttons reconfigured\n");
+       }
+       // Radioberry device driver uses GPIO ports.
+       if(controller != NO_CONTROLLER) {
+#endif
   // setup encoders
   g_print("%s: setup encoders\n",__FUNCTION__);
   for(int i=0;i<MAX_ENCODERS;i++) {
@@ -1014,6 +1028,9 @@ int gpio_init() {
       }
     }
   }
+#ifdef LOCALCW
+}
+#endif
 
   if(controller==CONTROLLER2_V1 || controller==CONTROLLER2_V2) {
     i2c_init();