commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r11515 - in gnuradio/branches/developers/eb/vrt: gr-ut


From: jblum
Subject: [Commit-gnuradio] r11515 - in gnuradio/branches/developers/eb/vrt: gr-utils/src/python vrt/lib
Date: Wed, 29 Jul 2009 12:52:01 -0600 (MDT)

Author: jblum
Date: 2009-07-29 12:52:00 -0600 (Wed, 29 Jul 2009)
New Revision: 11515

Modified:
   gnuradio/branches/developers/eb/vrt/gr-utils/src/python/qr_fft.py
   gnuradio/branches/developers/eb/vrt/vrt/lib/quadradio.cc
Log:
disable atten0 forms not in use, dont invert atten0 bits

Modified: gnuradio/branches/developers/eb/vrt/gr-utils/src/python/qr_fft.py
===================================================================
--- gnuradio/branches/developers/eb/vrt/gr-utils/src/python/qr_fft.py   
2009-07-28 23:02:18 UTC (rev 11514)
+++ gnuradio/branches/developers/eb/vrt/gr-utils/src/python/qr_fft.py   
2009-07-29 18:52:00 UTC (rev 11515)
@@ -224,7 +224,7 @@
         hbox = wx.BoxSizer(wx.HORIZONTAL)
         hbox.AddSpacer(10)
         #create slider for atten
-        forms.static_text(
+        atten0_txt_box = forms.static_text(
             label='Attenuation (0)',
             ps=self,
             key='db_ctrl_atten0',
@@ -234,7 +234,7 @@
             converter=forms.int_converter()
         )
         hbox.AddSpacer(20)
-        forms.slider(
+        atten0_slider = forms.slider(
             ps=self,
             key='db_ctrl_atten0',
             minimum=0,
@@ -269,6 +269,10 @@
             proportion=2,
         )
         hbox.AddSpacer(10)
+        def update_atten0(*args):
+            for form_obj in (atten0_txt_box, atten0_slider): 
form_obj.Enable(self['db_ctrl_bandsel'] > 'B')
+        update_atten0()
+        self.subscribe('db_ctrl_bandsel', update_atten0)
         #create checkbox for 10dB att
         #forms.check_box(
         #    label='10dB Attenuation',

Modified: gnuradio/branches/developers/eb/vrt/vrt/lib/quadradio.cc
===================================================================
--- gnuradio/branches/developers/eb/vrt/vrt/lib/quadradio.cc    2009-07-28 
23:02:18 UTC (rev 11514)
+++ gnuradio/branches/developers/eb/vrt/vrt/lib/quadradio.cc    2009-07-29 
18:52:00 UTC (rev 11515)
@@ -136,16 +136,19 @@
     return true;
 }
 
+//bit reversal, length in bits
+static int reverse_bits(int input, int len){
+    int reversed = 0;
+    for (int i = 0; i < len; i++){
+        reversed += (input & (1<<i))?(1 << (len-i-1)):0;
+    }
+    return reversed;
+}
+
 void
 vrt::quadradio::update_dboard_pins(void){
-    //reverse 5 bits in attenuation0
-    int attenuation0_rev = 0;
-    for (int i = 0; i < 5; i++){
-        attenuation0_rev += (d_attenuation0 & (1<<i))?(1 << (5-i-1)):0;
-    }
-    //printf("Atten0 %x, Atten0 Rev %x\n", d_attenuation0, attenuation0_rev);
     int db_ctrl = \
-        ((~attenuation0_rev & 0x1f) << 10) | \
+        ((reverse_bits(d_attenuation0, 5) & 0x1f) << 10) | \
         ((~d_attenuation1 & 0x1f) << 2) | \
         ((d_band_select  & 0x3)  << 7) | \
         ((d_rx_antenna & 0x1)  << 9);





reply via email to

[Prev in Thread] Current Thread [Next in Thread]