]> git.rkrishnan.org Git - pihpsdr.git/commitdiff
radioberry using protocol-1
authorpa3gsb <pa3gsb@gmail.com>
Tue, 22 May 2018 17:26:16 +0000 (19:26 +0200)
committerpa3gsb <pa3gsb@gmail.com>
Tue, 22 May 2018 17:26:16 +0000 (19:26 +0200)
20 files changed:
Makefile
audio.c
discovery.c
exit_menu.c
general_menu.c
gpio.c
main.c
radio.c
radioberry.c [deleted file]
radioberry.c.orig [deleted file]
radioberry.h [deleted file]
radioberry_discovery.c [deleted file]
radioberry_discovery.h [deleted file]
receiver.c
rx_menu.c
sliders.c
toolbar.c
transmitter.c
tx_menu.c
vfo.c

index 6b3034d64d55cd2268a0b7a7315f38e93f6ee37c..cc96230fb06c1e38d1a5183c45c6989b68267625 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,7 @@ GIT_DATE := $(firstword $(shell git --no-pager show --date=short --format="%ai"
 GIT_VERSION := $(shell git describe --abbrev=0 --tags)
 
 # uncomment the line below to include GPIO
-GPIO_INCLUDE=GPIO
+#GPIO_INCLUDE=GPIO
 
 # uncomment the line below to include MCP23017 I2C
 #I2C_INCLUDE=I2C
@@ -80,24 +80,12 @@ endif
 # uncomment the line below for LimeSDR (uncomment line below)
 #LIMESDR_INCLUDE=LIMESDR
 
-# uncomment the line below when Radioberry radio cape is plugged in
-#RADIOBERRY_INCLUDE=RADIOBERRY
-
+# uncomment the line below when Radioberry radio cape is plugged in (for now use emulator and old protocol)
+RADIOBERRY_INCLUDE=RADIOBERRY
 ifeq ($(RADIOBERRY_INCLUDE),RADIOBERRY)
 RADIOBERRY_OPTIONS=-D RADIOBERRY
-RADIOBERRYLIBS=-lpigpio
-RADIOBERRY_SOURCES= \
-radioberry_discovery.c \
-radioberry.c
-RADIOBERRY_HEADERS= \
-radioberry_discovery.h \
-radioberry.h
-RADIOBERRY_OBJS= \
-radioberry_discovery.o \
-radioberry.o
 endif
 
-
 ifeq ($(LIMESDR_INCLUDE),LIMESDR)
 LIMESDR_OPTIONS=-D LIMESDR
 SOAPYSDRLIBS=-lSoapySDR
@@ -191,9 +179,9 @@ GTKLIBS=`pkg-config --libs gtk+-3.0`
 AUDIO_LIBS=-lasound
 #AUDIO_LIBS=-lsoundio
 
-OPTIONS=-g -Wno-deprecated-declarations $(PURESIGNAL_OPTIONS) $(REMOTE_OPTIONS) $(RADIOBERRY_OPTIONS) $(USBOZY_OPTIONS) $(I2C_OPTIONS) $(GPIO_OPTIONS) $(LIMESDR_OPTIONS) $(FREEDV_OPTIONS) $(LOCALCW_OPTIONS) $(PSK_OPTIONS) $(STEMLAB_OPTIONS) -D GIT_DATE='"$(GIT_DATE)"' -D GIT_VERSION='"$(GIT_VERSION)"' $(DEBUG_OPTION) -O3
+OPTIONS=-g -Wno-deprecated-declarations $(PURESIGNAL_OPTIONS) $(REMOTE_OPTIONS) $(USBOZY_OPTIONS) $(I2C_OPTIONS) $(GPIO_OPTIONS) $(LIMESDR_OPTIONS) $(FREEDV_OPTIONS) $(LOCALCW_OPTIONS) $(RADIOBERRY_OPTIONS) $(PSK_OPTIONS) $(STEMLAB_OPTIONS) -D GIT_DATE='"$(GIT_DATE)"' -D GIT_VERSION='"$(GIT_VERSION)"' $(DEBUG_OPTION) -O3
 
-LIBS=-lrt -lm -lwdsp -lpthread $(AUDIO_LIBS) $(USBOZY_LIBS) $(PSKLIBS) $(GTKLIBS) $(GPIO_LIBS) $(RADIOBERRYLIBS) $(SOAPYSDRLIBS) $(FREEDVLIBS) $(STEMLAB_LIBS)
+LIBS=-lrt -lm -lwdsp -lpthread $(AUDIO_LIBS) $(USBOZY_LIBS) $(PSKLIBS) $(GTKLIBS) $(GPIO_LIBS) $(SOAPYSDRLIBS) $(FREEDVLIBS) $(STEMLAB_LIBS)
 INCLUDES=$(GTKINCLUDES)
 
 COMPILE=$(CC) $(OPTIONS) $(INCLUDES)
@@ -411,10 +399,10 @@ led.o \
 ext.o \
 error_handler.o
 
-$(PROGRAM):  $(OBJS) $(REMOTE_OBJS) $(USBOZY_OBJS) $(LIMESDR_OBJS) $(FREEDV_OBJS) $(LOCALCW_OBJS) $(I2C_OBJS) $(GPIO_OBJS) $(PSK_OBJS) $(RADIOBERRY_OBJS)  $(PURESIGNAL_OBJS) $(STEMLAB_OBJS)
-       $(LINK) -o $(PROGRAM) $(OBJS) $(REMOTE_OBJS) $(USBOZY_OBJS) $(I2C_OBJS) $(GPIO_OBJS) $(LIMESDR_OBJS) $(FREEDV_OBJS) $(LOCALCW_OBJS) $(PSK_OBJS) $(LIBS) $(RADIOBERRY_OBJS) $(PURESIGNAL_OBJS) $(STEMLAB_OBJS)
+$(PROGRAM):  $(OBJS) $(REMOTE_OBJS) $(USBOZY_OBJS) $(LIMESDR_OBJS) $(FREEDV_OBJS) $(LOCALCW_OBJS) $(I2C_OBJS) $(GPIO_OBJS) $(PSK_OBJS) $(PURESIGNAL_OBJS) $(STEMLAB_OBJS)
+       $(LINK) -o $(PROGRAM) $(OBJS) $(REMOTE_OBJS) $(USBOZY_OBJS) $(I2C_OBJS) $(GPIO_OBJS) $(LIMESDR_OBJS) $(FREEDV_OBJS) $(LOCALCW_OBJS) $(PSK_OBJS) $(LIBS) $(PURESIGNAL_OBJS) $(STEMLAB_OBJS)
 
-all: prebuild  $(PROGRAM) $(HEADERS) $(REMOTE_HEADERS) $(RADIOBERRY_HEADERS) $(USBOZY_HEADERS) $(LIMESDR_HEADERS) $(FREEDV_HEADERS) $(LOCALCW_HEADERS) $(I2C_HEADERS) $(GPIO_HEADERS) $(PSK_HEADERS) $(PURESIGNAL_HEADERS) $(STEMLAB_HEADERS) $(SOURCES) $(REMOTE_SOURCES) $(USBOZY_SOURCES) $(LIMESDR_SOURCES) $(FREEDV_SOURCES) $(I2C_SOURCES) $(GPIO_SOURCES) $(PSK_SOURCES) $(RADIOBERRY_SOURCES) $(PURESIGNAL_SOURCES) $(STEMLAB_SOURCES)
+all: prebuild  $(PROGRAM) $(HEADERS) $(REMOTE_HEADERS) $(USBOZY_HEADERS) $(LIMESDR_HEADERS) $(FREEDV_HEADERS) $(LOCALCW_HEADERS) $(I2C_HEADERS) $(GPIO_HEADERS) $(PSK_HEADERS) $(PURESIGNAL_HEADERS) $(STEMLAB_HEADERS) $(SOURCES) $(REMOTE_SOURCES) $(USBOZY_SOURCES) $(LIMESDR_SOURCES) $(FREEDV_SOURCES) $(I2C_SOURCES) $(GPIO_SOURCES) $(PSK_SOURCES) $(PURESIGNAL_SOURCES) $(STEMLAB_SOURCES)
 
 prebuild:
        rm -f version.o
diff --git a/audio.c b/audio.c
index cb668d5ce9e1270db714f731cae6731533c126c1..923685aa968bf54cedd439073e8d97235610d20b 100644 (file)
--- a/audio.c
+++ b/audio.c
@@ -33,9 +33,6 @@
 
 #include "new_protocol.h"
 #include "old_protocol.h"
-#ifdef RADIOBERRY
-#include "radioberry.h"
-#endif
 #include "radio.h"
 #include "receiver.h"
 #include "audio.h"
@@ -198,11 +195,6 @@ fprintf(stderr,"audio_open_input: %d\n",transmitter->input_device);
     case NEW_PROTOCOL:
       mic_buffer_size = 64;
       break;
-#ifdef RADIOBERRY
-       case RADIOBERRY_PROTOCOL:
-               mic_buffer_size = 1024;
-               break;
-#endif
     default:
       break;
   }
@@ -432,11 +424,6 @@ fprintf(stderr,"mic_read_thread: mic_buffer_size=%d\n",mic_buffer_size);
         case NEW_PROTOCOL:
           new_protocol_process_local_mic(mic_buffer,1);
           break;
-#ifdef RADIOBERRY
-               case RADIOBERRY_PROTOCOL:
-                       radioberry_protocol_process_local_mic(mic_buffer,1);
-                       break;
-#endif
         default:
           break;
       }
index b4f7caaf84bee4e84c00e1d4a3f561392a0f90bc..1acc19c21b515b4b086187a4789c976fb7f51f5f 100644 (file)
 #ifdef USBOZY
 #include "ozyio.h"
 #endif
-#ifdef RADIOBERRY
-#include "radioberry_discovery.h"
-#endif
-#ifdef RADIOBERRY
-#include "radioberry.h"
-#endif
 #ifdef REMOTE
 #include "remote_radio.h"
 #endif
@@ -133,13 +127,8 @@ fprintf(stderr,"discovery\n");
   lime_discovery();
 #endif
 
-#ifdef RADIOBERRY
-      status_text("Radioberry SDR ... Discovering Device");
-      radioberry_discovery();
-#endif
   status_text("Discovery");
-
-
+  
   if(devices==0) {
     gdk_window_set_cursor(gtk_widget_get_window(top_window),gdk_cursor_new(GDK_ARROW));
     discovery_dialog = gtk_dialog_new();
@@ -243,11 +232,6 @@ fprintf(stderr,"%p Protocol=%d name=%s\n",d,d->protocol,d->name);
                         d->name);
           break;
 #endif
-#ifdef RADIOBERRY
-                               case RADIOBERRY_PROTOCOL:
-                                       sprintf(text,"%s\n",d->name);
-                               break;
-#endif
 #ifdef STEMLAB_DISCOVERY
         case STEMLAB_PROTOCOL:
           sprintf(text, "STEMlab (%02X:%02X:%02X:%02X:%02X:%02X) on %s",
index 409ef13ea4b514ded001f3cd8cae5e897c775dff..aa3f2857b4d70eaf4b1bb9ac02ce9034af3fd27e 100644 (file)
@@ -67,11 +67,6 @@ static gboolean exit_cb (GtkWidget *widget, GdkEventButton *event, gpointer data
     case LIMESDR_PROTOCOL:
       lime_protocol_stop();
       break;
-#endif
-#ifdef RADIOBERRY
-       case RADIOBERRY_PROTOCOL:
-               radioberry_protocol_stop();
-               break;
 #endif
   }
   radioSaveState();
@@ -93,11 +88,6 @@ static gboolean reboot_cb (GtkWidget *widget, GdkEventButton *event, gpointer da
     case LIMESDR_PROTOCOL:
       lime_protocol_stop();
       break;
-#endif
-#ifdef RADIOBERRY
-       case RADIOBERRY_PROTOCOL:
-               radioberry_protocol_stop();
-               break;
 #endif
   }
   radioSaveState();
@@ -120,11 +110,6 @@ static gboolean shutdown_cb (GtkWidget *widget, GdkEventButton *event, gpointer
     case LIMESDR_PROTOCOL:
       lime_protocol_stop();
       break;
-#endif
-#ifdef RADIOBERRY
-       case RADIOBERRY_PROTOCOL:
-               radioberry_protocol_stop();
-               break;
 #endif
   }
   radioSaveState();
index 9645c55433a5b9174a65914b8c20ced4301a2e79..91685446f3106f7a0e7295e96ba2bd67b430a9f8 100644 (file)
@@ -186,12 +186,7 @@ void general_menu(GtkWidget *parent) {
   gtk_grid_attach(GTK_GRID(grid),vfo_divisor,4,2,1,1);
   g_signal_connect(vfo_divisor,"value_changed",G_CALLBACK(vfo_divisor_value_changed_cb),NULL);
 
-  if(protocol==ORIGINAL_PROTOCOL || protocol==NEW_PROTOCOL
-#ifdef RADIOBERRY
-  || protocol==RADIOBERRY_PROTOCOL) {
-#else
-       ){
-#endif  
+  if(protocol==ORIGINAL_PROTOCOL || protocol==NEW_PROTOCOL){
 
     if((protocol==NEW_PROTOCOL && device==NEW_DEVICE_ORION) ||
        (protocol==NEW_PROTOCOL && device==NEW_DEVICE_ORION2) ||
@@ -218,10 +213,7 @@ void general_menu(GtkWidget *parent) {
       gtk_grid_attach(GTK_GRID(grid),bias_b,3,4,1,1);
       g_signal_connect(bias_b,"toggled",G_CALLBACK(bias_cb),NULL);
     }
-
-#ifdef RADIOBERRY
-  if (protocol==ORIGINAL_PROTOCOL || protocol==NEW_PROTOCOL) {
-#endif  
     GtkWidget *alex_b=gtk_check_button_new_with_label("ALEX");
     gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (alex_b), filter_board==ALEX);
     gtk_grid_attach(GTK_GRID(grid),alex_b,1,1,1,1);
@@ -232,20 +224,12 @@ void general_menu(GtkWidget *parent) {
 
     g_signal_connect(alex_b,"toggled",G_CALLBACK(alex_cb),apollo_b);
     g_signal_connect(apollo_b,"toggled",G_CALLBACK(apollo_cb),alex_b);
-#ifdef RADIOBERRY
-       }
-#endif 
   }
 
   GtkWidget *sample_rate_label=gtk_label_new("Sample Rate:");
   gtk_grid_attach(GTK_GRID(grid),sample_rate_label,0,1,1,1);
 
-  if(protocol==ORIGINAL_PROTOCOL || protocol==NEW_PROTOCOL
- #ifdef RADIOBERRY
-  || protocol==RADIOBERRY_PROTOCOL) {
-#else
-       ){
-#endif  
+  if(protocol==ORIGINAL_PROTOCOL || protocol==NEW_PROTOCOL){
     GtkWidget *sample_rate_48=gtk_radio_button_new_with_label(NULL,"48000");
     gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sample_rate_48), sample_rate==48000);
     gtk_grid_attach(GTK_GRID(grid),sample_rate_48,0,2,1,1);
diff --git a/gpio.c b/gpio.c
index 3aeff645364f1f8a7f2f91d81a8b4ef6d67ecc36..b11ad53542369b3c09dbdd7569a6ea07285d5a6d 100644 (file)
--- a/gpio.c
+++ b/gpio.c
@@ -62,9 +62,6 @@
 
 int settle_time=DEFAULT_SETTLE_TIME;
 static gint release_timer=-1;
-#ifdef RADIOBERRY
-#include <pigpio.h>
-#endif
 
 #ifdef CONTROLLER2
 
@@ -1001,13 +998,6 @@ int gpio_init() {
   gpio_restore_state();
 
   wiringPiSetup(); // use WiringPi pin numbers
-#ifdef RADIOBERRY 
-       if (gpioInitialise() < 0) {
-               fprintf(stderr,"radioberry_protocol: gpio could not be initialized. \n");
-               exit(-1);
-       }
-#endif
 
   if(ENABLE_VFO_ENCODER) {
 #ifdef CONTROLLER2
diff --git a/main.c b/main.c
index 16628ff65eb38330b524066b6af1d58d2939423f..b17a210a2f8c85f0189926c4fad802bb419c09b3 100644 (file)
--- a/main.c
+++ b/main.c
@@ -37,9 +37,6 @@
 #include "discovered.h"
 #include "configure.h"
 #include "gpio.h"
-#ifdef RADIOBERRY
-#include "radioberry.h"
-#endif
 #include "wdsp.h"
 #include "new_menu.h"
 #include "radio.h"
@@ -113,11 +110,6 @@ gboolean main_delete (GtkWidget *widget) {
       case LIMESDR_PROTOCOL:
         lime_protocol_stop();
         break;
-#endif
-#ifdef RADIOBERRY
-      case RADIOBERRY_PROTOCOL:
-        radioberry_protocol_stop();
-        break;
 #endif
     }
     radioSaveState();
diff --git a/radio.c b/radio.c
index 8f4c9baac02c6e6874a0bcd9acd40f97cd8c3685..658c8f54ab5961fd8008d2a2712a3924d636b3be 100644 (file)
--- a/radio.c
+++ b/radio.c
@@ -45,9 +45,6 @@
 #include "new_menu.h"
 #include "new_protocol.h"
 #include "old_protocol.h"
-#ifdef RADIOBERRY
-#include "radioberry.h"
-#endif
 #include "store.h"
 #ifdef LIMESDR
 #include "lime_protocol.h"
@@ -430,11 +427,6 @@ fprintf(stderr,"title: length=%d\n", (int)strlen(text));
     case LIMESDR_PROTOCOL:
       sprintf(property_path,"limesdr.props");
       break;
-#endif
-#ifdef RADIOBERRY
-    case RADIOBERRY_PROTOCOL:
-      sprintf(property_path,"radioberry.props");
-      break;
 #endif
   }
 
@@ -579,11 +571,6 @@ fprintf(stderr,"Create %d receivers: height=%d\n",receivers,rx_height);
     case LIMESDR_PROTOCOL:
       lime_protocol_init(0,display_width,receiver[0]->sample_rate);
       break;
-#endif
-#ifdef RADIOBERRY
-       case RADIOBERRY_PROTOCOL:
-               radioberry_protocol_init(0,display_width);
-               break;
 #endif
   }
 
@@ -923,9 +910,6 @@ void setFrequency(long long f) {
   switch(protocol) {
     case NEW_PROTOCOL:
     case ORIGINAL_PROTOCOL:
-#ifdef RADIOBERRY
-       case RADIOBERRY_PROTOCOL:
-#endif
       if(vfo[v].ctun) {
         long long minf=vfo[v].frequency-(long long)(active_receiver->sample_rate/2);
         long long maxf=vfo[v].frequency+(long long)(active_receiver->sample_rate/2);
@@ -960,9 +944,6 @@ fprintf(stderr,"setFrequency: %lld\n",f);
       schedule_high_priority();
       break;
     case ORIGINAL_PROTOCOL:
-#ifdef RADIOBERRY
-       case RADIOBERRY_PROTOCOL:
-#endif
       break;
 #ifdef LIMESDR
     case LIMESDR_PROTOCOL:
@@ -1043,11 +1024,6 @@ void set_attenuation(int value) {
       case LIMESDR_PROTOCOL:
         lime_protocol_set_attenuation(value);
         break;
-#endif
-#ifdef RADIOBERRY
-      case RADIOBERRY_PROTOCOL:
-        radioberry_set_attenuation(value);
-        break;
 #endif
     }
 }
@@ -1282,7 +1258,12 @@ fprintf(stderr,"radioRestoreState: %s\n",property_path);
     if(value) adc_attenuation[0]=atoi(value);
     value=getProperty("adc_1_attenuation");
     if(value) adc_attenuation[1]=atoi(value);
-
+       
+    value=getProperty("rx1_gain_slider");
+    if(value) rx_gain_slider[0]=atoi(value);
+    value=getProperty("rx2_gain_slider");
+       if(value) rx_gain_slider[1]=atoi(value);
+       
     sem_post(&property_sem);
 }
 
@@ -1449,7 +1430,12 @@ void radioSaveState() {
     setProperty("adc_0_attenuation",value);
     sprintf(value,"%d",adc_attenuation[1]);
     setProperty("adc_1_attenuation",value);
-
+       
+       sprintf(value,"%d",rx_gain_slider[0]);
+    setProperty("rx1_gain_slider",value);
+    sprintf(value,"%d",rx_gain_slider[1]);
+    setProperty("rx2_gain_slider",value);
+       
     vfo_save_state();
     sprintf(value,"%d",receivers);
     setProperty("receivers",value);
diff --git a/radioberry.c b/radioberry.c
deleted file mode 100644 (file)
index 9678d94..0000000
+++ /dev/null
@@ -1,395 +0,0 @@
-/* Copyright (C)
-* 2017 - Johan Maas, PA3GSB
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License
-* as published by the Free Software Foundation; either version 2
-* of the License, or (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program; if not, write to the Free Software
-* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-*
-*/
-
-#include <gtk/gtk.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <semaphore.h>
-#include <pthread.h>
-#include <sys/time.h>
-
-#include <string.h>
-#include <errno.h>
-#include <math.h>
-
-#include "audio.h"
-
-#include "band.h"
-#include "channel.h"
-#include "discovered.h"
-#include "mode.h"
-#include "filter.h"
-#include "old_protocol.h"
-#include "radio.h"
-#include "toolbar.h"
-#include "vox.h"
-#include <semaphore.h>
-#ifdef PSK
-#include "psk.h"
-#endif
-#include "receiver.h"
-#include "transmitter.h"
-#include "vfo.h"
-#include <pigpio.h>
-#include "ext.h"
-
-#define SPEED_48K                 0x00
-#define SPEED_96K                 0x01
-#define SPEED_192K                0x02
-#define SPEED_384K                0x03
-
-#define RECEIVED_SAMPLES 64
-
-static GThread *radioberry_thread_id;
-static gpointer radioberry_thread(gpointer arg);
-
-static int running;
-
-static void setSampleSpeed(int r);
-static int sampleSpeed[2];
-
-unsigned char tx_iqdata[6];
-struct timeval t20;
-struct timeval t21;
-
-void spiWriter();
-void rx1_spiReader(unsigned char iqdata[]);
-void rx2_spiReader(unsigned char iqdata[]);
-
-int radioberry_attenuation = 0;
-int prev_drive_level;
-static int txcount =0;
-
-GMutex mutex_rxtx;
-
-static int rx1_spi_handler;
-static int rx2_spi_handler;
-
-
-#define HANDLER_STEADY_TIME_US 5000
-void setup_handler(int pin, gpioAlertFunc_t pAlert) {
-  gpioSetMode(pin, PI_INPUT);
-  gpioSetPullUpDown(pin,PI_PUD_UP);
-  // give time to settle to avoid false triggers
-  usleep(10000);
-  gpioSetAlertFunc(pin, pAlert);
-  gpioGlitchFilter(pin, HANDLER_STEADY_TIME_US);
-}
-
-void cwPTT_Alert(int gpio, int level, uint32_t tick) {
-       //fprintf(stderr,"radioberry ptt swith %d  0=ptt off and 1=ptt on\n", level);
-       //fprintf(stderr,"%d - %d -%d - %d\n", running, cw_breakin, transmitter->mode, level);
-    if (running && cw_breakin && (transmitter->mode==modeCWU || transmitter->mode==modeCWL)){
-               g_idle_add(ext_mox_update,(gpointer)level);
-       }
-}
-
-float timedifference_msec(struct timeval t0, struct timeval t1)
-{
-    return (t1.tv_sec - t0.tv_sec) * 1000.0f + (t1.tv_usec - t0.tv_usec) / 1000.0f;
-}
-
-void radioberry_protocol_init(int rx,int pixels) {
-       int i;
-
-       fprintf(stderr,"\n");
-       fprintf(stderr, "====================================================================\n");
-       fprintf(stderr, "====================================================================\n");
-       fprintf(stderr, "                      Radioberry V2.0 beta 2.\n");
-       fprintf(stderr, "\n");
-       fprintf(stderr, "                    PIHPSDR plugin version 19-5-2018 \n");
-       fprintf(stderr, "\n");
-       fprintf(stderr, "\n");
-       fprintf(stderr, "                      Have fune Johan PA3GSB\n");
-       fprintf(stderr, "\n");
-       fprintf(stderr, "\n");
-       fprintf(stderr, "====================================================================\n");
-       fprintf(stderr, "====================================================================\n");
-
-#ifndef GPIO
-       if (gpioInitialise() < 0) {
-               fprintf(stderr,"radioberry_protocol: gpio could not be initialized. \n");
-               exit(-1);
-       }
-#endif
-       gpioSetMode(13, PI_INPUT);      //rx1_x-samples received.
-       gpioSetMode(16, PI_INPUT);      //rx2_x-samples received.
-       gpioSetMode(20, PI_INPUT); 
-       gpioSetMode(21, PI_OUTPUT); 
-       
-       setup_handler(17, cwPTT_Alert); 
-       
-       rx1_spi_handler = spiOpen(0, 15625000, 49155);  //channel 0
-       if (rx1_spi_handler < 0) {
-               fprintf(stderr,"radioberry_protocol: spi bus rx1 could not be initialized. \n");
-               exit(-1);
-       }
-       
-       rx2_spi_handler = spiOpen(1, 15625000, 49155);  //channel 1
-       if (rx2_spi_handler < 0) {
-               fprintf(stderr,"radioberry_protocol: spi bus rx2 could not be initialized. \n");
-               exit(-1);
-       }
-
-       running=1;
-       radioberry_attenuation = adc_attenuation[active_receiver->adc];
-       printf("init done \n");
-       if(transmitter->local_microphone) {
-               if(audio_open_input()!=0) {
-                 fprintf(stderr,"audio_open_input failed\n");
-                 transmitter->local_microphone=0;
-               }
-        }
-
-       radioberry_thread_id = g_thread_new( "radioberry", radioberry_thread, NULL);
-       if( ! radioberry_thread_id )
-       {
-               fprintf(stderr,"g_thread_new failed on radioberry_thread\n");
-               exit( -1 );
-       }
-       fprintf(stderr, "radioberry_thread: id=%p\n",radioberry_thread_id);
-
-}
-
-void convertToDouble(unsigned char* value, double buffer[]) {
-       
-       int left_sample;
-       int right_sample;
-       double left_sample_double;
-       double right_sample_double;
-       
-       left_sample   = (int)((signed char) value[0]) << 16;
-       left_sample  |= (int)((((unsigned char)value[1]) << 8)&0xFF00);
-       left_sample  |= (int)((unsigned char)value[2]&0xFF);
-       right_sample  = (int)((signed char) value[3]) << 16;
-       right_sample |= (int)((((unsigned char)value[4]) << 8)&0xFF00);
-       right_sample |= (int)((unsigned char)value[5]&0xFF);
-       
-       left_sample_double=(double)left_sample/8388607.0; // 24 bit sample 2^23-1
-       right_sample_double=(double)right_sample/8388607.0; // 24 bit sample 2^23-1
-       
-       buffer[0] = left_sample_double;  
-       buffer[1] = right_sample_double; 
-}
-
-static gpointer radioberry_thread(gpointer arg) {
-       fprintf(stderr, "radioberry_protocol: radioberry_thread\n");
-       
-       unsigned char iqdata[6];
-       double _iqdata[2];
-
-       while(running) {
-       
-               if (!isTransmitting()) 
-               {
-                       g_mutex_lock(&mutex_rxtx);
-                       
-                       gpioWrite(21, 0);
-                       
-                       setSampleSpeed(0);
-                       setSampleSpeed(1);
-                       
-                       if (gpioRead(13) == 1) {
-                               int i=0;
-                               for (i=0; i< RECEIVED_SAMPLES; i++) {
-                                       rx1_spiReader(iqdata);
-                                       convertToDouble(iqdata, _iqdata);
-                                       add_iq_samples(receiver[0], _iqdata[0], _iqdata[1]);
-                               }
-                       }
-                       
-                       if (receivers==2) {
-                               if (gpioRead(16) == 1) {
-                                       int i=0;
-                                       for (i=0; i< RECEIVED_SAMPLES; i++) {
-                                               rx2_spiReader(iqdata);
-                                               convertToDouble(iqdata, _iqdata);
-                                               add_iq_samples(receiver[1], _iqdata[0], _iqdata[1]);
-                                       }
-                               }
-                       }
-                       
-                       g_mutex_unlock(&mutex_rxtx);
-               }
-       }
-       
-       fprintf(stderr, "radioberry_protocol stop: radioberry_thread\n");
-}
-
-void radioberry_protocol_iq_samples(int isample,int qsample) {
-       
-               g_mutex_lock(&mutex_rxtx);
-               
-               int power=0;
-                if(tune && !transmitter->tune_use_drive) {
-            power=(int)((double)transmitter->drive_level/100.0*(double)transmitter->tune_percent);
-          } else {
-            power=transmitter->drive_level;
-          }
-               
-               tx_iqdata[0] = 0;
-               tx_iqdata[1] = power / 6.4;  // convert drive level from 0-255 to 0-39 steps of 0.5dB to control AD9866)
-               if (prev_drive_level != transmitter->drive_level) {
-                       printf("drive level %d - corrected drive level %d \n", transmitter->drive_level, tx_iqdata[1]);
-                       prev_drive_level = transmitter->drive_level; 
-               }               
-               tx_iqdata[2] = isample>>8; 
-               tx_iqdata[3] = isample;
-               tx_iqdata[4] = qsample>>8;
-               tx_iqdata[5] = qsample;
-
-               spiWriter();
-
-               g_mutex_unlock(&mutex_rxtx);
-}
-
-void *radioberry_protocol_process_local_mic(unsigned char *buffer,int le) {
-       int b;
-       short mic_sample;
-       // always 48000 samples per second
-    b=0;
-    int i;
-    for(i=0;i<1024;i++) {
-               if(le) {
-                       mic_sample = (short)((buffer[b++]&0xFF) | (buffer[b++]<<8));
-               } else {
-                       mic_sample = (short)((buffer[b++]<<8) | (buffer[b++]&0xFF));
-               }
-               add_mic_sample(transmitter,mic_sample);
-       }
-}
-
-void setSampleSpeed(int r) {
-       
-     switch(receiver[r]->sample_rate) {
-        case 48000:
-          sampleSpeed[r]=SPEED_48K;
-          break;
-        case 96000:
-          sampleSpeed[r]=SPEED_96K;
-          break;
-        case 192000:
-          sampleSpeed[r]=SPEED_192K;
-          break;
-        case 384000:
-          sampleSpeed[r]=SPEED_384K;
-          break;
-      }
-}
-
-void radioberry_set_attenuation(int attenuation) {
-       radioberry_attenuation = attenuation;
-}
-
-void radioberry_protocol_stop() {
-  
-       running=FALSE;
-
-       if (rx1_spi_handler !=0)
-               spiClose(rx1_spi_handler);
-       if (rx2_spi_handler !=0)
-               spiClose(rx2_spi_handler);
-
-       gpioTerminate();
-       
-}
-
-void rx1_spiReader(unsigned char iqdata[]) {
-       
-       long long rxFrequency=vfo[0].frequency-vfo[0].lo;
-       if(vfo[0].rit_enabled) {
-         rxFrequency+=vfo[0].rit;
-       }
-       if (active_receiver->id==0) {
-               if(vfo[0].mode==modeCWU) {
-                       rxFrequency-=(long long)cw_keyer_sidetone_frequency;
-               } else if(vfo[0].mode==modeCWL) {
-                       rxFrequency+=(long long)cw_keyer_sidetone_frequency;
-               }
-       }
-       
-       iqdata[0] = (sampleSpeed[0] & 0x03);
-       iqdata[1] = (((active_receiver->random << 6) & 0x40) | (~(radioberry_attenuation & 0x2F)));
-       iqdata[2] = ((rxFrequency >> 24) & 0xFF);
-       iqdata[3] = ((rxFrequency >> 16) & 0xFF);
-       iqdata[4] = ((rxFrequency >> 8) & 0xFF);
-       iqdata[5] = (rxFrequency & 0xFF);
-                       
-       spiXfer(rx1_spi_handler, iqdata, iqdata, 6);
-}
-
-void rx2_spiReader(unsigned char iqdata[]) {
-       
-       long long rxFrequency=vfo[1].frequency-vfo[1].lo;
-       if(vfo[1].rit_enabled) {
-         rxFrequency+=vfo[1].rit;
-       }
-       if (active_receiver->id==1) {
-               if(vfo[1].mode==modeCWU) {
-                       rxFrequency-=(long long)cw_keyer_sidetone_frequency;
-               } else if(vfo[1].mode==modeCWL) {
-                       rxFrequency+=(long long)cw_keyer_sidetone_frequency;
-               }
-       }
-       
-       iqdata[0] = (sampleSpeed[1] & 0x03);
-       iqdata[1] = 0x00;       //not used by firmware; the active receiver settings are set via rx1
-       iqdata[2] = ((rxFrequency >> 24) & 0xFF);
-       iqdata[3] = ((rxFrequency >> 16) & 0xFF);
-       iqdata[4] = ((rxFrequency >> 8) & 0xFF);
-       iqdata[5] = (rxFrequency & 0xFF);
-                       
-       spiXfer(rx2_spi_handler, iqdata, iqdata, 6);    
-}
-
-void spiWriter() {
-
-       gpioWrite(21, 1); 
-
-       while ( gpioRead(20) == 1) {};
-
-       spiXfer(rx1_spi_handler, tx_iqdata, tx_iqdata, 6);
-       
-       long long txFrequency;
-       if(split) {
-               txFrequency=vfo[VFO_B].frequency-vfo[VFO_A].lo+vfo[VFO_B].offset;
-       } else {
-               txFrequency=vfo[VFO_A].frequency-vfo[VFO_B].lo+vfo[VFO_A].offset;
-       }
-       tx_iqdata[0] = cw_keyer_speed | (cw_keyer_mode<<6);
-       tx_iqdata[1] = cw_keyer_weight | (cw_keyer_spacing<<7);
-       tx_iqdata[2] = ((txFrequency >> 24) & 0xFF);
-       tx_iqdata[3] = ((txFrequency >> 16) & 0xFF);
-       tx_iqdata[4] = ((txFrequency >> 8) & 0xFF);
-       tx_iqdata[5] = (txFrequency & 0xFF);
-                               
-       spiXfer(rx2_spi_handler, tx_iqdata, tx_iqdata, 6);
-       
-       txcount ++;
-       if (txcount == 48000) {
-               txcount = 0;
-               gettimeofday(&t21, 0);
-               float elapsd = timedifference_msec(t20, t21);
-               printf("Code tx mode spi executed in %f milliseconds.\n", elapsd);
-               gettimeofday(&t20, 0);
-       }
-}
-// end of source
diff --git a/radioberry.c.orig b/radioberry.c.orig
deleted file mode 100644 (file)
index 112c171..0000000
+++ /dev/null
@@ -1,383 +0,0 @@
-/* Copyright (C)
-* 2017 - Johan Maas, PA3GSB
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License
-* as published by the Free Software Foundation; either version 2
-* of the License, or (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program; if not, write to the Free Software
-* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-*
-*/
-
-#include <gtk/gtk.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <semaphore.h>
-#include <pthread.h>
-
-#include <string.h>
-#include <errno.h>
-#include <math.h>
-
-#include "audio.h"
-
-#include "band.h"
-#include "channel.h"
-#include "discovered.h"
-#include "mode.h"
-#include "filter.h"
-#include "old_protocol.h"
-#include "radio.h"
-#include "toolbar.h"
-#include "vox.h"
-#include <semaphore.h>
-#ifdef PSK
-#include "psk.h"
-#endif
-#include "receiver.h"
-#include "transmitter.h"
-#include "vfo.h"
-
-#include <pigpio.h>
-#include "ext.h"
-
-#define OUTPUT_BUFFER_SIZE 1024
-#define SPEED_48K                 0x00
-#define SPEED_96K                 0x01
-#define SPEED_192K                0x02
-#define SPEED_384K                0x03
-
-static int display_width;
-static int running;
-static int sampleSpeed =0;
-
-unsigned char iqdata[6];
-unsigned char tx_iqdata[6];
-
-static pthread_t radioberry_thread_id;
-static void start_radioberry_thread();
-static void *radioberry_thread(void* arg);
-
-static void setSampleSpeed();
-static void handleReceiveStream();
-
-struct timeval t0;
-struct timeval t1;
-struct timeval t10;
-struct timeval t11;
-struct timeval t20;
-struct timeval t21;
-float elapsed;
-
-#define RADIOSTATE_RX   0
-#define RADIOSTATE_TX   1
-static int radiostate = RADIOSTATE_RX;
-
-void spiWriter();
-void spiReader();
-
-
-int prev_drive_level;
-
-static int rxcount =0;
-static int txcount =0;
-
-sem_t mutex;
-
-#ifdef PSK
-static int psk_samples=0;
-static int psk_divisor=6;
-#endif
-
-static int h;
-
-
-#define HANDLER_STEADY_TIME_US 5000
-void setup_handler(int pin, gpioAlertFunc_t pAlert) {
-  gpioSetMode(pin, PI_INPUT);
-  gpioSetPullUpDown(pin,PI_PUD_UP);
-  // give time to settle to avoid false triggers
-  usleep(10000);
-  gpioSetAlertFunc(pin, pAlert);
-  gpioGlitchFilter(pin, HANDLER_STEADY_TIME_US);
-}
-
-void cwPTT_Alert(int gpio, int level, uint32_t tick) {
-       //fprintf(stderr,"radioberry ptt swith %d  0=ptt off and 1=ptt on\n", level);
-       //fprintf(stderr,"%d - %d -%d - %d\n", running, cw_breakin, transmitter->mode, level);
-    if (running && cw_breakin && (transmitter->mode==modeCWU || transmitter->mode==modeCWL)){
-               g_idle_add(ext_mox_update,(gpointer)level);
-       }
-}
-
-float timedifference_msec(struct timeval t0, struct timeval t1)
-{
-    return (t1.tv_sec - t0.tv_sec) * 1000.0f + (t1.tv_usec - t0.tv_usec) / 1000.0f;
-}
-
-void radioberry_protocol_init(int rx,int pixels) {
-       int i;
-
-       fprintf(stderr,"radioberry_protocol_init\n");
-       sem_init(&mutex, 0, 1); //mutal exlusion
-       display_width=pixels;
-       fprintf(stderr,"radioberry_protocol: buffer size: =%d\n", buffer_size);
-
-/*
-       if (gpioInitialise() < 0) {
-               fprintf(stderr,"radioberry_protocol: gpio could not be initialized. \n");
-               exit(-1);
-       }
-<<<<<<< HEAD
-*/
-  
-       gpioSetMode(13, PI_INPUT);      //rx1_FIFOEmpty
-       gpioSetMode(16, PI_INPUT);      //rx2_FIFOEmpty
-=======
-#endif  
-       gpioSetMode(13, PI_INPUT); 
->>>>>>> upstream/master
-       gpioSetMode(20, PI_INPUT); 
-       gpioSetMode(21, PI_OUTPUT); 
-       
-       setup_handler(17, cwPTT_Alert); 
-       
-   
-       h = spiOpen(0, 15625000, 49155); 
-       if (h < 0) {
-               fprintf(stderr,"radioberry_protocol: spi bus could not be initialized. \n");
-               exit(-1);
-       }
-       
-       printf("init done \n");
-  
-       setSampleSpeed();
-
-       if(transmitter->local_microphone) {
-               if(audio_open_input()!=0) {
-                 fprintf(stderr,"audio_open_input failed\n");
-                 transmitter->local_microphone=0;
-               }
-        }
-
-       start_radioberry_thread();
-}
-
-static void start_radioberry_thread() {
-  int rc;
-  fprintf(stderr,"radioberry_protocol starting radioberry thread\n");
-  rc=pthread_create(&radioberry_thread_id,NULL,radioberry_thread,NULL);
-  if(rc != 0) {
-    fprintf(stderr,"radioberry_protocol: pthread_create failed on radioberry_thread: rc=%d\n", rc);
-    exit(-1);
-  }
-}
-
-static void *radioberry_thread(void* arg) {
-       fprintf(stderr, "radioberry_protocol: radioberry_thread\n");
-       running=1;
-
-       gettimeofday(&t20, 0);
-       gettimeofday(&t0, 0);
-       
-       gpioSetMode(13, PI_INPUT); 
-       gpioSetMode(20, PI_INPUT); 
-       gpioSetMode(21, PI_OUTPUT); 
-       
-       while(running) {
-       
-               sem_wait(&mutex); 
-               
-               if (isTransmitting()) 
-                       radiostate = RADIOSTATE_TX;
-               else
-                       radiostate = RADIOSTATE_RX;
-               
-               if(radiostate == RADIOSTATE_TX) {
-                       gpioWrite(21, 1); 
-               }
-               else 
-               {
-                       gpioWrite(21, 0);
-                       spiReader();
-                       handleReceiveStream();
-                       sem_post(&mutex);
-               }
-       }
-}
-
-void radioberry_protocol_iq_samples(int isample,int qsample) {
-
-       if(radiostate == RADIOSTATE_TX) {
-       
-               tx_iqdata[0] = 0;
-               tx_iqdata[1] = transmitter->drive / 6.4;  // convert drive level from 0-255 to 0-39 )
-               if (prev_drive_level != transmitter->drive) {
-                       printf("drive level %d - corrected drive level %d \n", transmitter->drive_level, tx_iqdata[1]);
-                       prev_drive_level = transmitter->drive; 
-               }               
-               tx_iqdata[2] = isample>>8; 
-               tx_iqdata[3] = isample;
-               tx_iqdata[4] = qsample>>8;
-               tx_iqdata[5] = qsample;
-
-               spiWriter();
-               
-               sem_post(&mutex);
-       }
-
-}
-
-void *radioberry_protocol_process_local_mic(unsigned char *buffer,int le) {
-       int b;
-       short mic_sample;
-       // always 48000 samples per second
-    b=0;
-    int i;
-    for(i=0;i<1024;i++) {
-               if(le) {
-                       mic_sample = (short)((buffer[b++]&0xFF) | (buffer[b++]<<8));
-               } else {
-                       mic_sample = (short)((buffer[b++]<<8) | (buffer[b++]&0xFF));
-               }
-                if(active_receiver->freedv) {
-                 add_freedv_mic_sample(transmitter,mic_sample);
-                } else {
-                 add_mic_sample(transmitter,mic_sample);
-                }
-       }
-}
-
-static void handleReceiveStream() {
-       int left_sample;
-       int right_sample;
-       double left_sample_double;
-       double right_sample_double;
-       int r;
-  
-       left_sample   = (int)((signed char) iqdata[0]) << 16;
-       left_sample  += (int)((unsigned char)iqdata[1]) << 8;
-       left_sample  += (int)((unsigned char)iqdata[2]);
-       right_sample  = (int)((signed char) iqdata[3]) << 16;
-       right_sample += (int)((unsigned char)iqdata[4]) << 8;
-       right_sample += (int)((unsigned char)iqdata[5]);
-       
-       left_sample_double=(double)left_sample/8388607.0; // 24 bit sample 2^23-1
-    right_sample_double=(double)right_sample/8388607.0; // 24 bit sample 2^23-1
-       
-       for(r=0;r<RECEIVERS;r++) {
-               add_iq_samples(receiver[r], left_sample_double,right_sample_double);
-       }
-}
-
-void setSampleSpeed() {
-     switch(active_receiver->sample_rate) {
-        case 48000:
-          sampleSpeed=SPEED_48K;
-          break;
-        case 96000:
-          sampleSpeed=SPEED_96K;
-          break;
-        case 192000:
-          sampleSpeed=SPEED_192K;
-          break;
-        case 384000:
-          sampleSpeed=SPEED_384K;
-          break;
-      }
-}
-
-void radioberry_protocol_stop() {
-  
-       running=FALSE;
-
-       if (h !=0)
-               spiClose(h);
-               
-#ifndef GPIO 
-       gpioTerminate();
-#endif
-       
-}
-
-void spiReader() {
-       // wait till rxFIFO buffer is filled with at least one element
-       while ( gpioRead(13) == 1) {};
-       
-       setSampleSpeed();
-       
-       int v=receiver[0]->id;
-       long long rxFrequency=vfo[v].frequency-vfo[v].lo;
-       if(vfo[v].rit_enabled) {
-         rxFrequency+=vfo[v].rit;
-       }
-       if(vfo[active_receiver->id].mode==modeCWU) {
-         rxFrequency-=(long long)cw_keyer_sidetone_frequency;
-       } else if(vfo[active_receiver->id].mode==modeCWL) {
-         rxFrequency+=(long long)cw_keyer_sidetone_frequency;
-       }
-       
-       iqdata[0] = (sampleSpeed & 0x03);
-       iqdata[1] = (((active_receiver->random << 6) & 0x40) | ((active_receiver->dither <<5) & 0x20) |  (attenuation & 0x1F));
-       iqdata[2] = ((rxFrequency >> 24) & 0xFF);
-       iqdata[3] = ((rxFrequency >> 16) & 0xFF);
-       iqdata[4] = ((rxFrequency >> 8) & 0xFF);
-       iqdata[5] = (rxFrequency & 0xFF);
-                       
-       spiXfer(h, iqdata, iqdata, 6);
-       
-       //firmware: tdata(56'h00010203040506) -> 0-1-2-3-4-5-6 (element 0 contains 0; second element contains 1)
-       rxcount ++;
-       if (rxcount == 48000) {
-               rxcount = 0;
-               gettimeofday(&t1, 0);
-               elapsed = timedifference_msec(t0, t1);
-               printf("Code rx mode spi executed in %f milliseconds.\n", elapsed);
-               gettimeofday(&t0, 0);
-       }
-}
-
-void spiWriter() {
-       while ( gpioRead(20) == 1) {};
-
-<<<<<<< HEAD
-       spiXfer(rx1_spi_handler, tx_iqdata, tx_iqdata, 6);
-       
-       long long txFrequency;
-       if(split) {
-               txFrequency=vfo[VFO_B].frequency-vfo[VFO_A].lo+vfo[VFO_B].offset;
-       } else {
-               txFrequency=vfo[VFO_A].frequency-vfo[VFO_B].lo+vfo[VFO_A].offset;
-       }
-       tx_iqdata[0] = cw_keyer_speed | (cw_keyer_mode<<6);
-       tx_iqdata[1] = cw_keyer_weight | (cw_keyer_spacing<<7);
-       tx_iqdata[2] = ((txFrequency >> 24) & 0xFF);
-       tx_iqdata[3] = ((txFrequency >> 16) & 0xFF);
-       tx_iqdata[4] = ((txFrequency >> 8) & 0xFF);
-       tx_iqdata[5] = (txFrequency & 0xFF);
-                               
-       spiXfer(rx2_spi_handler, tx_iqdata, tx_iqdata, 6);
-=======
-       spiXfer(h, tx_iqdata, tx_iqdata, 6);
->>>>>>> upstream/master
-       
-       txcount ++;
-       if (txcount == 48000) {
-               txcount = 0;
-               gettimeofday(&t21, 0);
-               float elapsd = timedifference_msec(t20, t21);
-               printf("Code tx mode spi executed in %f milliseconds.\n", elapsd);
-               gettimeofday(&t20, 0);
-       }
-}
\ No newline at end of file
diff --git a/radioberry.h b/radioberry.h
deleted file mode 100644 (file)
index 383c3f1..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Copyright (C)
-* 2017 - Johan Maas, PA3GSB
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License
-* as published by the Free Software Foundation; either version 2
-* of the License, or (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program; if not, write to the Free Software
-* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-*
-*/
-
-#define BUFFER_SIZE 1024
-void radioberry_protocol_stop();
-void radioberry_protocol_init(int rx,int pixels);
-void *radioberry_protocol_process_local_mic(unsigned char *buffer,int le);
-extern void radioberry_protocol_iq_samples(int isample,int qsample);
-void radioberry_set_attenuation(int attenuation);
diff --git a/radioberry_discovery.c b/radioberry_discovery.c
deleted file mode 100644 (file)
index 322f535..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Copyright (C)
-* 2017 - Johan Maas, PA3GSB
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License
-* as published by the Free Software Foundation; either version 2
-* of the License, or (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program; if not, write to the Free Software
-* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-*
-*/
-
-#include <stdio.h>
-#include <string.h>
-#include "discovered.h"
-#include "radioberry_discovery.h"
-
-void radioberry_discovery() {
-  
-  //check availability of RADIOBERRY for instance by si570 i2c address; 
-  //for initial version when compiling with radioberry option; select it.
-  
-  
-  // setting clock and loading rbf file..... done before starting
-  
-  discovered[devices].protocol=RADIOBERRY_PROTOCOL;
-  discovered[devices].device=RADIOBERRY_SPI_DEVICE;
-  strcpy(discovered[devices].name, "RadioBerry");
-  discovered[devices].status=STATE_AVAILABLE;
-  discovered[devices].software_version=100;
-  devices++;
-}
diff --git a/radioberry_discovery.h b/radioberry_discovery.h
deleted file mode 100644 (file)
index 5afe47a..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/* Copyright (C)
-* 2017 - Johan Maas, PA3GSB
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License
-* as published by the Free Software Foundation; either version 2
-* of the License, or (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program; if not, write to the Free Software
-* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-*
-*/
-#ifndef _RADIOBERRY_DISCOVERY_H
-#define _RADIOBERRY_DISCOVERY_H
-
-void radioberry_discovery();
-
-#endif
\ No newline at end of file
index 702d4d882e00e40413fe7a57ff50835717b8c183..2ea9f1deef38a6a53871d6706ae03eb251cf5a19 100644 (file)
@@ -52,9 +52,6 @@
 #include "freedv.h"
 #endif
 #include "audio_waterfall.h"
-#ifdef RADIOBERRY
-#include "radioberry.h"
-#endif
 #include "ext.h"
 #include "new_menu.h"
 
@@ -840,13 +837,7 @@ fprintf(stderr,"create_receiver: id=%d buffer_size=%d fft_size=%d pixels=%d fps=
       }
       switch(protocol) {
         case ORIGINAL_PROTOCOL:
-#ifdef RADIOBERRY
-               case RADIOBERRY_PROTOCOL:
-#endif
           switch(device) {
-#ifdef RADIOBERRY
-                       case RADIOBERRY_SPI_DEVICE:
-#endif
             case DEVICE_METIS:
             case DEVICE_HERMES:
             case DEVICE_HERMES_LITE:                   
@@ -1186,11 +1177,6 @@ static void process_freedv_rx_buffer(RECEIVER *rx) {
 #ifdef LIMESDR
                 case LIMESDR_PROTOCOL:
                   break;
-#endif
-#ifdef RADIOBERRY
-                case RADIOBERRY_PROTOCOL:
-                  //no audio stream to radioberry hardware, using local audio of rpi.
-                  break;
 #endif
               }
             }
@@ -1269,11 +1255,6 @@ static void process_rx_buffer(RECEIVER *rx) {
 #ifdef LIMESDR
         case LIMESDR_PROTOCOL:
           break;
-#endif
-#ifdef RADIOBERRY
-       case RADIOBERRY_PROTOCOL:
-               //no audio stream to radioberry hardware, using local audio of rpi.
-               break;
 #endif
       }
 
index af86bdf8fc7457e081efae17a09c883a141a3bdf..f07574f1d96ee4faab8eed50cd78f28ec3e7e3fe 100644 (file)
--- a/rx_menu.c
+++ b/rx_menu.c
@@ -159,9 +159,6 @@ void rx_menu(GtkWidget *parent) {
   int x=0;
 
   switch(protocol) {
-#ifdef RADIOBERRY
-       case RADIOBERRY_PROTOCOL:
-#endif
     case NEW_PROTOCOL:
       {
       GtkWidget *sample_rate_label=gtk_label_new("Sample Rate");
@@ -224,9 +221,6 @@ void rx_menu(GtkWidget *parent) {
   }
 
   switch(protocol) {
-#ifdef RADIOBERRY
-       case RADIOBERRY_PROTOCOL:
-#endif
     case ORIGINAL_PROTOCOL:
     case NEW_PROTOCOL: 
       {
index 10150bc4b7c538e5cf15e2db6fa96124ada60bc1..bc6e39955a9daf254592e436bb2ad77b083ab788 100644 (file)
--- a/sliders.c
+++ b/sliders.c
@@ -140,7 +140,11 @@ static void attenuation_value_changed_cb(GtkWidget *widget, gpointer data) {
 void set_attenuation_value(double value) {
   adc_attenuation[active_receiver->adc]=(int)value;
   if(display_sliders) {
+#ifdef RADIOBERRY
+       gtk_range_set_value (GTK_RANGE(attenuation_scale),(double)rx_gain_slider[active_receiver->adc]);
+#else
     gtk_range_set_value (GTK_RANGE(attenuation_scale),(double)adc_attenuation[active_receiver->adc]);
+#endif
   } else {
     if(scale_status!=ATTENUATION) {
       if(scale_status!=NONE) {
@@ -519,10 +523,12 @@ fprintf(stderr,"sliders_init: width=%d height=%d\n", width,height);
 
 #ifdef RADIOBERRY
        attenuation_scale=gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL,0.0, 60.0, 1.0);
+       gtk_range_set_value (GTK_RANGE(attenuation_scale),rx_gain_slider[active_receiver->adc]);
 #else
        attenuation_scale=gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL,0.0, 31.0, 1.0);
+       gtk_range_set_value (GTK_RANGE(attenuation_scale),adc_attenuation[active_receiver->adc]);
 #endif
-  gtk_range_set_value (GTK_RANGE(attenuation_scale),adc_attenuation[active_receiver->adc]);
+  
   gtk_widget_show(attenuation_scale);
   gtk_grid_attach(GTK_GRID(sliders),attenuation_scale,7,0,2,1);
   g_signal_connect(G_OBJECT(attenuation_scale),"value_changed",G_CALLBACK(attenuation_value_changed_cb),NULL);
index 025d5de023c812db3f3ca8c70b55db594561c8f1..b1fc62a97a658b731b7ff30d4169aa3adac34c1d 100644 (file)
--- a/toolbar.c
+++ b/toolbar.c
@@ -46,9 +46,6 @@
 #include "property.h"
 #include "new_menu.h"
 #include "button_text.h"
-#ifdef RADIOBERRY
-#include "radioberry.h"        
-#endif
 #include "ext.h"       
 
 #define MAX_FUNCTION 3
@@ -266,11 +263,6 @@ static void vox_cb(GtkWidget *widget, gpointer data) {
 }
 
 static void stop() {
-#ifdef RADIOBERRY
-       if(protocol==RADIOBERRY_PROTOCOL) {
-               radioberry_protocol_stop();
-       }
-#endif
   if(protocol==ORIGINAL_PROTOCOL) {
     old_protocol_stop();
   } else {
index a5076e7fd6e27a7df3be99254b905ed79c3a0469..d2c12ec4eb3eb54056980e01320b4be0cc2793b4 100644 (file)
@@ -305,11 +305,7 @@ static gboolean update_display(gpointer data) {
     double constant1=3.3;
     double constant2=0.095;
 
-#ifdef RADIOBERRY
-       if(protocol==ORIGINAL_PROTOCOL || protocol==RADIOBERRY_PROTOCOL) {
-#else
        if(protocol==ORIGINAL_PROTOCOL) {
-#endif
       switch(device) {
         case DEVICE_METIS:
           constant1=3.3;
@@ -333,10 +329,6 @@ static gboolean update_display(gpointer data) {
           break;
         case DEVICE_HERMES_LITE:
           break;
-#ifdef RADIOBERRY
-               case RADIOBERRY_SPI_DEVICE:
-                       break;
-#endif
       }
 
       int power=alex_forward_power;
@@ -387,12 +379,6 @@ static gboolean update_display(gpointer data) {
           constant1=3.3;
           constant2=0.09;
           break;
-#ifdef RADIOBERRY
-               case RADIOBERRY_SPI_DEVICE:
-                       constant1=3.3;
-                       constant2=0.09;
-                       break;
-#endif
       }
 
       int power=alex_forward_power;
@@ -499,11 +485,7 @@ TRANSMITTER *create_transmitter(int id, int buffer_size, int fft_size, int fps,
   tx->fft_size=fft_size;
   tx->fps=fps;
 
-#ifdef RADIOBERRY
-       if(protocol==ORIGINAL_PROTOCOL || protocol==RADIOBERRY_PROTOCOL) {
-#else
-       if(protocol==ORIGINAL_PROTOCOL) {
-#endif
+  if(protocol==ORIGINAL_PROTOCOL) {
     tx->mic_sample_rate=48000;
     tx->mic_dsp_rate=48000;
     tx->iq_output_rate=48000;
@@ -741,9 +723,6 @@ static void full_tx_buffer(TRANSMITTER *tx) {
   int mode;
 
   switch(protocol) {
-#ifdef RADIOBERRY
-    case RADIOBERRY_PROTOCOL:
-#endif
     case ORIGINAL_PROTOCOL:
       gain=32767.0;  // 16 bit
       break;
@@ -789,11 +768,6 @@ static void full_tx_buffer(TRANSMITTER *tx) {
         case NEW_PROTOCOL:
           new_protocol_iq_samples(isample,qsample);
           break;
-#ifdef RADIOBERRY
-        case RADIOBERRY_PROTOCOL:
-          radioberry_protocol_iq_samples(isample,qsample);
-          break;
-#endif
       }
     }
   }
index ffad2a29cac59e947091c9f5fdbe47d484d23346..a746fe181fe806b771dc219848800333e8772a79 100644 (file)
--- a/tx_menu.c
+++ b/tx_menu.c
@@ -204,12 +204,7 @@ void tx_menu(GtkWidget *parent) {
   row++;
   col=0;
 
-#ifdef RADIOBERRY
-  if(protocol==ORIGINAL_PROTOCOL || protocol==NEW_PROTOCOL || protocol==RADIOBERRY_PROTOCOL) {
-#else
   if(protocol==ORIGINAL_PROTOCOL || protocol==NEW_PROTOCOL) {
-#endif
-
     micin_b=gtk_radio_button_new_with_label_from_widget(NULL,"Mic In");
     gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (micin_b), mic_linein==0);
     gtk_widget_show(micin_b);
@@ -407,11 +402,8 @@ void tx_menu(GtkWidget *parent) {
 
   gtk_widget_show_all(dialog);
 
-#ifdef RADIOBERRY
-       if(transmitter->local_microphone && (protocol==ORIGINAL_PROTOCOL || protocol==NEW_PROTOCOL || protocol==RADIOBERRY_PROTOCOL)) {
-#else
-       if(transmitter->local_microphone && (protocol==ORIGINAL_PROTOCOL || protocol==NEW_PROTOCOL)) {
-#endif
+
+  if(transmitter->local_microphone && (protocol==ORIGINAL_PROTOCOL || protocol==NEW_PROTOCOL)) {
     gtk_widget_hide(linein_b);
     gtk_widget_hide(micboost_b);
   }
diff --git a/vfo.c b/vfo.c
index 4666596f786e4571309e3d1af20f0ab124732c87..61262d8623b90ec5b676b5ac8b22458fc1dbf747 100644 (file)
--- a/vfo.c
+++ b/vfo.c
@@ -49,9 +49,6 @@
 #include "wdsp.h"
 #include "new_menu.h"
 #include "rigctl.h"
-#ifdef RADIOBERRY
-#include "radioberry.h"
-#endif
 #include "ext.h"
 #ifdef FREEDV
 #include "freedv.h"