Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: FrequencyConverter/FrequencyConverter.hpp
- Revision:
- 0:f69d3c64978d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/FrequencyConverter/FrequencyConverter.hpp Mon Jul 28 07:30:22 2014 +0000 @@ -0,0 +1,40 @@ +//-------------------------------------------------------------- +// Frequency converter system class +// Copyright (c) 2014 MIKAMI, Naoki, 2014/07/20 +//-------------------------------------------------------------- + +#ifndef FREQUENCYCONVERTER_HPP +#define FREQUENCYCONVERTER_HPP + +#include "mbed.h" +#include "HilbertTransform.hpp" +#include "coefsHilbert94.hpp" +#include "DC_Cut_Coefficients.hpp" +#include "TwoPhaseGenerator.hpp" + +namespace Mikami +{ + class FrqConvSystem + { + private: + Hilbert<ORDER_> ht_; + Biquad DcCut_; // DC cut filter + TwoPhaseGenerator sinCos_; // 100.0 Hz + public: + FrqConvSystem(float fC, float fS) + : ht_(hm_), DcCut_(cDccut_), sinCos_(fC, fS) {} + float Execute(float x) + { + float yI, yQ, cosx, sinx; + + float xn = x; + xn = DcCut_.Execute(gDccut_*x); // DC cut + ht_.Execute(xn, yI, yQ); // Hilbert transform + sinCos_.Generate(cosx, sinx); // cos and sin generator + float yn = yI*cosx - yQ*sinx; // conversion + return yn; + }; + }; +} +#endif // FREQUENCYCONVERTER_HPP +