![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
ノイズを付加した正弦波発生器 Sinusoidal wave generator with noise.
Dependencies: F746_GUI F746_SAI_IO Random mbed
MyFiles/Trigger.hpp@0:31361b0fcdad, 2018-11-04 (annotated)
- Committer:
- MikamiUitOpen
- Date:
- Sun Nov 04 02:41:21 2018 +0000
- Revision:
- 0:31361b0fcdad
1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
MikamiUitOpen | 0:31361b0fcdad | 1 | //--------------------------------------------------------------- |
MikamiUitOpen | 0:31361b0fcdad | 2 | // トリガの条件を満足する点を探す |
MikamiUitOpen | 0:31361b0fcdad | 3 | // |
MikamiUitOpen | 0:31361b0fcdad | 4 | // 2017/07/24, Copyright (c) 2017 MIKAMI, Naoki |
MikamiUitOpen | 0:31361b0fcdad | 5 | //--------------------------------------------------------------- |
MikamiUitOpen | 0:31361b0fcdad | 6 | |
MikamiUitOpen | 0:31361b0fcdad | 7 | #ifndef F746_TRIGGER_HPP |
MikamiUitOpen | 0:31361b0fcdad | 8 | #define F746_TRIGGER_HPP |
MikamiUitOpen | 0:31361b0fcdad | 9 | |
MikamiUitOpen | 0:31361b0fcdad | 10 | #include "mbed.h" |
MikamiUitOpen | 0:31361b0fcdad | 11 | #include "Array.hpp" |
MikamiUitOpen | 0:31361b0fcdad | 12 | |
MikamiUitOpen | 0:31361b0fcdad | 13 | namespace Mikami |
MikamiUitOpen | 0:31361b0fcdad | 14 | { |
MikamiUitOpen | 0:31361b0fcdad | 15 | int Trigger(const Array<int16_t>& xn, // 対象とするデータ |
MikamiUitOpen | 0:31361b0fcdad | 16 | int th) // トリガの基準値 |
MikamiUitOpen | 0:31361b0fcdad | 17 | { |
MikamiUitOpen | 0:31361b0fcdad | 18 | int n; |
MikamiUitOpen | 0:31361b0fcdad | 19 | for (n=1; n<xn.Length()/2; n++) |
MikamiUitOpen | 0:31361b0fcdad | 20 | if ((xn[n-1] < -th) && (xn[n] > th)) |
MikamiUitOpen | 0:31361b0fcdad | 21 | return n; |
MikamiUitOpen | 0:31361b0fcdad | 22 | return 0; |
MikamiUitOpen | 0:31361b0fcdad | 23 | } |
MikamiUitOpen | 0:31361b0fcdad | 24 | } |
MikamiUitOpen | 0:31361b0fcdad | 25 | #endif // F746_TRIGGER_HPP |