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