28 lines
715 B
C
28 lines
715 B
C
#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);
|
|
|
|
#endif // FIND_PEAKS_H
|