Changeset 9757

Show
Ignore:
Timestamp:
10/08/08 17:44:47
Author:
eb
Message:

cleanup gain initialization

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_flexrf.cc

    r9756 r9757  
    5252  _enable_refclk(false);                // disable refclk 
    5353 
    54   set_gain(float(gain_min() + gain_max()) / 2.0);  // initialize gain 
    55    
    5654  set_auto_tr(false); 
    5755} 
     
    220218} 
    221219 
    222 float 
    223 flexrf_base::gain_min() 
    224 { 
    225   return d_usrp->pga_min(); 
    226 } 
    227  
    228 float 
    229 flexrf_base::gain_max() 
    230 { 
    231   return d_usrp->pga_max(); 
    232 } 
    233  
    234 float 
    235 flexrf_base::gain_db_per_step() 
    236 { 
    237   return d_usrp->pga_db_per_step(); 
    238 } 
    239  
    240 bool 
    241 flexrf_base::set_gain(float gain) 
    242 { 
    243   /* 
    244     Set the gain. 
    245      
    246     @param gain:  gain in decibels 
    247     @returns True/False 
    248   */ 
    249   return _set_pga(gain); 
    250 } 
    251  
    252220bool 
    253221flexrf_base::_set_pga(float pga_gain) 
     
    308276  d_usrp->write_io(d_which, (power_on()|RX_TXN), (POWER_UP|RX_TXN|ENABLE)); 
    309277  set_lo_offset(4e6); 
     278 
     279  set_gain(float(gain_min() + gain_max()) / 2.0);  // initialize gain 
    310280} 
    311281 
     
    502472  */ 
    503473   
     474  // clamp gain 
     475  gain = std::max(gain_min(), std::min(gain, gain_max())); 
     476 
    504477  float pga_gain, agc_gain; 
    505478  float V_maxgain, V_mingain, V_fullscale, dac_value; 
     
    837810{ 
    838811  d_common = new _2400_common(); 
     812  set_gain((gain_min() + gain_max()) / 2.0);  // initialize gain 
    839813} 
    840814 
     
    904878{ 
    905879  d_common = new _1200_common(); 
     880  set_gain((gain_min() + gain_max()) / 2.0);  // initialize gain 
    906881} 
    907882 
     
    970945{ 
    971946  d_common = new _1800_common(); 
     947  set_gain((gain_min() + gain_max()) / 2.0);  // initialize gain 
    972948} 
    973949 
     
    10361012{ 
    10371013  d_common = new _900_common(); 
     1014  set_gain((gain_min() + gain_max()) / 2.0);  // initialize gain 
    10381015} 
    10391016 
     
    11011078{ 
    11021079  d_common = new _400_rx(); 
     1080  set_gain((gain_min() + gain_max()) / 2.0);  // initialize gain 
    11031081} 
    11041082 
  • gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_flexrf.h

    r9756 r9757  
    3838 
    3939  struct freq_result_t set_freq(double freq); 
    40   float gain_min(); 
    41   float gain_max(); 
    42   float gain_db_per_step(); 
    43   bool  set_gain(float gain); 
     40 
    4441  bool  is_quadrature(); 
    4542  double freq_min(); 
     
    8279  ~flexrf_base_tx(); 
    8380 
     81  // All RFX tx d'boards have fixed gain 
    8482  float gain_min(); 
    8583  float gain_max();