![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
CQエレクトロニクス・セミナ「実習・マイコンを動かしながら学ぶディジタル・フィルタ」で使うプログラム.1次IIRフィルタの係数をターミナルから変更できる. http://seminar.cqpub.co.jp/ccm/ES18-0020
Dependencies: mbed Array_Matrix BSP_DISCO_F746NG LCD_DISCO_F746NG TS_DISCO_F746NG
MyFiles/Trigger.hpp@2:aa11055138a2, 2017-11-08 (annotated)
- Committer:
- MikamiUitOpen
- Date:
- Wed Nov 08 11:10:56 2017 +0000
- Revision:
- 2:aa11055138a2
- Parent:
- 0:47718d3154d9
3
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
MikamiUitOpen | 0:47718d3154d9 | 1 | //--------------------------------------------------------------- |
MikamiUitOpen | 0:47718d3154d9 | 2 | // トリガの条件を満足する点を探す |
MikamiUitOpen | 0:47718d3154d9 | 3 | // |
MikamiUitOpen | 0:47718d3154d9 | 4 | // 2017/07/24, Copyright (c) 2017 MIKAMI, Naoki |
MikamiUitOpen | 0:47718d3154d9 | 5 | //--------------------------------------------------------------- |
MikamiUitOpen | 0:47718d3154d9 | 6 | |
MikamiUitOpen | 0:47718d3154d9 | 7 | #ifndef F746_TRIGGER_HPP |
MikamiUitOpen | 0:47718d3154d9 | 8 | #define F746_TRIGGER_HPP |
MikamiUitOpen | 0:47718d3154d9 | 9 | |
MikamiUitOpen | 0:47718d3154d9 | 10 | #include "mbed.h" |
MikamiUitOpen | 0:47718d3154d9 | 11 | #include "Array.hpp" |
MikamiUitOpen | 0:47718d3154d9 | 12 | |
MikamiUitOpen | 0:47718d3154d9 | 13 | namespace Mikami |
MikamiUitOpen | 0:47718d3154d9 | 14 | { |
MikamiUitOpen | 0:47718d3154d9 | 15 | int Trigger(const Array<int16_t>& xn, // 対象とするデータ |
MikamiUitOpen | 0:47718d3154d9 | 16 | int th) // トリガの基準値 |
MikamiUitOpen | 0:47718d3154d9 | 17 | { |
MikamiUitOpen | 0:47718d3154d9 | 18 | int n; |
MikamiUitOpen | 0:47718d3154d9 | 19 | for (n=1; n<xn.Length()/2; n++) |
MikamiUitOpen | 0:47718d3154d9 | 20 | if ((xn[n-1] < -th) && (xn[n] > th)) |
MikamiUitOpen | 0:47718d3154d9 | 21 | return n; |
MikamiUitOpen | 0:47718d3154d9 | 22 | return 0; |
MikamiUitOpen | 0:47718d3154d9 | 23 | } |
MikamiUitOpen | 0:47718d3154d9 | 24 | } |
MikamiUitOpen | 0:47718d3154d9 | 25 | #endif // F746_TRIGGER_HPP |