]> git.rkrishnan.org Git - pihpsdr.git/commitdiff
rebased on original branch
authorPA3GSB <admin@pa3gsb.nl>
Sat, 18 Feb 2017 14:34:33 +0000 (15:34 +0100)
committerPA3GSB <admin@pa3gsb.nl>
Sat, 18 Feb 2017 14:34:33 +0000 (15:34 +0100)
13 files changed:
Makefile
audio_menu.c
discovered.h
discovery.c
radio.c
radioberry.c
radioberry.h
receiver.c
rx_menu.c
soundio.c
transmitter.c
tx_menu.c
vfo.c

index abb4e3f96196767fb104020a0172355ac1c3a3c7..5a53a9e3f22b7898e41cc0eb5564947b489f45b5 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -52,7 +52,7 @@ endif
 #LIMESDR_INCLUDE=LIMESDR
 
 # uncomment the line below when Radioberry radio cape is plugged in
-#RADIOBERRY_INCLUDE=RADIOBERRY
+RADIOBERRY_INCLUDE=RADIOBERRY
 
 ifeq ($(RADIOBERRY_INCLUDE),RADIOBERRY)
 RADIOBERRY_OPTIONS=-D RADIOBERRY
index 2826dcec09fef7f6db01369ce08a2294d190fc25..4725411b1e3fdfea80704cd5e2da134978109967 100644 (file)
@@ -160,7 +160,11 @@ void audio_menu(GtkWidget *parent) {
 
   int row=0;
 
-  if(protocol==ORIGINAL_PROTOCOL || protocol==NEW_PROTOCOL) {
+#ifdef RADIOBERRY
+       if(protocol==ORIGINAL_PROTOCOL || protocol==NEW_PROTOCOL || protocol==RADIOBERRY_PROTOCOL) {
+#else
+        if(protocol==ORIGINAL_PROTOCOL || protocol==NEW_PROTOCOL) {
+#endif  
     linein_b=gtk_check_button_new_with_label("Mic Line In (ACC connector)");
     gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (linein_b), mic_linein);
     gtk_grid_attach(GTK_GRID(grid),linein_b,0,++row,1,1);
@@ -229,7 +233,11 @@ void audio_menu(GtkWidget *parent) {
 
   gtk_widget_show_all(dialog);
 
-  if(local_microphone && (protocol==ORIGINAL_PROTOCOL || protocol==NEW_PROTOCOL)) {
+#ifdef RADIOBERRY
+       if(local_microphone && (protocol==ORIGINAL_PROTOCOL || protocol==NEW_PROTOCOL || protocol==RADIOBERRY_PROTOCOL)) {
+#else
+        if(local_microphone && (protocol==ORIGINAL_PROTOCOL || protocol==NEW_PROTOCOL)) {
+#endif
     gtk_widget_hide(linein_b);
     gtk_widget_hide(micboost_b);
   }
index 44c7f7f6a887a687f14248f1cce1bf834efdd94d..d44fcde4d5e62734b68aaa86e3e0b2e49b3db22c 100644 (file)
@@ -54,7 +54,7 @@
 #endif
 
 #ifdef RADIOBERRY
-#define RADIOBERRY_SPI_DEVICE 0
+#define RADIOBERRY_SPI_DEVICE 100
 #endif
 
 #define STATE_AVAILABLE 2
index 2781504ad9627db72f1b357366d2d1bf607d710b..fa46f028274e3a68ebe24544c891b9450652c8cf 100644 (file)
@@ -111,7 +111,7 @@ fprintf(stderr,"discovery\n");
 #endif
 
 #ifdef RADIOBERRY
-      splash_status("Radioberry SDR ... Discovering Device");
+      status_text("Radioberry SDR ... Discovering Device");
       radioberry_discovery();
 #endif
   status_text("Discovery");
diff --git a/radio.c b/radio.c
index 10e2e17a347231b519b24897ecdb2e300ca7959f..203b793b64d060889837f32cb8f50d51b6124fb3 100644 (file)
--- a/radio.c
+++ b/radio.c
@@ -41,6 +41,9 @@
 #include "property.h"
 #include "new_protocol.h"
 #include "old_protocol.h"
+#ifdef RADIOBERRY
+#include "radioberry.h"
+#endif
 #include "store.h"
 #ifdef LIMESDR
 #include "lime_protocol.h"
@@ -432,6 +435,19 @@ fprintf(stderr,"receiver %d: height=%d y=%d\n",receiver[i]->id,rx_height,y);
   transmitter=create_transmitter(CHANNEL_TX, buffer_size, fft_size, updates_per_second, display_width, tx_height);
   g_object_ref((gpointer)transmitter->panel);
 
+  
+  #ifdef GPIO
+  if(gpio_init()<0) {
+    fprintf(stderr,"GPIO failed to initialize\n");
+  }
+#ifdef LOCALCW
+  // init local keyer if enabled
+  else if (cw_keyer_internal == 0)
+    keyer_update();
+#endif
+#endif
+  
+  
   switch(radio->protocol) {
     case ORIGINAL_PROTOCOL:
       old_protocol_init(0,display_width,receiver[0]->sample_rate);
@@ -443,19 +459,15 @@ fprintf(stderr,"receiver %d: height=%d y=%d\n",receiver[i]->id,rx_height,y);
     case LIMESDR_PROTOCOL:
       lime_protocol_init(0,display_width);
       break;
+#endif
+#ifdef RADIOBERRY
+       case RADIOBERRY_PROTOCOL:
+               radioberry_protocol_init(0,display_width);
+               break;
 #endif
   }
 
-#ifdef GPIO
-  if(gpio_init()<0) {
-    fprintf(stderr,"GPIO failed to initialize\n");
-  }
-#ifdef LOCALCW
-  // init local keyer if enabled
-  else if (cw_keyer_internal == 0)
-    keyer_update();
-#endif
-#endif
+
 
 #ifdef I2C
   i2c_init();
index baa35162b5239e6b7fc7183fbb744bd6504265cf..d28925c5d2fc822454f6295a7e87f3c99ab6900a 100644 (file)
 #ifdef PSK
 #include "psk.h"
 #endif
+#include "receiver.h"
+#include "transmitter.h"
+#include "vfo.h"
 
 #include <pigpio.h>
 
-
-#define PI 3.1415926535897932F
-
 #define OUTPUT_BUFFER_SIZE 1024
 #define SPEED_48K                 0x00
 #define SPEED_96K                 0x01
 #define SPEED_192K                0x02
 #define SPEED_384K                0x03
 
-
-static int output_buffer_size;
-static int buffer_size=BUFFER_SIZE;
-
-static int receiver;
 static int display_width;
-
 static int running;
-
-static int samples=0;
-static int txsamples=0;
-
-static short tx_sample;
-static int left_tx_sample;
-static int right_tx_sample;
-
-static int left_rx_sample;
-static int right_rx_sample;
-
 static int sampleSpeed =0;
 
-static double iqinputbuffer[BUFFER_SIZE*2];
-static double micinputbuffer[BUFFER_SIZE*2];
-static double audiooutputbuffer[BUFFER_SIZE*2];
-static double micoutputbuffer[BUFFER_SIZE*2];
-
 unsigned char iqdata[6];
 unsigned char tx_iqdata[6];
 
@@ -126,47 +104,14 @@ 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_calc_buffers() {
-  switch(sample_rate) {
-    case 48000:
-      output_buffer_size=OUTPUT_BUFFER_SIZE;
-      break;
-    case 96000:
-      output_buffer_size=OUTPUT_BUFFER_SIZE/2;
-      break;
-    case 192000:
-      output_buffer_size=OUTPUT_BUFFER_SIZE/4;
-      break;
-    case 384000:
-      output_buffer_size=OUTPUT_BUFFER_SIZE/8;
-      break;
-    default:
-      fprintf(stderr,"Invalid sample rate: %d. Defaulting to 48K.\n",sample_rate);
-      break;
-  }
-}
-
-void radioberry_new_sample_rate(int rate){
-  sample_rate=rate;
-  radioberry_calc_buffers();
-  setSampleSpeed();
-  wdsp_new_sample_rate(rate);
-}
-
 void radioberry_protocol_init(int rx,int pixels) {
-  int i;
-
-  fprintf(stderr,"radioberry_protocol_init\n");
-  
-  sem_init(&mutex, 0, 1);      //mutal exlusion
-  
-  receiver=rx;
-  display_width=pixels;
-       radioberry_calc_buffers();
+       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);
+
 #ifndef GPIO 
        if (gpioInitialise() < 0) {
                fprintf(stderr,"radioberry_protocol: gpio could not be initialized. \n");
@@ -187,17 +132,13 @@ void radioberry_protocol_init(int rx,int pixels) {
        printf("init done \n");
   
        setSampleSpeed();
-       local_audio=1;
-       if(audio_open_output()!=0) {
-      fprintf(stderr,"audio_open_output failed\n");
-      local_audio=0;
-    }
-       
-       local_microphone = 1;
-    if(audio_open_input()!=0) {
-      fprintf(stderr,"audio_open_input failed\n");
-      local_microphone=0;
-    }
+
+       if(transmitter->local_microphone) {
+               if(audio_open_input()!=0) {
+                 fprintf(stderr,"audio_open_input failed\n");
+                 transmitter->local_microphone=0;
+               }
+        }
 
        start_radioberry_thread();
 }
@@ -213,11 +154,8 @@ static void start_radioberry_thread() {
 }
 
 static void *radioberry_thread(void* arg) {
-       unsigned char buffer[2048];
        fprintf(stderr, "radioberry_protocol: radioberry_thread\n");
  
-       samples = 0;
-       txsamples=0;
        running=1;
 
        gettimeofday(&t20, 0);
@@ -249,81 +187,51 @@ static void *radioberry_thread(void* arg) {
        }
 }
 
-int correctSampleValue(int value) {
+void radioberry_protocol_iq_samples(int isample,int qsample) {
 
-       if(value>32767) {
-               value=32767;
-    } else if(value<-32767) {
-      value=-32767;
-    }
+       if(radiostate == RADIOSTATE_TX) {
        
-       return value;
+               tx_iqdata[0] = 0;
+               tx_iqdata[1] = drive / 6.4;  // convert drive level from 0-255 to 0-39 )
+               if (prev_drive_level != drive) {
+                       printf("drive level %d - corrected drive level %d \n", drive_level, tx_iqdata[1]);
+                       prev_drive_level = 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;
-int leftmicsample;
-double mic_sample_double;
-double leftmicsampledouble;
-double gain=32767.0; // 2^16-1
+       int b;
+       short mic_sample;
+       // always 48000 samples per second
  
     b=0;
     int i;
     for(i=0;i<1024;i++) {
-               leftmicsample  = (int)((unsigned char)buffer[b++] & 0xFF);
-               leftmicsample  |= (int)((signed char) buffer[b++]) << 8;
-               //rightmicsample=leftmicsample;
-               
-               mic_sample_double=(1.0 / 2147483648.0) * (double)(leftmicsample<<16);
-               
-        micinputbuffer[i*2]=mic_sample_double;
-        micinputbuffer[(i*2)+1]=mic_sample_double;
-       }
-       
-       if(vox_enabled && (vox || local_microphone)) {
-               update_vox(micinputbuffer,BUFFER_SIZE);
-       }
-       
-       if(radiostate == RADIOSTATE_TX) {
-       
-               int error;
-               fexchange0(CHANNEL_TX, micinputbuffer, micoutputbuffer, &error);
-               if(error!=0) {
-                       fprintf(stderr,"fexchange0 (CHANNEL_TX) returned error: %d\n", error);
+               if(le) {
+                       mic_sample = (short)((buffer[b++]&0xFF) | (buffer[b++]<<8));
+               } else {
+                       mic_sample = (short)((buffer[b++]<<8) | (buffer[b++]&0xFF));
                }
-               Spectrum0(1, CHANNEL_TX, 0, 0, micoutputbuffer);
-
-               int j;
-               for(j=0;j<1024;j++) { 
-                       left_tx_sample=(int)(micoutputbuffer[j*2]*gain);
-                       left_tx_sample = correctSampleValue(left_tx_sample);
-                       right_tx_sample=(int)(micoutputbuffer[(j*2)+1]*gain);
-                       right_tx_sample = correctSampleValue(right_tx_sample);
-
-                       tx_iqdata[0] = 0;
-                       tx_iqdata[1] = drive / 6.4;  // convert drive level from 0-255 to 0-39 )
-                       if (prev_drive_level != drive) {
-                               printf("drive level %d - corrected drive level %d \n", drive_level, tx_iqdata[1]);
-                               prev_drive_level = drive; 
-                       }               
-                       tx_iqdata[2] = left_tx_sample>>8; 
-                       tx_iqdata[3] = left_tx_sample;
-                       tx_iqdata[4] = right_tx_sample>>8;
-                       tx_iqdata[5] = right_tx_sample;
-
-                       spiWriter();
-               }
-               sem_post(&mutex);
+               add_mic_sample(transmitter,mic_sample);
        }
 }
 
 static void handleReceiveStream() {
-       int error;
        int left_sample;
        int right_sample;
-       int mic_sample;
-       float left_sample_float;
-       float right_sample_float;
+       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;
@@ -332,57 +240,16 @@ static void handleReceiveStream() {
        right_sample += (int)((unsigned char)iqdata[4]) << 8;
        right_sample += (int)((unsigned char)iqdata[5]);
        
-       left_sample_float=(float)left_sample/8388607.0; // 24 bit sample 2^23-1
-       right_sample_float=(float)right_sample/8388607.0; // 24 bit sample 2^23-1
-       iqinputbuffer[samples*2]=(double)left_sample_float;
-       iqinputbuffer[(samples*2)+1]=(double)right_sample_float;
-       samples++;
+       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
        
-       if(samples==buffer_size) {
-               // process the input
-               fexchange0(CHANNEL_RX0, iqinputbuffer, audiooutputbuffer, &error);
-               if(error!=0) {
-                       samples=0;
-                       fprintf(stderr,"fexchange2 (CHANNEL_RX0) returned error: %d\n", error);
-               }
-               
-               if(local_audio) {
-                       int j;
-                       for(j=0;j<output_buffer_size;j++) {
-                               left_rx_sample=(short)(audiooutputbuffer[j*2]*32767.0*volume);
-                               right_rx_sample=(short)(audiooutputbuffer[(j*2)+1]*32767.0*volume);
-                               
-#ifdef PSK
-                               if(mode==modePSK) {
-                                               if(psk_samples==0) {
-                                                       psk_demod((double)((left_rx_sample+right_rx_sample)/2));
-                                               }
-                                       psk_samples++;
-                                       if(psk_samples==psk_divisor) {
-                                               psk_samples=0;
-                                       }
-                               }
-#endif 
-                               audio_write(left_rx_sample,right_rx_sample);
-                       }
-         }
-
-               //Spectrum0(1, CHANNEL_RX0, 0, 0, iqinputbuffer);
-               
-#ifdef PSK
-               if(mode!=modePSK) {
-#endif
-                       Spectrum0(1, CHANNEL_RX0, 0, 0, iqinputbuffer);
-#ifdef PSK
-               }
-#endif
-               
-               samples=0;
+       for(r=0;r<RECEIVERS;r++) {
+               add_iq_samples(receiver[r], left_sample_double,right_sample_double);
        }
 }
 
 void setSampleSpeed() {
-     switch(sample_rate) {
+     switch(active_receiver->sample_rate) {
         case 48000:
           sampleSpeed=SPEED_48K;
           break;
@@ -409,18 +276,27 @@ void radioberry_protocol_stop() {
        gpioTerminate();
 #endif
        
-       audio_close_input();
-       audio_close_output();
 }
 
 void spiReader() {
        // wait till rxFIFO buffer is filled with at least one element
        while ( gpioRead(13) == 1) {};
        
-       long long rxFrequency=ddsFrequency+(long long)rit;
+       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] = (((rx_random << 6) & 0x40) | ((rx_dither <<5) & 0x20) |  (attenuation & 0x1F));
+       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);
index 9d651ae5342bd5e190cd1f719f220df59b941032..3e8a0909bc59cd4fd7befcfe042a7c05446e448a 100644 (file)
@@ -21,4 +21,4 @@
 void radioberry_protocol_stop();
 void radioberry_protocol_init(int rx,int pixels);
 void *radioberry_protocol_process_local_mic(unsigned char *buffer,int le);
-void radioberry_new_sample_rate(int rate);
+extern void radioberry_protocol_iq_samples(int isample,int qsample);
index 221572c77080e9da7ce597aa5822068b29c0a408..b490d9c96138c449903834ff1f32f7d575258c34 100644 (file)
@@ -45,6 +45,9 @@
 #ifdef FREEDV
 #include "freedv.h"
 #endif
+#ifdef RADIOBERRY
+#include "radioberry.h"
+#endif
 
 
 #define min(x,y) (x<y?x:y)
@@ -660,10 +663,16 @@ fprintf(stderr,"create_receiver: id=%d buffer_size=%d fft_size=%d pixels=%d fps=
     default:
       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:
+            case DEVICE_HERMES_LITE:                   
               rx->adc=0;
               break;
             default:
@@ -921,6 +930,11 @@ 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
             }
           }
@@ -986,6 +1000,11 @@ 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 3d1318dccb446dbb5d26aee875af5e2b2f6fbc63..bea30fff116d70a5b9b09f228bd079ed560698d2 100644 (file)
--- a/rx_menu.c
+++ b/rx_menu.c
@@ -134,6 +134,9 @@ 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");
@@ -196,6 +199,9 @@ void rx_menu(GtkWidget *parent) {
   }
 
   switch(protocol) {
+#ifdef RADIOBERRY
+       case RADIOBERRY_PROTOCOL:
+#endif
     case ORIGINAL_PROTOCOL:
     case NEW_PROTOCOL: 
       {
index 622d54ae8196b02e77ef37694ccd02b3047dbaea..8b1f98303ab5dfecc781ab2d844e6dc46c521b96 100644 (file)
--- a/soundio.c
+++ b/soundio.c
@@ -220,6 +220,11 @@ fprintf(stderr,"audio_open_input: %d\n",n_selected_input_device);
   fprintf(stderr,"audio_open_input: selected=%d:%s\n",n_selected_input_device,selected);
   
   switch(protocol) {
+#ifdef RADIOBERRY
+    case RADIOBERRY_PROTOCOL:
+      mic_buffer_size = 1024;
+      break;
+#endif
     case ORIGINAL_PROTOCOL:
       mic_buffer_size = 720;
       break;
@@ -414,6 +419,11 @@ fprintf(stderr,"mic_read_thread: mic_buffer_size=%d\n",mic_buffer_size);
     } else {
       // process the mic input
       switch(protocol) {
+#ifdef RADIOBERRY
+               case RADIOBERRY_PROTOCOL:
+                 radioberry_protocol_iq_samples(mic_buffer,1);
+                 break;
+#endif
         case ORIGINAL_PROTOCOL:
           old_protocol_process_local_mic(mic_buffer,1);
           break;
index f4a78122d01e967d6c16e4a73623d082f840f171..0a161d34c60e1e20a740daaab60089824c7a4eaf 100644 (file)
@@ -119,7 +119,11 @@ static gint update_display(gpointer data) {
     double constant1=3.3;
     double constant2=0.095;
 
-    if(protocol==ORIGINAL_PROTOCOL) {
+#ifdef RADIOBERRY
+       if(protocol==ORIGINAL_PROTOCOL || protocol==RADIOBERRY_PROTOCOL) {
+#else
+       if(protocol==ORIGINAL_PROTOCOL) {
+#endif
       switch(device) {
         case DEVICE_METIS:
           constant1=3.3;
@@ -143,6 +147,10 @@ static gint update_display(gpointer data) {
           break;
         case DEVICE_HERMES_LITE:
           break;
+#ifdef RADIOBERRY
+               case RADIOBERRY_SPI_DEVICE:
+                       break;
+#endif
       }
 
       int power=alex_forward_power;
@@ -193,6 +201,12 @@ static gint 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;
@@ -309,7 +323,12 @@ TRANSMITTER *create_transmitter(int id, int buffer_size, int fft_size, int fps,
   tx->buffer_size=buffer_size;
   tx->fft_size=fft_size;
   tx->fps=fps;
-  if(protocol==ORIGINAL_PROTOCOL) {
+
+#ifdef RADIOBERRY
+       if(protocol==ORIGINAL_PROTOCOL || protocol==RADIOBERRY_PROTOCOL) {
+#else
+       if(protocol==ORIGINAL_PROTOCOL) {
+#endif
     tx->mic_sample_rate=48000;
 //    tx->mic_sample_rate=receiver[0]->sample_rate;
     tx->mic_dsp_rate=48000;
@@ -505,6 +524,9 @@ 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;
@@ -575,6 +597,11 @@ if(isTransmitting()) {
       case NEW_PROTOCOL:
         new_protocol_iq_samples(isample,qsample);
         break;
+#ifdef RADIOBERRY
+     case RADIOBERRY_PROTOCOL:
+        radioberry_protocol_iq_samples(isample,qsample);
+        break;
+#endif
     }
   }
   }
index e6bdfd3bc1b605e7d117551c72e6f1c9ccfb1092..c3df39f5e5961541b8b4704fffd961c8c3ed082a 100644 (file)
--- a/tx_menu.c
+++ b/tx_menu.c
@@ -163,8 +163,11 @@ void tx_menu(GtkWidget *parent) {
   row++;
   col=0;
 
-
-  if(protocol==ORIGINAL_PROTOCOL || protocol==NEW_PROTOCOL) {
+#ifdef RADIOBERRY
+       if(protocol==ORIGINAL_PROTOCOL || protocol==NEW_PROTOCOL || protocol==RADIOBERRY_PROTOCOL) {
+#else
+       if(protocol==ORIGINAL_PROTOCOL || protocol==NEW_PROTOCOL)) {
+#endif
     linein_b=gtk_check_button_new_with_label("Mic Line In (ACC connector)");
     gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (linein_b), mic_linein);
     gtk_grid_attach(GTK_GRID(grid),linein_b,col,++row,3,1);
@@ -215,7 +218,11 @@ void tx_menu(GtkWidget *parent) {
 
   gtk_widget_show_all(dialog);
 
-  if(transmitter->local_microphone && (protocol==ORIGINAL_PROTOCOL || protocol==NEW_PROTOCOL)) {
+#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
     gtk_widget_hide(linein_b);
     gtk_widget_hide(micboost_b);
   }
diff --git a/vfo.c b/vfo.c
index 58533fab3847df40b9e7d8a5ad0020257e28a4b6..0e9cea130d1999505abb4a0828e870d2935e0414 100644 (file)
--- a/vfo.c
+++ b/vfo.c
@@ -50,6 +50,9 @@
 #include "wdsp.h"
 #include "new_menu.h"
 #include "rigctl.h"
+#ifdef RADIOBERRY
+#include "radioberry.h"
+#endif
 
 static GtkWidget *parent_window;
 static int my_width;
@@ -552,7 +555,11 @@ int vfo_update(void *data) {
 
         char version[16];
         char text[128];
-        if(radio->protocol==ORIGINAL_PROTOCOL) {
+#ifdef RADIOBERRY
+        if(radio->protocol==ORIGINAL_PROTOCOL || radio->protocol==RADIOBERRY_PROTOCOL ) {
+#else
+               if(radio->protocol==ORIGINAL_PROTOCOL) {
+#endif
           switch(radio->device) {
 #ifdef USBOZY
             case DEVICE_OZY:
@@ -597,6 +604,11 @@ int vfo_update(void *data) {
             case LIMESDR_PROTOCOL:
               sprintf(text,"%s", radio->name);
               break;
+#endif
+#ifdef RADIOBERRY
+                       case RADIOBERRY_PROTOCOL:
+                               sprintf(text,"%s", radio->name);
+                               break;
 #endif
         }
         cairo_set_source_rgb(cr, 0.7, 0.7, 0.7);