File: source_python.cc

package info (click to toggle)
gr-limesdr 3.0.1.10.69-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,900 kB
  • sloc: python: 9,646; cpp: 2,091; ansic: 26; makefile: 8; sh: 5
file content (171 lines) | stat: -rw-r--r-- 3,987 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
/*
 * Copyright 2023 Lime Microsystems info@limemicro.com
 * SPDX-License-Identifier: GPL-3.0-or-later
 */

/***********************************************************************************/
/* This file is automatically generated using bindtool and can be manually edited  */
/* The following lines can be configured to regenerate this file during cmake      */
/* If manual edits are made, the following tags should be modified accordingly.    */
/* BINDTOOL_GEN_AUTOMATIC(0)                                                       */
/* BINDTOOL_USE_PYGCCXML(0)                                                        */
/* BINDTOOL_HEADER_FILE(source.h)                                                  */
/* BINDTOOL_HEADER_FILE_HASH(3564272b4ed28e9a9950ed098f444e40)                     */
/***********************************************************************************/

#include <pybind11/complex.h>
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>

namespace py = pybind11;

#include <limesdr/source.h>
// pydoc.h is automatically generated in the build directory
#include <source_pydoc.h>

void bind_source(py::module& m)
{

    using source    = ::gr::limesdr::source;


    py::class_<source, gr::block, gr::basic_block,
        std::shared_ptr<source>>(m, "source", D(source))

        .def(py::init(&source::make),
           py::arg("serial"),
           py::arg("channel_mode"),
           py::arg("filename"),
           py::arg("align_ch_phase"),
           D(source,make)
        )
        




        
        .def("set_center_freq",&source::set_center_freq,       
            py::arg("freq"),
            py::arg("chan") = 0,
            D(source,set_center_freq)
        )


        
        .def("set_antenna",&source::set_antenna,       
            py::arg("antenna"),
            py::arg("channel") = 0,
            D(source,set_antenna)
        )


        
        .def("set_nco",&source::set_nco,       
            py::arg("nco_freq"),
            py::arg("channel"),
            D(source,set_nco)
        )


        
        .def("set_bandwidth",&source::set_bandwidth,       
            py::arg("analog_bandw"),
            py::arg("channel") = 0,
            D(source,set_bandwidth)
        )


        
        .def("set_digital_filter",&source::set_digital_filter,       
            py::arg("digital_bandw"),
            py::arg("channel"),
            D(source,set_digital_filter)
        )


        
        .def("set_gain",&source::set_gain,       
            py::arg("gain_dB"),
            py::arg("channel") = 0,
            D(source,set_gain)
        )


        
        .def("set_sample_rate",&source::set_sample_rate,       
            py::arg("rate"),
            D(source,set_sample_rate)
        )


        
        .def("set_oversampling",&source::set_oversampling,       
            py::arg("oversample"),
            D(source,set_oversampling)
        )


        
        .def("calibrate",&source::calibrate,       
            py::arg("bandw"),
            py::arg("channel") = 0,
            D(source,calibrate)
        )


        
        .def("set_buffer_size",&source::set_buffer_size,       
            py::arg("size"),
            D(source,set_buffer_size)
        )


        
        .def("set_tcxo_dac",&source::set_tcxo_dac,       
            py::arg("dacVal") = 125,
            D(source,set_tcxo_dac)
        )


        
        .def("write_lms_reg",&source::write_lms_reg,       
            py::arg("address"),
            py::arg("val"),
            D(source,write_lms_reg)
        )


        
        .def("set_gpio_dir",&source::set_gpio_dir,       
            py::arg("dir"),
            D(source,set_gpio_dir)
        )


        
        .def("write_gpio",&source::write_gpio,       
            py::arg("out"),
            D(source,write_gpio)
        )


        
        .def("read_gpio",&source::read_gpio,       
            D(source,read_gpio)
        )

        ;




}