00001 /* 00002 * SPUC - Signal processing using C++ - A DSP library 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation; either version 2, or (at your option) 00007 * any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00017 */ 00018 #ifndef FNCO 00019 #define FNCO 00020 #include <spuc.h> 00021 #include <uint.h> 00022 namespace SPUC { 00027 template <int M> class fnco 00028 { 00029 public: 00030 uint<M> phase; 00031 // char v[20]; 00032 00033 protected: 00034 uint<M> fcw; 00035 uint<M> new_fcw; 00036 00037 public: 00038 fnco() { 00039 fcw = new_fcw = phase = 0; 00040 } 00041 inline void set_frequency(uint<M> freq) { fcw = freq; } 00042 inline void reset_frequency(uint<M> freq) { new_fcw = fcw = freq; } 00043 inline uint<M> get_phase(void) { return(phase);} 00044 inline void load(uint<M> loop_filter_out) {new_fcw = fcw + loop_filter_out;} 00045 uint<M> clock(uint<M> loop_filter_out); 00046 uint<M> clock(); 00047 }; 00048 } // namespace SPUC 00049 #endif