GNU Radio's LIMESDR Package
rfe.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * Copyright 2020 Lime Microsystems <info@limemicro.com>
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_LIMERFE_H
22#define INCLUDED_LIMERFE_H
23
24#include <lime/limeRFE.h>
25#include <limesdr/api.h>
26#include <gnuradio/logger.h>
27#include <string>
28
29namespace gr {
30namespace limesdr {
31
32/*!
33 * \brief Allow directly controlling RFE boards
34 * \ingroup limesdr
35 *
36 */
38{
39public:
40 typedef std::shared_ptr<rfe> sptr;
41
42 static sptr make(int comm_type,
43 const std::string &device,
44 const std::string &config_file,
45 char IDRX,
46 char IDTX,
47 char PortRX,
48 char PortTX,
49 char Mode,
50 char Notch,
51 char Atten);
52
53 rfe(int comm_type,
54 const std::string &device,
55 const std::string &config_file,
56 char IDRX,
57 char IDTX,
58 char PortRX,
59 char PortTX,
60 char Mode,
61 char Notch,
62 char Atten);
64 /**
65 * Change LimeRFE Mode
66 *
67 * @param mode Mode to be set: RX(0), TX(1), NONE(2), TXRX(3)
68 *
69 * @return 0 on success, other on failure (see LimeRFE error codes)
70 */
71 int change_mode(int mode);
72 /**
73 * Enable or disable fan
74 *
75 * @param enable fan state: 0 - disable; 1 - enable.
76 *
77 * @return 0 on success, other on failure (see LimeRFE error codes)
78 */
79 int set_fan(int enable);
80 /**
81 * Set RX Attenuation value
82 *
83 * @param attenuation Specifies the attenuation in the RX path. Attenuation [dB] =
84 * 2 * attenuation. Value range: [0,7]
85 *
86 * @return 0 on success, other on failure (see LimeRFE error codes)
87 */
88 int set_attenuation(int attenuation);
89 /**
90 * Enable or disable AM/FM notch filter
91 *
92 * @param enable notch state: 0 - disable; 1 - enable
93 *
94 * @note Notch filter is only possible up to HAM 430-440 MHz, or Wideband 1-1000 MHz
95 * @return 0 on success, other on failure (see LimeRFE error codes)
96 */
97 int set_notch(int enable);
98
99private:
100 rfe_dev_t* rfe_dev = nullptr;
101 rfe_boardState boardState = { RFE_CID_WB_1000,
102 RFE_CID_WB_1000,
103 RFE_PORT_1,
104 RFE_PORT_1,
105 RFE_MODE_NONE,
106 RFE_NOTCH_OFF,
107 0,
108 0,
109 0 };
110 int sdr_device_num = 0;
111
112 gr::logger_ptr d_logger;
113 gr::logger_ptr d_debug_logger;
114
115 std::string strerror(int error);
116 void get_board_state();
117};
118
119} // namespace limesdr
120} // namespace gr
121
122#endif /* INCLUDED_LIMERFE_H */
#define LIMESDR_API
Definition api.h:31
int set_attenuation(int attenuation)
rfe(int comm_type, const std::string &device, const std::string &config_file, char IDRX, char IDTX, char PortRX, char PortTX, char Mode, char Notch, char Atten)
static sptr make(int comm_type, const std::string &device, const std::string &config_file, char IDRX, char IDTX, char PortRX, char PortTX, char Mode, char Notch, char Atten)
int set_fan(int enable)
int set_notch(int enable)
int change_mode(int mode)
std::shared_ptr< rfe > sptr
Definition rfe.h:40
Definition rfe.h:30
Definition rfe.h:29