diff options
author | Josh Blum <josh@joshknows.com> | 2011-01-11 19:46:45 -0800 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2011-01-11 19:46:45 -0800 |
commit | 395bbbbc1118b061262a10d5c847f17a4fd0c6ae (patch) | |
tree | 6347a18702529cfd42dcb94c37ce2866b49b93f4 /host/lib/usrp/usrp1/codec_ctrl.cpp | |
parent | 18defbd9d40a4c11a33025c8684f48fe51f102c5 (diff) | |
download | uhd-395bbbbc1118b061262a10d5c847f17a4fd0c6ae.tar.gz uhd-395bbbbc1118b061262a10d5c847f17a4fd0c6ae.tar.bz2 uhd-395bbbbc1118b061262a10d5c847f17a4fd0c6ae.zip |
uhd: replace all the instances of float not pertaining to io types with double, simplifies life
Diffstat (limited to 'host/lib/usrp/usrp1/codec_ctrl.cpp')
-rw-r--r-- | host/lib/usrp/usrp1/codec_ctrl.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/host/lib/usrp/usrp1/codec_ctrl.cpp b/host/lib/usrp/usrp1/codec_ctrl.cpp index 18f794632..553f78ef8 100644 --- a/host/lib/usrp/usrp1/codec_ctrl.cpp +++ b/host/lib/usrp/usrp1/codec_ctrl.cpp @@ -35,7 +35,7 @@ using namespace uhd; static const bool codec_debug = false; -const gain_range_t usrp1_codec_ctrl::tx_pga_gain_range(-20, 0, float(0.1)); +const gain_range_t usrp1_codec_ctrl::tx_pga_gain_range(-20, 0, double(0.1)); const gain_range_t usrp1_codec_ctrl::rx_pga_gain_range(0, 20, 1); /*********************************************************************** @@ -50,17 +50,17 @@ public: ~usrp1_codec_ctrl_impl(void); //aux adc and dac control - float read_aux_adc(aux_adc_t which); - void write_aux_dac(aux_dac_t which, float volts); + double read_aux_adc(aux_adc_t which); + void write_aux_dac(aux_dac_t which, double volts); //duc control void set_duc_freq(double freq); //pga gain control - void set_tx_pga_gain(float); - float get_tx_pga_gain(void); - void set_rx_pga_gain(float, char); - float get_rx_pga_gain(char); + void set_tx_pga_gain(double); + double get_tx_pga_gain(void); + void set_rx_pga_gain(double, char); + double get_rx_pga_gain(char); //rx adc buffer control void bypass_adc_buffers(bool bypass); @@ -159,19 +159,19 @@ usrp1_codec_ctrl_impl::~usrp1_codec_ctrl_impl(void) **********************************************************************/ static const int mtpgw = 255; //maximum tx pga gain word -void usrp1_codec_ctrl_impl::set_tx_pga_gain(float gain){ +void usrp1_codec_ctrl_impl::set_tx_pga_gain(double gain){ int gain_word = int(mtpgw*(gain - tx_pga_gain_range.start())/(tx_pga_gain_range.stop() - tx_pga_gain_range.start())); _ad9862_regs.tx_pga_gain = std::clip(gain_word, 0, mtpgw); this->send_reg(16); } -float usrp1_codec_ctrl_impl::get_tx_pga_gain(void){ +double usrp1_codec_ctrl_impl::get_tx_pga_gain(void){ return (_ad9862_regs.tx_pga_gain*(tx_pga_gain_range.stop() - tx_pga_gain_range.start())/mtpgw) + tx_pga_gain_range.start(); } static const int mrpgw = 0x14; //maximum rx pga gain word -void usrp1_codec_ctrl_impl::set_rx_pga_gain(float gain, char which){ +void usrp1_codec_ctrl_impl::set_rx_pga_gain(double gain, char which){ int gain_word = int(mrpgw*(gain - rx_pga_gain_range.start())/(rx_pga_gain_range.stop() - rx_pga_gain_range.start())); gain_word = std::clip(gain_word, 0, mrpgw); switch(which){ @@ -187,7 +187,7 @@ void usrp1_codec_ctrl_impl::set_rx_pga_gain(float gain, char which){ } } -float usrp1_codec_ctrl_impl::get_rx_pga_gain(char which){ +double usrp1_codec_ctrl_impl::get_rx_pga_gain(char which){ int gain_word; switch(which){ case 'A': gain_word = _ad9862_regs.rx_pga_a; break; @@ -200,12 +200,12 @@ float usrp1_codec_ctrl_impl::get_rx_pga_gain(char which){ /*********************************************************************** * Codec Control AUX ADC Methods **********************************************************************/ -static float aux_adc_to_volts(boost::uint8_t high, boost::uint8_t low) +static double aux_adc_to_volts(boost::uint8_t high, boost::uint8_t low) { - return float(((boost::uint16_t(high) << 2) | low)*3.3)/0x3ff; + return double(((boost::uint16_t(high) << 2) | low)*3.3)/0x3ff; } -float usrp1_codec_ctrl_impl::read_aux_adc(aux_adc_t which) +double usrp1_codec_ctrl_impl::read_aux_adc(aux_adc_t which) { //check to see if the switch needs to be set bool write_switch = false; @@ -259,7 +259,7 @@ float usrp1_codec_ctrl_impl::read_aux_adc(aux_adc_t which) /*********************************************************************** * Codec Control AUX DAC Methods **********************************************************************/ -void usrp1_codec_ctrl_impl::write_aux_dac(aux_dac_t which, float volts) +void usrp1_codec_ctrl_impl::write_aux_dac(aux_dac_t which, double volts) { //special case for aux dac d (aka sigma delta word) if (which == AUX_DAC_D) { |