GNU Radio's MICROTELECOM Package
perseus_impl.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2015 Andrea Montefusco IW0HDV.
4  *
5  * This is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3, or (at your option)
8  * any later version.
9  *
10  * This software is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this software; see the file COPYING. If not, write to
17  * the Free Software Foundation, Inc., 51 Franklin Street,
18  * Boston, MA 02110-1301, USA.
19  */
20 
21 #ifndef INCLUDED_MICROTELECOM_PERSEUS_IMPL_H
22 #define INCLUDED_MICROTELECOM_PERSEUS_IMPL_H
23 
24 
25 #include <boost/circular_buffer.hpp>
26 #include <boost/thread/mutex.hpp>
27 #include <boost/thread/condition.hpp>
28 #include <boost/timer/timer.hpp> // for auto_cpu_timer
29 
30 #include <microtelecom/perseus.h>
31 #include <perseus-sdr.h>
32 
33 
34 
35 namespace gr {
36  namespace microtelecom {
37 
38  class perseus_impl : public perseus {
39 
40  public:
41 
42  perseus_impl(int sampling_rate=95000, int central_frequency=7070000, int attenuation_db= 0, bool adc_dither=0, bool preamp=0, bool frontend_filters=0);
43  ~perseus_impl();
44 
45  // Where all the action really happens
46  int work(int noutput_items,
47  gr_vector_const_void_star &input_items,
48  gr_vector_void_star &output_items);
49 
50  void set_freq(float freq);
51  void set_attenuator(int attenuation_db);
52  void set_dither(int adc_dither);
53  void set_preamp(int preamp);
54  void set_wideband(int frontend_filters);
55 
56  private:
57 
58  perseus_descr *pd; // pointer to libperseus-sdr descriptor
59  bool d_started; // flags that Perseus is enabled and running
60 
61  // vars to keep memory hardware status
62  int d_sampling_rate;
63  int d_central_frequency;
64  int d_attenuation_db;
65  bool d_adc_dither;
66  bool d_preamp;
67  bool d_frontend_filters;
68 
69  // hardware data
70  unsigned short d_serial_number; // product id
71  char d_signature[16]; // product signature "0000-0000-0000"
72  unsigned short d_hw_release; // hardware release
73  unsigned short d_hw_version; // hardware version
74 
75  // ring buffer
76  boost::circular_buffer<gr_complex> *_fifo;
77  boost::mutex _fifo_lock;
78  boost::condition_variable _samp_avail;
79 
80  static int callbackPerseus (void *buf, int buf_size, void *extra);
81 
82  // utility for exception throw
83  void bail(const char *msg);
84 
85  };
86 
87  } // namespace microtelecom
88 } // namespace gr
89 
90 #endif /* INCLUDED_MICROTELECOM_PERSEUS_IMPL_H */
91 
Perseus Receiver source block.
Definition: perseus.h:36
Definition: perseus_impl.h:38
Definition: perseus.h:28
void set_dither(int adc_dither)
void set_wideband(int frontend_filters)
void set_attenuator(int attenuation_db)
perseus_impl(int sampling_rate=95000, int central_frequency=7070000, int attenuation_db=0, bool adc_dither=0, bool preamp=0, bool frontend_filters=0)
void set_freq(float freq)
Set frequency with Hz resolution.
int work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)