GNU Radio's IIO Package
hnchboard2u_source.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2014 Analog Devices Inc.
4  * Author: Paul Cercueil <paul.cercueil@analog.com>
5  *
6  * This is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3, or (at your option)
9  * any later version.
10  *
11  * This software is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this software; see the file COPYING. If not, write to
18  * the Free Software Foundation, Inc., 51 Franklin Street,
19  * Boston, MA 02110-1301, USA.
20  */
21 
22 
23 #ifndef INCLUDED_IIO_HNCHBOARD2U_SOURCE_H
24 #define INCLUDED_IIO_HNCHBOARD2U_SOURCE_H
25 
26 #include <iio/api.h>
27 #include <gnuradio/hier_block2.h>
28 #include <gnuradio/sync_block.h>
29 
30 #include "flexi_source.h"
31 
32 namespace gr {
33  namespace iio {
34 
35  /*!
36  * \brief <+description of block+>
37  * \ingroup iio
38  *
39  */
40  class IIO_API hnchboard2u_source : virtual public gr::sync_block
41  {
42  public:
43  typedef std::shared_ptr<hnchboard2u_source> sptr;
44 
45  /*!
46  * \brief Return a shared_ptr to a new instance of iio::device.
47  *
48  * To avoid accidental use of raw pointers, iio::device's
49  * constructor is in a private implementation
50  * class. iio::device::make is the public interface for
51  * creating new instances.
52  */
53  static sptr make(const std::string &uri, unsigned long samplerate, unsigned long lo_freq, double gain_value, unsigned long buffer_size);
54 
55  static sptr make_from(struct iio_context *ctx, unsigned long samplerate, unsigned long lo_freq, double gain_value, unsigned long buffer_size);
56 
57  virtual void set_params(unsigned long samplerate, unsigned long lo_freq, double gain_value) = 0;
58  };
59 
60  class IIO_API hnchboard2u_source_f32c : virtual public gr::hier_block2
61  {
62  public:
63  typedef std::shared_ptr<hnchboard2u_source_f32c> sptr;
64 
65  static sptr make(const std::string &uri, unsigned long samplerate, unsigned long lo_freq, double gain_value, unsigned long buffer_size)
66  {
67  hnchboard2u_source::sptr block = hnchboard2u_source::make(uri, samplerate, lo_freq, gain_value, buffer_size);
68 
69  return gnuradio::get_initial_sptr(
70  new hnchboard2u_source_f32c(block));
71  }
72 
73  void set_params(unsigned long samplerate, unsigned long lo_freq, double gain_value)
74  {
75  hnchboard2u_block->set_params(samplerate, lo_freq, gain_value);
76  }
77  private:
78  hnchboard2u_source::sptr hnchboard2u_block;
79 
80  protected:
82  };
83 
84  } // namespace iio
85 } // namespace gr
86 
87 #endif /* INCLUDED_IIO_HNCHBOARD2U_SOURCE_H */
#define IIO_API
Definition: api.h:19
void set_params(unsigned long samplerate, unsigned long lo_freq, double gain_value)
Definition: hnchboard2u_source.h:73
std::shared_ptr< hnchboard2u_source > sptr
Definition: hnchboard2u_source.h:43
static sptr make(const std::string &uri, unsigned long samplerate, unsigned long lo_freq, double gain_value, unsigned long buffer_size)
Definition: hnchboard2u_source.h:65
Definition: attr_sink.h:29
<+description of block+>
Definition: hnchboard2u_source.h:40
static sptr make(const std::string &uri, unsigned long samplerate, unsigned long lo_freq, double gain_value, unsigned long buffer_size)
Return a shared_ptr to a new instance of iio::device.
Definition: hnchboard2u_source.h:60
std::shared_ptr< hnchboard2u_source_f32c > sptr
Definition: hnchboard2u_source.h:63