2025-04-22 02:29:37 +00:00
|
|
|
#ifndef FIND_PEAKS_H // 防止头文件重复包含[3,6,7](@ref)
|
|
|
|
#define FIND_PEAKS_H
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <math.h>
|
|
|
|
#include <main.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
|
|
|
|
#define SAMPLE_RATE 50
|
|
|
|
#define WINDOW_SIZE 50
|
|
|
|
#define DATA_LENGTH 600
|
|
|
|
#define MIN_PEAK_DISTANCE 30 // 0.8Hz最低间隔(50/1.6≈30点)
|
|
|
|
#define MOVING_AVG_WINDOW 5 // 滑动窗口大小
|
|
|
|
#define MAX_CANDIDATES 100 // 根据实际信号特征调整
|
|
|
|
#define DYNAMIC_THRESH_RATIO 0.6f
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
int peaks[60]; // 静态数组避免动态内存分配
|
|
|
|
float thresholds[DATA_LENGTH]; // 存储动态阈值
|
|
|
|
int count;
|
|
|
|
} PeakResult;
|
|
|
|
|
|
|
|
|
|
|
|
int time_domain_heart_rate(float* hp_data);
|
2025-05-09 08:25:05 +00:00
|
|
|
int fast_select_hr(const float candidates[4], const float *data, float *fft_energy_ratios);
|
2025-04-22 02:29:37 +00:00
|
|
|
|
|
|
|
#endif // FIND_PEAKS_H
|