portapack-mayhem/firmware/baseband/dsp_squelch.hpp
Kyle Reed 31e8019642
POCSAG Processor Rewrite (#1437)
* WIP Refactoring
* WordExtractor building
* Fix buffer sizes and squelch execute
* Move impls to cpp file
* Baud indicator
* WIP new bit extractor
* New approach for bit extraction.
* Code fit and finish
* Fix case on button
* Cleanup
* Adjust rate miss threshold
* Fix count bits error calculation.
2023-09-08 19:41:09 +02:00

48 lines
1.4 KiB
C++

/*
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
*
* This file is part of PortaPack.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#ifndef __DSP_SQUELCH_H__
#define __DSP_SQUELCH_H__
#include "buffer.hpp"
#include "dsp_iir.hpp"
#include "dsp_iir_config.hpp"
#include <cstdint>
#include <cstddef>
class FMSquelch {
public:
/* Check if noise level is lower than threshold.
* Returns true if noise is below threshold. */
bool execute(const buffer_f32_t& audio);
void set_threshold(const float new_value);
bool enabled() const;
private:
float threshold_squared{0.0f};
IIRBiquadFilter non_audio_hpf{non_audio_hpf_config};
};
#endif /*__DSP_SQUELCH_H__*/