GNU Radio's M2K Package
analog_in_source.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * Copyright 2022 Analog Devices Inc..
4 *
5 * SPDX-License-Identifier: GPL-3.0-or-later
6 */
7
8#ifndef INCLUDED_M2K_ANALOG_IN_SOURCE_H
9#define INCLUDED_M2K_ANALOG_IN_SOURCE_H
10
11#include <gnuradio/m2k/api.h>
12#include <gnuradio/sync_block.h>
13#include <libm2k/m2k.hpp>
14
15namespace gr {
16 namespace m2k {
17
18
19 /*!
20 * \brief Source for ADALM2000 with buffered output channels
21 * \ingroup m2k
22 *
23 * \details
24 * This block allows for streaming data from ADALM2000
25 */
26 class M2K_API analog_in_source : virtual public gr::sync_block {
27 public:
28 typedef std::shared_ptr <analog_in_source> sptr;
29
30 /*!
31 * \brief Return a shared_ptr to a new instance of m2k::analog_in_source.
32 *
33 * \param uri String of the context uri
34 * \param buffer_size Integer number of samples to be put into each buffered
35 * \param channels List of channel's states (enable/disable)
36 * \param ranges List of ranges for the given channels
37 * \param sampling_frequency Frequency at which the hardware will input samples
38 * \param oversampling_ratio Integer number representing the oversampling factor
39 * \param kernel_buffers The number of the internal buffers
40 * \param calibrate_ADC Boolean value for deciding if the ADC should be calibrated
41 * \param stream_voltage_values Boolean value for setting the output type: voltage/raw
42 * \param trigger_condition List of triggering conditions for the given channels
43 * \param trigger_mode List of triggering modes for the given channels
44 * \param trigger_source The source for the triggering event
45 * \param trigger_delay The number of samples in buffer before the triggered sample
46 * \param streaming configures m2k in streaming mode
47 * \param deinit clears m2k resources on deinit - useful when used in conjunction with other software that handles deinit
48 * \param data_rate sets a data rate of data_rate buffers per second
49 */
50 static sptr make(const std::string &uri,
51 int buffer_size,
52 const std::vector<int> &channels,
53 std::vector<int> ranges,
54 double sampling_frequency,
55 int oversampling_ratio,
56 int kernel_buffers,
57 bool calibrate_ADC,
58 bool stream_voltage_values,
59 std::vector<int> trigger_condition,
60 std::vector<int> trigger_mode,
61 int trigger_source,
62 int trigger_delay,
63 std::vector<double> trigger_level,
64 bool streaming,
65 bool deinit = true,
66 double data_rate = 0);
67
68 static sptr make_from(libm2k::context::M2k *context,
69 int buffer_size,
70 const std::vector<int> &channels,
71 std::vector<int> ranges,
72 double sampling_frequency,
73 int oversampling_ratio,
74 int kernel_buffers,
75 bool calibrate_ADC,
76 bool stream_voltage_values,
77 std::vector<int> trigger_condition,
78 std::vector<int> trigger_mode,
79 int trigger_source,
80 int trigger_delay,
81 std::vector<double> trigger_level,
82 bool streaming,
83 bool deinit = true,
84 double data_rate = 0);
85
86 virtual void set_params(std::vector<int> ranges,
87 double sampling_frequency,
88 int oversampling_ratio) = 0;
89
90 virtual void set_data_rate(double rate) = 0;
91
92 virtual void set_trigger(std::vector<int> trigger_condition,
93 std::vector<int> trigger_mode,
94 int trigger_source,
95 int trigger_delay,
96 std::vector<double> trigger_level,
97 bool streaming) = 0;
98
99 virtual void set_timeout_ms(unsigned int timeout) = 0;
100
101 virtual void set_buffer_size(int buffer_size) = 0;
102
103 };
104
105 } // namespace m2k
106} // namespace gr
107
108#endif /* INCLUDED_M2K_ANALOG_IN_SOURCE_H */
#define M2K_API
Definition api.h:19
Source for ADALM2000 with buffered output channels.
Definition analog_in_source.h:26
virtual void set_params(std::vector< int > ranges, double sampling_frequency, int oversampling_ratio)=0
static sptr make(const std::string &uri, int buffer_size, const std::vector< int > &channels, std::vector< int > ranges, double sampling_frequency, int oversampling_ratio, int kernel_buffers, bool calibrate_ADC, bool stream_voltage_values, std::vector< int > trigger_condition, std::vector< int > trigger_mode, int trigger_source, int trigger_delay, std::vector< double > trigger_level, bool streaming, bool deinit=true, double data_rate=0)
Return a shared_ptr to a new instance of m2k::analog_in_source.
static sptr make_from(libm2k::context::M2k *context, int buffer_size, const std::vector< int > &channels, std::vector< int > ranges, double sampling_frequency, int oversampling_ratio, int kernel_buffers, bool calibrate_ADC, bool stream_voltage_values, std::vector< int > trigger_condition, std::vector< int > trigger_mode, int trigger_source, int trigger_delay, std::vector< double > trigger_level, bool streaming, bool deinit=true, double data_rate=0)
virtual void set_buffer_size(int buffer_size)=0
virtual void set_timeout_ms(unsigned int timeout)=0
virtual void set_trigger(std::vector< int > trigger_condition, std::vector< int > trigger_mode, int trigger_source, int trigger_delay, std::vector< double > trigger_level, bool streaming)=0
virtual void set_data_rate(double rate)=0
std::shared_ptr< analog_in_source > sptr
Definition analog_in_source.h:28
Definition adf4350_sink.h:15
Definition adf4350_sink.h:14