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: EthernetInterface mbed-rtos mbed
EventDetector.h
00001 /* 00002 * EventDetector.h 00003 * 00004 * Created on: 00005 * Author: 00006 */ 00007 00008 #ifndef EVENTDETECTOR_H 00009 #define EVENTDETECTOR_H 00010 00011 #include <stdlib.h> 00012 00013 #include "rtos.h" 00014 00015 #include "Settings.h" 00016 #include "Capture.h" 00017 #include "SignalProcessor.h" 00018 00019 class CaptureEvent 00020 { 00021 char m_RFID[9]; 00022 int m_Type; 00023 int m_OutletNumber; 00024 float m_MeanValue; 00025 float m_RMSValue; 00026 float m_Gain; 00027 int m_Offset; 00028 float m_Sin[NUMBER_OF_HARMONICS]; 00029 float m_Cos[NUMBER_OF_HARMONICS]; 00030 00031 public: 00032 00033 CaptureEvent(); 00034 00035 void Setup(char* rfid,int type,int outlet,float mv,float rms,float gain, int offset,float* sin, float* cos); 00036 00037 char* get_RFID() { return m_RFID; } 00038 int get_Type() { return m_Type; } 00039 int get_OutletNumber() { return m_OutletNumber; } 00040 float get_MeanValue() { return m_MeanValue; } 00041 float get_RMSValue() { return m_RMSValue; } 00042 float get_Gain() { return m_Gain; } 00043 int get_Offset() { return m_Offset; } 00044 float get_SineValue(int idx) { return m_Sin[idx]; } 00045 float get_CossineValue(int idx) { return m_Cos[idx]; } 00046 }; 00047 00048 typedef Mail<CaptureEvent,LENGTH_MAIL_BOX> CaptureMailbox; 00049 00050 class EventDetector 00051 { 00052 protected: 00053 00054 static CaptureMailbox m_EventMailbox; 00055 static const int m_EventLimit; 00056 00057 static EventDetector m_Detector[NUMBER_OF_CHANNELS]; 00058 00059 bool m_OutletTriggered; 00060 int m_EventCounter; 00061 int m_Channel; 00062 00063 void OnTrigger(float rmsvalue); 00064 00065 void SendMessage(int ext,float rmsvalue); 00066 00067 int TimeDelay(int t); 00068 00069 public: 00070 00071 EventDetector(int ch); 00072 00073 void ExternalTrigger(); 00074 00075 void ProcessEvent(float rmsvalue, int t); 00076 00077 void ShowValues(CaptureEvent* e); 00078 00079 static CaptureMailbox& GetMailbox() { return m_EventMailbox; } 00080 static EventDetector& get_Detector(int ch) { return m_Detector[ch]; } 00081 00082 }; 00083 00084 #endif
Generated on Fri Jul 15 2022 22:11:24 by
1.7.2