2 Copyright 2006 Johnathan Corgan.
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License version 2
6 as published by the Free Software Foundation.
8 This software is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
13 You should have received a copy of the GNU General Public License
14 along with GNU Radio; see the file COPYING. If not, write to
15 the Free Software Foundation, Inc., 51 Franklin Street,
16 Boston, MA 02110-1301, USA.
22 // Autoconf generated configure options
27 // Application level includes
29 #include <boost/shared_ptr.hpp>
32 // TODO: Read this from ezdop.h
37 class DopplerBackground : public wxThread
40 DopplerBackground(wxWindow *window, EZDoppler *doppler);
41 virtual ExitCode Entry();
42 bool IsRunning() { return m_running; }
50 class EZDopplerUpdate : public wxNotifyEvent
53 EZDopplerUpdate(const wxEventType &event, float &in_phase, float &quadrature,
55 virtual wxEvent *Clone() const { return new EZDopplerUpdate(*this); }
62 extern const wxEventType wxEVT_DOPPLER_UPDATE;
64 typedef void(wxEvtHandler::*EZDopplerUpdateFunction)(EZDopplerUpdate&);
66 #define EVT_DOPPLER_UPDATE(fn) \
67 DECLARE_EVENT_TABLE_ENTRY( \
68 wxEVT_DOPPLER_UPDATE, -1, -1, \
69 (wxObjectEventFunction)(wxEventFunction)(EZDopplerUpdateFunction)&fn, \
73 typedef boost::shared_ptr<ezdop> ezdop_sptr;
78 EZDoppler(wxWindow *gui);
87 bool SetFilter(int n);
88 bool SelectRotationRate(int n);
89 int GetRotationRate();
91 bool Sample(float &in_phase, float &quadrature, float &volume);
92 bool Calibrate(float phase);
93 bool SetCalibration(int rate, float offset);
94 float GetCalibration(int rate);
95 bool SetOffset(float offset = 0.0);
96 bool Nudge(float amount);
97 bool NudgeAll(float amount);
103 DopplerBackground *m_thread;
105 complex<float> m_phase; // Actual phase of doppler before calibration
106 complex<float> m_output; // Calibrated output phase
107 complex<float> m_alpha; // Exponential average constant
108 complex<float> m_beta; // Exponential average constant
110 float m_angle; // Actual angle of doppler before calibration
111 float m_offset; // Global calibration angle
112 float m_calibration[NUM_RATES]; // Individual rotation rate offset
115 #endif // __DOPPLER_H__