| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- /**
- * @file ALGO_WaveAnalyse_ATY.h
- *
- * @param Project ALGO_Algorithm_ATY_LIB
- *
- * @author ATY
- *
- * @copyright
- * - Copyright 2017 - 2025 MZ-ATY
- * - This code follows:
- * - MZ-ATY Various Contents Joint Statement -
- * <a href="https://mengze.top/MZ-ATY_VCJS">
- * https://mengze.top/MZ-ATY_VCJS</a>
- * - CC 4.0 BY-NC-SA -
- * <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/">
- * https://creativecommons.org/licenses/by-nc-sa/4.0/</a>
- * - Your use will be deemed to have accepted the terms of this statement.
- *
- * @brief Familiar functions of wave analyse from ad
- *
- * @version
- * - 1_01_220601 > ATY
- * -# Preliminary version, first Release
- * - Undone
- ********************************************************************************
- */
- #ifndef __ALGO_WaveAnalyse_ATY_H
- #define __ALGO_WaveAnalyse_ATY_H
- #include "INCLUDE_ATY.h"
- /******************************* For user *************************************/
- // #define __DEBUG_ALGO_WaveAnalyse_ATY
- /******************************************************************************/
- extern uint16_t wave_lastWaveAve_Kalman;
- extern uint16_t wave_firstWavePeakPoint, wave_firstWaveZeroPoint;
- extern uint16_t wave_quarterSpace;
- extern uint16_t wave_maxVpp;
- #define WAVE_DISPLAY_NUM 100
- #define WAVE_DISPLAY_PEAK_HIGH (wave_lastWaveAve_Kalman + (WAVE_DISPLAY_NUM * 2))
- #define WAVE_DISPLAY_PEAK_LOW (wave_lastWaveAve_Kalman - (WAVE_DISPLAY_NUM * 2))
- #define WAVE_DISPLAY_ZERO_RAISE (wave_lastWaveAve_Kalman + WAVE_DISPLAY_NUM)
- #define WAVE_DISPLAY_ZERO_FALL (wave_lastWaveAve_Kalman - WAVE_DISPLAY_NUM)
- #define WAVE_BASE_AVE (wave_lastWaveAve_Kalman)
- #define WAVE_KALMAN_ATTENUATION 2
- void WavePeakZeroPointFind(
- uint16_t* inputWave,
- uint16_t* kalmanWave,
- uint16_t* deepKalmanWave,
- uint16_t* peakZeroPoints,
- uint16_t size);
- #define WAVE_FIRST_COUNT 10
- #define WAVE_FIRST_THRESHOLD_V 25
- #define FIRST_THRESHOLD_HIGH (wave_lastWaveAve_Kalman + WAVE_FIRST_THRESHOLD_V)
- #define FIRST_THRESHOLD_LOW (wave_lastWaveAve_Kalman - WAVE_FIRST_THRESHOLD_V)
- void WaveFirstPulseFind(uint16_t* inputWave, uint16_t* peakZeroPoints, uint16_t size);
- // trans time(12bit@36MHz ADCCLK) = point to point time
- // 15 x 1_000_000us / 36_000_000Hz = 5/12us = 0.4167us
- #define ADC_TIME_UNIT (15.0 / 36.0)
- void WaveParamCalc(uint16_t* peakZeroPoints, uint16_t firstWavePoint, uint16_t size);
- void WaveVppCalc(uint16_t* peakZeroPoints, uint16_t* kalmanWave, uint16_t size);
- void WaveWholeProcess(
- uint16_t* inputWave,
- uint16_t* kalmanWave,
- uint16_t* deepKalmanWave,
- uint16_t* peakZeroPoints,
- uint16_t size);
- #ifdef __DEBUG_WAVE_ATY
- #define TEST_WAVE_SIZE 5000
- extern uint16_t kalmanWave_Test[TEST_WAVE_SIZE];
- extern uint16_t deepKalmanWave_Test[TEST_WAVE_SIZE];
- extern uint16_t peakZeroPoints_Test[TEST_WAVE_SIZE];
- void WaveAnalyse_Test(uint16_t* testDataIn, uint8_t WAVE_DISPLAY_FLAG);
- #endif /* __DEBUG_WAVE_ATY */
- // float ALGO_WaterDensityFromTemp(float temperature);
- // float ALGO_EConductanceFromRes(float Res);
- // float ALGO_ResistivityFromRes(float Res, float A, float L);
- // float ALGO_ConductivityFromRes(float Res, float A, float L);
- // float ALGO_MolarityFromConductivity(float Conductivity, float MC);
- // float ALGO_MassConcentrationFromMolarity(float Molarity, float MM);
- #endif /* __ALGO_WaveAnalyse_ATY_H */
- /******************************** End Of File *********************************/
|