Detected Iteration Above Threshold in Unit Time. Check if Frequency (iteration count in Unit time) above Threshold. CATION. max interval is 0xfff0: 65,520ms. max iter threshold is 0xffff. (threfore, using 131KB with span[0xffff].)
DetectFreqAboveTH.h
00001 #pragma once 00002 00003 /** Detected Iteration Above Threshold in Unit Time. 00004 * Check if Frequency (iteration count in Unit time) above Threshold. 00005 * 00006 * CATION. max interval is 0xfff0: 65,520ms. 00007 * max iter threshold is 0xffff. 00008 * (threfore, using 131KB with span[0xffff].) 00009 */ 00010 /** Sample code 00011 #include "mbed.h" 00012 #include "DetectFreqAboveTH.h" 00013 00014 DigitalOut led1(LED1); 00015 DigitalOut led4(LED4); 00016 00017 DetectFreqAboveTH chkErrIter(5000, 100); 00018 00019 int main() 00020 { 00021 while(1) { 00022 led1= !led1; 00023 if(chkErrIter.chkAbove()) { 00024 led4= !led4; 00025 wait_ms(5100); 00026 } 00027 wait_ms(20); 00028 } 00029 } 00030 */ 00031 00032 #include "mbed.h" 00033 #include "myTimer.h" 00034 00035 class DetectFreqAboveTH 00036 { 00037 public: 00038 DetectFreqAboveTH(int time_ms, int iter); 00039 ~DetectFreqAboveTH(); 00040 00041 bool chkAbove(); 00042 00043 private: 00044 unsigned short id, iterThreshold, *span; // circular buffer 00045 unsigned int unitTime; 00046 // 16bit: 0xFFFF 00047 00048 myTimer timer; 00049 };
Generated on Thu Jul 14 2022 01:06:24 by 1.7.2