diff options
author | Martin Braun <martin.braun@ettus.com> | 2017-03-08 09:28:55 -0800 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2017-12-22 15:03:44 -0800 |
commit | 1a4348038d0eb57d53475074dca49e8192aeb2d7 (patch) | |
tree | 04c8e87fa9c95d2702aac410f6fb271461acb9bb /mpm/lib/mykonos/config/ad937x_fir.cpp | |
parent | fc8cd827f6b16b9c8c354a216889e6a9d7f37456 (diff) | |
download | uhd-1a4348038d0eb57d53475074dca49e8192aeb2d7.tar.gz uhd-1a4348038d0eb57d53475074dca49e8192aeb2d7.tar.bz2 uhd-1a4348038d0eb57d53475074dca49e8192aeb2d7.zip |
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 <martin.braun@ettus.com>
Derek Kozel <derek.kozel@ettus.com>
Mark Meserve <mark.meserve@ni.com>
Andrej Rode <andrej.rode@ettus.com>
Diffstat (limited to 'mpm/lib/mykonos/config/ad937x_fir.cpp')
-rw-r--r-- | mpm/lib/mykonos/config/ad937x_fir.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
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 <limits> + +ad937x_fir::ad937x_fir(int8_t gain, const std::vector<int16_t>& coefficients) +{ + + _set_gain(gain); +} + +ad937x_fir::ad937x_fir(int8_t gain, std::vector<int16_t>&& coefficients) +{ + set_coefficients(std::move(coefficients)); + _set_gain(gain); +} + +mykonosFir_t* ad937x_fir::getFir() +{ + return &(_fir); +} + +void ad937x_fir::set_coefficients(std::vector<int16_t>&& coefficients) +{ + if (coefficients.size() < std::numeric_limits<decltype(mykonosFir_t().numFirCoefs)>::max() || + coefficients.size() > 0) + { + // TODO: exception + } + fir_coefficients = std::move(coefficients); + _fir.numFirCoefs = static_cast<uint8_t>(fir_coefficients.size()); + _fir.coefs = &fir_coefficients[0]; +} + +void ad937x_fir::_set_gain(int8_t gain) +{ + _fir.gain_dB = gain; +} + |