GNU Radio's LIMESDR Package
sink.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2018 Lime Microsystems info@limemicro.com
4  *
5  * GNU Radio 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  * GNU Radio 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 GNU Radio; 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_LIMESDR_SINK_H
22 #define INCLUDED_LIMESDR_SINK_H
23 
24 #include <gnuradio/block.h>
25 #include <limesdr/api.h>
26 
27 namespace gr {
28 namespace limesdr {
29 class LIMESDR_API sink : virtual public gr::block {
30  public:
31  typedef std::shared_ptr<sink> sptr;
32  /*!
33  * @brief Return a shared_ptr to a new instance of sink.
34  *
35  * To avoid accidental use of raw pointers, sink's
36  * constructor is private. limesdr::sink::make is the public
37  * interface for creating new instances.
38  *
39  * @param serial Device serial number. Cannot be left blank.
40  *
41  * @param channel_mode Channel and mode selection A(1), B(2), (A+B)MIMO(3).
42  *
43  * @param filename Path to file if file switch is turned on.
44  *
45  * @param length_tag_name Name of stream burst length tag
46  *
47  * @return a new limesdr sink block object
48  */
49  static sptr make(std::string serial,
50  int channel_mode,
51  const std::string& filename,
52  const std::string& length_tag_name);
53  /**
54  * Set center frequency
55  *
56  * @param freq Frequency to set in Hz
57  *
58  * @param chan Channel (not used)
59  *
60  * @return actual center frequency
61  */
62  virtual double set_center_freq(double freq, size_t chan = 0) = 0;
63 
64  /**
65  * Set which antenna is used
66  *
67  * @note setting antenna to BAND1 or BAND2 will enable PA path and because of that Lime boards
68  * will transmit CW signal, even when stream is stopped.
69  *
70  * @param antenna Antenna to set: None(0), BAND1(1), BAND(2), NONE(3), AUTO(255)
71  *
72  * @param channel Channel selection: A(LMS_CH_0),B(LMS_CH_1).
73  */
74  virtual void set_antenna(int antenna, int channel = 0) = 0;
75  /**
76  * Set NCO (numerically controlled oscillator).
77  * By selecting NCO frequency
78  * configure NCO. When NCO frequency is 0, NCO is off.
79  *
80  * @param nco_freq NCO frequency in Hz.
81  *
82  * @param channel Channel index.
83  */
84  virtual void set_nco(float nco_freq, int channel) = 0;
85  /**
86  * Set analog filters.
87  *
88  * @param analog_bandw Channel filter bandwidth in Hz.
89  *
90  * @param channel Channel selection: A(LMS_CH_0),B(LMS_CH_1).
91  *
92  * @return actual filter bandwidth in Hz
93  */
94  virtual double set_bandwidth(double analog_bandw, int channel = 0) = 0;
95  /**
96  * Set digital filters (GFIR).
97  *
98  * @param digital_bandw Channel filter bandwidth in Hz.
99  *
100  * @param channel Channel selection: A(LMS_CH_0),B(LMS_CH_1).
101  */
102  virtual void set_digital_filter(double digital_bandw, int channel) = 0;
103  /**
104  * Set the combined gain value in dB
105  *
106  * @note actual gain depends on LO frequency and analog LPF configuration and
107  * resulting output signal level may be different when those values are changed
108  *
109  * @param gain_dB Desired gain: [0,73] dB
110  *
111  * @param channel Channel selection: A(LMS_CH_0),B(LMS_CH_1).
112  *
113  * @return actual gain in dB
114  */
115  virtual unsigned set_gain(unsigned gain_dB, int channel = 0) = 0;
116  /**
117  * Set the same sample rate for both channels.
118  *
119  * @param rate Sample rate in S/s.
120  *
121  * @return actual sample rate in S/s
122  */
123  virtual double set_sample_rate(double rate) = 0;
124  /**
125  * Set oversampling for both channels.
126  *
127  * @param oversample Oversampling value (0 (default),1,2,4,8,16,32).
128  */
129  virtual void set_oversampling(int oversample) = 0;
130  /**
131  * Perform device calibration.
132  *
133  * @param bandw Set calibration bandwidth in Hz.
134  *
135  * @param channel Channel selection: A(LMS_CH_0),B(LMS_CH_1).
136  */
137  virtual void calibrate(double bandw, int channel = 0) = 0;
138  /**
139  * Set stream buffer size
140  *
141  * @param size FIFO buffer size in samples
142  */
143  virtual void set_buffer_size(uint32_t size) = 0;
144  /**
145  * Set TCXO DAC.
146  * @note Care must be taken as this parameter is returned to default value only after power off.
147  * @note LimeSDR-Mini default value is 180 range is [0,255]
148  * LimeSDR-USB default value is 125 range is [0,255]
149  * LimeSDR-PCIe default value is 134 range is [0,255]
150  * LimeNET-Micro default value is 30714 range is [0,65535]
151  *
152  * @param dacVal DAC value (0-65535)
153  */
154  virtual void set_tcxo_dac(uint16_t dacVal = 125 ) = 0;
155 };
156 } // namespace limesdr
157 } // namespace gr
158 
159 #endif
#define LIMESDR_API
Definition: api.h:19
Definition: sink.h:29
virtual void set_digital_filter(double digital_bandw, int channel)=0
virtual void set_tcxo_dac(uint16_t dacVal=125)=0
virtual double set_sample_rate(double rate)=0
virtual double set_center_freq(double freq, size_t chan=0)=0
virtual void set_antenna(int antenna, int channel=0)=0
static sptr make(std::string serial, int channel_mode, const std::string &filename, const std::string &length_tag_name)
Return a shared_ptr to a new instance of sink.
virtual double set_bandwidth(double analog_bandw, int channel=0)=0
std::shared_ptr< sink > sptr
Definition: sink.h:31
virtual unsigned set_gain(unsigned gain_dB, int channel=0)=0
virtual void set_nco(float nco_freq, int channel)=0
virtual void calibrate(double bandw, int channel=0)=0
virtual void set_buffer_size(uint32_t size)=0
virtual void set_oversampling(int oversample)=0
Definition: rfe.h:29