STM32F446 内蔵の DAC から出力する際に,補間フィルタを利用し,標本化周波数を入力の際の4倍の標本化周波数で出力するためのライブラリ.このライブラリを登録した際のプログラム: Demo_DSP_ADDA_Multirate. Library for outputting from built-in DAC in STM32F446 using interpolation filter at sampling frequency of 4 times in case of input.
Dependencies: Array_Matrix DSP_ADDA
Dependents: Demo_DSP_ADDA_Multirate DSP_AD_DA_Multirate DSP_GraphicEqualizerB DSP_VariableLHpfB ... more
Diff: MultirateLiPh.hpp
- Revision:
- 8:356d0c5f97c3
- Parent:
- 6:202a7610f937
- Child:
- 9:9f391b2d51be
--- a/MultirateLiPh.hpp Sat Nov 07 02:17:52 2020 +0000 +++ b/MultirateLiPh.hpp Sat Nov 28 02:27:00 2020 +0000 @@ -1,10 +1,10 @@ //----------------------------------------------------------- // 出力を 4 倍にアップサンプリングするクラス(ヘッダ) -// 補間処理で使うフィルタとして,直線位相 FIR フィルタを使用 +// 補間処理で使うフィルタ:直線位相 FIR フィルタ // // 出力端子: A2 (PA_4) // -// 2020/09/13, Copyright (c) 2020 MIKAMI, Naoki +// 2020/11/28, Copyright (c) 2020 MIKAMI, Naoki //----------------------------------------------------------- #include "DSP_AdcIntr.hpp" @@ -45,10 +45,10 @@ void Output(float yn); private: - static const int FACTOR_ = 4; // アップサンプリング倍率:4 倍 - // この倍率は 2 のべき乗にすること - static const int MASK_FACTOR_ = FACTOR_ - 1; - static const int MASK_BUF_ = 2*FACTOR_ - 1; + static const int UR_ = 4; // アップサンプリング倍率:4 倍 + // この倍率は 2 のべき乗にすること + static const int MASK_UR_ = UR_ - 1; + static const int MASK_BUF_ = 2*UR_ - 1; static DspAdc_Intr *adc_; // AD変換器のオブジェクトのポインタ static DspDac dac_; // DA変換器のオブジェクト @@ -61,7 +61,7 @@ // 補間用フィルタ用 const int FIR_LOOP_; // FIR フィルタのループの数 const int CENTER_; // 補間処理をしない信号の位置 - Array<float> un_; // FIR フィルタの遅延器に対応するバッファ + Array<float> vn_; // FIR フィルタの遅延器に対応するバッファ Array<float> h1_, h2_, h3_; // FIR フィルタの係数 // 補間用フィルタ用の係数(デフォルト) @@ -76,7 +76,7 @@ static void AdcIsr(); // 補間用 FIR フィルタ - float Interpolator(const float hk[]) const; + float Interpolate(const float hk[]) const; // ADC の初期化と割込み優先順位の設定 void Init(float fSampling, PinName pin, ADC_TypeDef* const adc);