Refactor WBX and adf4350 to avoid passing usrp pointer
[debian/gnuradio] / usrp / host / lib / db_wbxng_adf4350_regs.cc
index bc859158e71906b262878dd57c67f0114590c2a2..aa13d50b9d30b7ab7facb0d0770af89eba990914 100644 (file)
@@ -1,6 +1,22 @@
-/*
- * Copyright 2009 Ettus Research LLC
- */
+//
+// Copyright 2009 Free Software Foundation, Inc.
+//
+// This file is part of GNU Radio
+//
+// GNU Radio 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 asversion 3, or (at your option)
+// any later version.
+//
+// GNU Radio 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 GNU Radio; see the file COPYING.  If not, write to
+// the Free Software Foundation, Inc., 51 Franklin Street,
+// Boston, MA 02110-1301, USA.
 
 #include "db_wbxng_adf4350_regs.h"
 #include "db_wbxng_adf4350.h"
@@ -39,8 +55,7 @@ const uint8_t adf4350_regs::s_output_power = 3;
 /* reg 5 */
 const uint8_t adf4350_regs::s_ld_pin_mode = 1;
 
-adf4350_regs::adf4350_regs(adf4350* _adf4350){
-    d_adf4350 = _adf4350;
+adf4350_regs::adf4350_regs(){
 
     /* reg 0 */
     d_int = uint16_t(100);
@@ -63,10 +78,10 @@ adf4350_regs::~adf4350_regs(void){
 uint32_t
 adf4350_regs::_reg_shift(uint32_t data, uint32_t shift){
         return data << shift;
-    }
+}
 
-void
-adf4350_regs::_load_register(uint8_t addr){
+uint32_t
+adf4350_regs::compute_register(uint8_t addr){
        uint32_t data;
        switch (addr){
                case 0: data = (
@@ -107,8 +122,9 @@ adf4350_regs::_load_register(uint8_t addr){
                        _reg_shift(s_output_power, 3)); break;
                case 5: data = (
                        _reg_shift(s_ld_pin_mode, 22)); break;
-               default: return;
+               default: return data;
        }
-       /* write the data out to spi */
-       d_adf4350->_write(addr, data);
+       /* return the data to write out to spi */
+    return data;
 }
+