From 1a4348038d0eb57d53475074dca49e8192aeb2d7 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Wed, 8 Mar 2017 09:28:55 -0800 Subject: Initial commit for N3xx development. - Creates mpm/ subdirectory - First pass at hardware daemon/MPM - New code for LMK04828, AD9371 - spidev integration Contributions by: Martin Braun Derek Kozel Mark Meserve Andrej Rode --- mpm/lib/mykonos/config/ad937x_fir.cpp | 37 +++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 mpm/lib/mykonos/config/ad937x_fir.cpp (limited to 'mpm/lib/mykonos/config/ad937x_fir.cpp') diff --git a/mpm/lib/mykonos/config/ad937x_fir.cpp b/mpm/lib/mykonos/config/ad937x_fir.cpp new file mode 100644 index 000000000..a9ede3318 --- /dev/null +++ b/mpm/lib/mykonos/config/ad937x_fir.cpp @@ -0,0 +1,37 @@ +#include "ad937x_fir.h" +#include + +ad937x_fir::ad937x_fir(int8_t gain, const std::vector& coefficients) +{ + + _set_gain(gain); +} + +ad937x_fir::ad937x_fir(int8_t gain, std::vector&& coefficients) +{ + set_coefficients(std::move(coefficients)); + _set_gain(gain); +} + +mykonosFir_t* ad937x_fir::getFir() +{ + return &(_fir); +} + +void ad937x_fir::set_coefficients(std::vector&& coefficients) +{ + if (coefficients.size() < std::numeric_limits::max() || + coefficients.size() > 0) + { + // TODO: exception + } + fir_coefficients = std::move(coefficients); + _fir.numFirCoefs = static_cast(fir_coefficients.size()); + _fir.coefs = &fir_coefficients[0]; +} + +void ad937x_fir::_set_gain(int8_t gain) +{ + _fir.gain_dB = gain; +} + -- cgit v1.2.3