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.
Dependencies: BSP_DISCO_F746NG F746_GUI FrequencyResponseDrawer LCD_DISCO_F746NG TS_DISCO_F746NG mbed
main.cpp
00001 //----------------------------------------------------------- 00002 // 周波数特性を描画するための FrqRespDrawer クラスの使用例 00003 // 00004 // 2017/03/17, Copyright (c) 2017 MIKAMI, Naoki 00005 //----------------------------------------------------------- 00006 00007 #include "FrquencyResponseDrawer.hpp" 00008 #include "FIR_FrqResp.hpp" 00009 #include "Diff_FrqResp.hpp" 00010 #include "Biquad_FrqResp.hpp" 00011 #include "Button.hpp" 00012 00013 using namespace Mikami; 00014 00015 int main() 00016 { 00017 Label title(240, 8, "Example of FrequencyResponseDrawer class", 00018 Label::CENTER, Font16, LCD_COLOR_YELLOW); 00019 const uint16_t X0 = 60; 00020 const uint16_t Y0 = 230; 00021 const float DB1 = 3; 00022 const int FS = 20000; 00023 00024 // 周波数特性を描画する対象となるクラスのオブジェクト 00025 // 周波数応答の絶対値このクラスの中でをこのクラスで定義すること 00026 // このクラスは FrequencyResponse クラスを継承する派生クラスとして定義すること 00027 FIR_FrqResp firFrqResp; // 低域通過 FIR フィルタ 00028 Diff_FrqResp diffFrqResp; // 差分器 00029 Biquad_FrqResp biquadFrqResp( // 高域通過 IIR フィルタ 00030 2.647205E-01f, -2.800973E-01f, 00031 3.671389E-01f, -7.241241E-01f, 3.671389E-01f); 00032 00033 // 周波数特性を描画するためのクラス 00034 FrqRespDrawer drawer(X0, 100.0f, 10000.0f, 150, Y0, -60, 0, DB1, 10, FS); 00035 00036 drawer.DrawAxis(); // 目盛線の描画 00037 00038 FrqRespDrawer::AxisX_Char numX[] = // 横軸の目盛値を描画する際に使う構造体の配列 00039 {{ 100, "0.1"}, { 200, "0.2"}, { 500, "0.5"}, 00040 { 1000, "1"}, { 2000, "2"}, { 5000, "5"}, 00041 {10000, "10"}}; 00042 drawer.DrawNumericX(numX, 7, 6, "Frequency [kHz]"); // 横軸の目盛 00043 drawer.DrawNumericY(-24, -6, 20, "%3d"); // 縦軸の目盛は 20 dB 間隔 00044 00045 Button next(420, 230, 60, 40, "NEXT"); 00046 00047 drawer.DrawGraph(firFrqResp); // 低域通過 FIR フィルタの周波数特性の描画 00048 while (!next.Touched()) {} 00049 drawer.Erase(1); 00050 wait(0.2f); 00051 drawer.DrawAxis(); // 目盛線の描画 00052 drawer.DrawGraph(diffFrqResp, LCD_COLOR_MAGENTA); // 差分器の周波数特性の描画 00053 while (!next.Touched()) {} 00054 drawer.Erase(); 00055 wait(0.2f); 00056 drawer.DrawAxis(); // 目盛線の描画 00057 drawer.DrawGraph(biquadFrqResp, LCD_COLOR_GREEN); // 高域通過 IIR フィルタの周波数特性の描画 00058 while (!next.Touched()) {} 00059 drawer.Erase(); 00060 next.Erase(); 00061 00062 // 3種類の周波数特性を重ねて表示 00063 drawer.DrawAxis(); // 目盛線の描画 00064 drawer.DrawGraph(firFrqResp); // 低域通過 FIR フィルタ 00065 drawer.DrawGraph(diffFrqResp, LCD_COLOR_MAGENTA); // 差分器 00066 drawer.DrawGraph(biquadFrqResp, LCD_COLOR_GREEN); // 高域通過 IIR フィルタ 00067 00068 while (true) {} 00069 }
Generated on Sun Jul 17 2022 20:32:22 by
1.7.2