GNU Radio Manual and C++ API Reference  3.10.9.1
The Free & Open Software Radio Ecosystem
threshold_ff.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2004,2013 Free Software Foundation, Inc.
4  *
5  * This file is part of GNU Radio
6  *
7  * SPDX-License-Identifier: GPL-3.0-or-later
8  *
9  */
10 
11 #ifndef INCLUDED_GR_THRESHOLD_FF_H
12 #define INCLUDED_GR_THRESHOLD_FF_H
13 
14 #include <gnuradio/blocks/api.h>
15 #include <gnuradio/sync_block.h>
16 
17 namespace gr {
18 namespace blocks {
19 
20 /*!
21  * \brief Output a 1 or zero based on a threshold value.
22  * \ingroup level_controllers_blk
23  *
24  * \details
25  * Test the incoming signal against a threshold. If the signal
26  * exceeds the \p hi value, it will output a 1 until the signal
27  * falls below the \p lo value.
28  */
29 class BLOCKS_API threshold_ff : virtual public sync_block
30 {
31 public:
32  // gr::blocks::threshold_ff::sptr
33  typedef std::shared_ptr<threshold_ff> sptr;
34 
35  /* \brief Create a threadshold block.
36  * \param lo Threshold input signal needs to drop below to
37  * change state to 0.
38  * \param hi Threshold input signal needs to rise above to
39  * change state to 1.
40  * \param initial_state Initial state of the block (0 or 1).
41  */
42  static sptr make(float lo, float hi, float initial_state = 0);
43 
44  virtual float lo() const = 0;
45  virtual void set_lo(float lo) = 0;
46  virtual float hi() const = 0;
47  virtual void set_hi(float hi) = 0;
48  virtual float last_state() const = 0;
49  virtual void set_last_state(float last_state) = 0;
50 };
51 
52 } /* namespace blocks */
53 } /* namespace gr */
54 
55 #endif /* INCLUDED_GR_THRESHOLD_FF_H */
Output a 1 or zero based on a threshold value.
Definition: threshold_ff.h:30
std::shared_ptr< threshold_ff > sptr
Definition: threshold_ff.h:33
virtual void set_last_state(float last_state)=0
virtual float hi() const =0
virtual float lo() const =0
static sptr make(float lo, float hi, float initial_state=0)
virtual float last_state() const =0
virtual void set_lo(float lo)=0
virtual void set_hi(float hi)=0
synchronous 1:1 input to output with history
Definition: sync_block.h:26
#define BLOCKS_API
Definition: gr-blocks/include/gnuradio/blocks/api.h:18
GNU Radio logging wrapper.
Definition: basic_block.h:29