The experiment using this program is introduced on "Interface" No.12, CQ publishing Co.,Ltd, 2014. 本プログラムを使った実験は,CQ出版社のインターフェース 2014年12月号で紹介しています.
Dependencies: DSProcessingIO mbed
FirBaseClass.hpp
- Committer:
- CQpub0Mikami
- Date:
- 2014-07-29
- Revision:
- 1:bd300d649b1f
- Parent:
- 0:4498a5360dde
File content as of revision 1:bd300d649b1f:
//-------------------------------------------------------------- // Virtual base class for FIR filter // Copyright (c) 2014 MIKAMI, Naoki, 2014/06/22 //-------------------------------------------------------------- #ifndef FIR_BASE_HPP #define FIR_BASE_HPP #include "mbed.h" namespace Mikami { template<int order> class FirBase { private: FirBase(const FirBase&); FirBase& operator=(const FirBase&); protected: const float *const hm_; // pointer for filter coefficients float xn_[order+1]; // buffer for inputs // Constructor FirBase(const float hk[]) : hm_(hk) { Clear(); } // Execute filter virtual float Execute(float xin) = 0; // Move signals in xn_[] void Move() { for (int k=order; k>0; k--) xn_[k] = xn_[k-1]; // move input signals } public: void Clear() { for (int k=0; k<=order; k++) xn_[k] = 0.0; } }; } #endif // FIR_BASE_HPP