123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- #ifndef GLOBALINFO_H
- #define GLOBALINFO_H
- #include <mutex>
- /* 示波器通道 */
- enum class OscChannel
- {
- CH_A = 0,
- CH_B,
- };
- /* 示波器通道耦合方式 */
- enum class OscChannelCoupling
- {
- AC = 0,
- DC,
- };
- /* 示波器采样率,目前就只要这些 */
- enum class OscSampleRate
- {
- SR_49KHZ = 0,
- SR_96KHZ,
- SR_781KHZ,
- SR_12_5MHZ,
- SR_100MHZ,
- };
- /* 示波器通道的输入档位 */
- enum class OscChannelRange
- {
- CR_100MV = 0,
- CR_250MV,
- CR_500MV,
- CR_1V,
- CR_2V5,
- CR_5V,
- CR_8V,
- };
- /* 触发方式 */
- enum class OscTriggerMode
- {
- TM_RISE = 0, /* 上升沿触发 */
- TM_DOWN, /* 下降沿触发 */
- TM_DOUBLE, /* 双边沿触发 */
- };
- /* 触发灵敏度 */
- enum class OscTriggerSensitivity
- {
- TS_LOW = 0, /* 低灵敏度 */
- TS_HIGH, /* 高灵敏度 */
- };
- struct EyeDataT
- {
- bool isEyeData;
- unsigned char value;
- EyeDataT() : isEyeData(false), value(0) {}
- EyeDataT(bool isOpen, unsigned char val) : isEyeData(isOpen), value(val) {}
- EyeDataT& operator=(const EyeDataT& data)
- {
- isEyeData = data.isEyeData;
- value = data.value;
- return *this;
- }
- };
- /* 眼图数据点 */
- struct EyeDataSample
- {
- int x;
- int y;
- double fCnt;
- int Cnt;
- unsigned char data;
- EyeDataSample() : x(0), y(0), fCnt(0.0), Cnt(0), data(0) {}
- EyeDataSample(int x, int y, double fCnt, int Cnt, unsigned char data)
- : x(x), y(y), fCnt(fCnt), Cnt(Cnt), data(data) {}
- EyeDataSample& operator=(const EyeDataSample& data)
- {
- x = data.x;
- y = data.y;
- fCnt = data.fCnt;
- Cnt = data.Cnt;
- this->data = data.data;
- return *this;
- }
- };
- /**
- * @brief 眼图数据
- *
- */
- class EyeDataMatrix
- {
- public:
- EyeDataMatrix();
- ~EyeDataMatrix();
- EyeDataSample dataMatrix[1000][256];
- std::mutex mutexEyeData;
-
- void addData(int x, int y);
- void eyeStatisticalWeight();
- void eyeLessenTheBurden();
- EyeDataSample** eyeZoomOut();
- private:
- double eyenWeightCoefficient = 0.99;
- bool eyeIsLessenTheBurden = true;
- double eyenWeightCoefficientMIN = 1E-06;
- };
- extern EyeDataMatrix g_eyeDataMatrix;
- #endif /* GLOBALINFO_H */
|