CQエレクトロニクス・セミナ「実習・マイコンを動かしながら学ぶディジタル・フィルタ」で使うプログラム.雛形として使う. http://seminar.cqpub.co.jp/ccm/ES18-0020
Dependencies: F746_GUI F746_SAI_IO mbed
Diff: MyFiles/Trigger.hpp
- Revision:
- 0:b6d17af0f47a
diff -r 000000000000 -r b6d17af0f47a MyFiles/Trigger.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MyFiles/Trigger.hpp Fri Sep 29 12:50:44 2017 +0000 @@ -0,0 +1,25 @@ +//--------------------------------------------------------------- +// トリガの条件を満足する点を探す +// +// 2017/07/24, Copyright (c) 2017 MIKAMI, Naoki +//--------------------------------------------------------------- + +#ifndef F746_TRIGGER_HPP +#define F746_TRIGGER_HPP + +#include "mbed.h" +#include "Array.hpp" + +namespace Mikami +{ + int Trigger(const Array<int16_t>& xn, // 対象とするデータ + int th) // トリガの基準値 + { + int n; + for (n=1; n<xn.Length()/2; n++) + if ((xn[n-1] < -th) && (xn[n] > th)) + return n; + return 0; + } +} +#endif // F746_TRIGGER_HPP