2 * Copyright 2006 Free Software Foundation, Inc.
4 * This file is part of GNU Radio
6 * GNU Radio is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
11 * GNU Radio is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with GNU Radio; see the file COPYING. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street,
19 * Boston, MA 02110-1301, USA.
25 // Application level includes
28 // System level includes
41 bool init(); // Attach to first device found, TODO: serial no
42 bool finish(); // Release device
43 bool reset(); // Reset state to post-init()
46 bool set_rate(int rate); // Set rotation rate
47 int rate() const // Get rotation rate
48 { return 2000/d_rate; }
51 bool rotate(); // Start antenna rotation
52 bool stop_rotating(); // Stop antenna rotation
53 bool stream(); // Start audio streaming
54 bool stop_streaming(); // Stop audio streaming
56 // Raw read of sample stream from device, length in bytes (2 per sample)
57 int read_raw(unsigned char *buffer, unsigned int length);
59 // Read synced, downconverted I and Q samples, one per rotation
60 int read_iq(complex<float> *buffer, unsigned int samples, float &volume);
63 bool is_online() const { return d_online; }
66 struct ftdi_context *d_device; // libftdi device instance data
67 bool d_online; // Successfully found and connected to device
68 bool d_rotating; // Doppler is rotating
69 int d_rate; // Current rotation rate (samples per antenna)
70 enum { ST_HI, ST_LO } d_state; // Current byte sync state
71 char d_ant; // Current antenna being sequenced
72 int d_seq; // Current phase sample number
73 int d_val; // Current reassembled audio sample value
74 int d_in_phase; // Downconverted I accumulator
75 int d_quadrature; // Downconverted Q accumulator
77 bool send_byte(unsigned char data); // Send a byte to AVR