GNU Radio's LIMESDR Package
source.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_SOURCE_H
22#define INCLUDED_LIMESDR_SOURCE_H
23
24#include <gnuradio/block.h>
25#include <limesdr/api.h>
26
27namespace gr {
28namespace limesdr {
29class LIMESDR_API source : virtual public gr::block {
30 public:
31 typedef boost::shared_ptr<source> sptr;
32
33 /*!
34 * @brief Return a shared_ptr to a new instance of source.
35 *
36 * To avoid accidental use of raw pointers, source's
37 * constructor is private. limesdr::source::make is the public
38 * interface for creating new instances.
39 *
40 * @param serial Device serial number. Cannot be left blank.
41 *
42 * @param channel_mode Channel and mode selection A(1), B(2), (A+B)MIMO(3).
43 *
44 * @param filename Path to file if file switch is turned on.
45 *
46 * @return a new limesdr source block object
47 */
48 static sptr make(std::string serial, int channel_mode, const std::string& filename);
49
50 /**
51 * Set center frequency
52 *
53 * @param freq Frequency to set in Hz
54 *
55 * @param chan Channel (not used)
56 *
57 * @return actual center frequency in Hz
58 */
59 virtual double set_center_freq(double freq, size_t chan = 0) = 0;
60
61 /**
62 * Set which antenna is used
63 *
64 * @param antenna Antenna to set: None(0), LNAH(1), LNAL(2), LNAW(3), AUTO(255)
65 *
66 * @param channel Channel selection: A(LMS_CH_0),B(LMS_CH_1).
67 */
68 virtual void set_antenna(int antenna, int channel = 0) = 0;
69 /**
70 * Set NCO (numerically controlled oscillator).
71 * By selecting NCO frequency
72 * configure NCO. When NCO frequency is 0, NCO is off.
73 *
74 * @param nco_freq NCO frequency in Hz.
75 *
76 * @param channel Channel index.
77 */
78 virtual void set_nco(float nco_freq, int channel) = 0;
79 /**
80 * Set analog filters.
81 *
82 * @param analog_bandw Channel filter bandwidth in Hz.
83 *
84 * @param channel Channel selection: A(LMS_CH_0),B(LMS_CH_1).
85 *
86 * @return actual filter bandwidth in Hz
87 */
88 virtual double set_bandwidth(double analog_bandw, int channel = 0) = 0;
89 /**
90 * Set digital filters (GFIR).
91 *
92 * @param digital_bandw Channel filter bandwidth in Hz.
93 *
94 * @param channel Channel selection: A(LMS_CH_0),B(LMS_CH_1).
95 */
96 virtual void set_digital_filter(double digital_bandw, int channel) = 0;
97 /**
98 * Set the combined gain value in dB
99 *
100 * @note actual gain depends on LO frequency and analog LPF configuration and
101 * resulting output signal level may be different when those values are changed
102 *
103 * @param gain_dB Desired gain: [0,70] RX
104 *
105 * @param channel Channel selection: A(LMS_CH_0),B(LMS_CH_1).
106 *
107 * @return actual gain in dB
108 */
109 virtual unsigned set_gain(unsigned gain_dB, int channel = 0) = 0;
110 /**
111 * Set the same sample rate for both channels.
112 *
113 * @param rate Sample rate in S/s.
114 *
115 * @return actual sample rate in S/s
116 */
117 virtual double set_sample_rate(double rate) = 0;
118 /**
119 * Set oversampling for both channels.
120 *
121 * @param oversample Oversampling value (0 (default),1,2,4,8,16,32).
122 */
123 virtual void set_oversampling(int oversample) = 0;
124 /**
125 * Perform device calibration.
126 *
127 * @param bandw Set calibration bandwidth in Hz.
128 *
129 * @param channel Channel selection: A(LMS_CH_0),B(LMS_CH_1).
130 */
131 virtual void calibrate(double bandw, int channel = 0) = 0;
132 /**
133 * Set stream buffer size
134 *
135 * @param size FIFO buffer size in samples
136 */
137 virtual void set_buffer_size(uint32_t size) = 0;
138};
139} // namespace limesdr
140} // namespace gr
141
142#endif
#define LIMESDR_API
Definition api.h:29
Definition source.h:29
virtual unsigned set_gain(unsigned gain_dB, int channel=0)=0
virtual void set_nco(float nco_freq, int channel)=0
virtual void set_digital_filter(double digital_bandw, int channel)=0
virtual void set_buffer_size(uint32_t size)=0
virtual void calibrate(double bandw, int channel=0)=0
virtual double set_bandwidth(double analog_bandw, int channel=0)=0
boost::shared_ptr< source > sptr
Definition source.h:31
static sptr make(std::string serial, int channel_mode, const std::string &filename)
Return a shared_ptr to a new instance of source.
virtual double set_center_freq(double freq, size_t chan=0)=0
virtual void set_antenna(int antenna, int channel=0)=0
virtual double set_sample_rate(double rate)=0
virtual void set_oversampling(int oversample)=0
Definition sink.h:27