96 lines
3.8 KiB
C
96 lines
3.8 KiB
C
|
/*
|
||
|
* @Description:
|
||
|
* @Version: 1.0
|
||
|
* @Author: lzc
|
||
|
* @Date: 2023-07-18 13:01:33
|
||
|
* @LastEditors: lzc
|
||
|
* @LastEditTime: 2024-07-24 16:22:01
|
||
|
*/
|
||
|
#ifndef __MY_BAND_FITTER_H
|
||
|
#define __MY_BAND_FITTER_H
|
||
|
#include "main.h"
|
||
|
#include "MyTool.h"
|
||
|
#include "arm_math.h"
|
||
|
#include "MyAlgorithm.h"
|
||
|
//------------------------------------------------------------------------------
|
||
|
#define numStages 2 /* 2阶IIR滤波的个数 */
|
||
|
#define BLOCK_SIZE 1 /* 调用一次arm_biquad_cascade_df1_f32处理的采样点个数 */
|
||
|
#define IGNORE_LENGTH 0 /* 忽略点数 */
|
||
|
#define LENGTH_SAMPLES 200 /* 采样点数 */
|
||
|
#define TEST_LENGTH_SAMPLES 200 /* 用于测试采样点数 */
|
||
|
|
||
|
#define LENGTH_SAMPLES_BREATH 800 /* 呼吸采样点数 */
|
||
|
#define LENGTH_SAMPLES_HEART 800 /* 心率采样点数 */
|
||
|
|
||
|
#define BREATH_FITTER_LENGTH 2400 /* 呼吸的采样点数 */
|
||
|
#define BREATH_IGNORE_LENGTH 1600 /* 呼吸的忽略点数 */
|
||
|
|
||
|
#define HEART_FITTER_LENGTH 800 /* 心率的采样点数 */
|
||
|
#define HEART_IGNORE_LENGTH 200 /* 心率的忽略点数 */
|
||
|
|
||
|
#define LENGTH_SAMPLES_IN_OFF_BED 250 /* 在 离床的采样点数 */
|
||
|
#define LENGTH_IGNORE_IN_OFF_BED 1950 /* 在 离床的采样点数 */
|
||
|
|
||
|
extern char i_count_No_Breath;
|
||
|
|
||
|
static float32_t IIRStateF32[4 * numStages]; /* 状态缓存 */
|
||
|
// static float32_t FitterOutputData[LENGTH_SAMPLES]; /* 滤波后的输出 */
|
||
|
|
||
|
typedef struct BandFitterConfig_T
|
||
|
{
|
||
|
int End_Pos;
|
||
|
int Start_Pos;
|
||
|
float32_t IIR_Coeff[5 * numStages];
|
||
|
float32_t IIR_ScaleValue[numStages];
|
||
|
} BandFitterConfig_t;
|
||
|
|
||
|
extern arm_biquad_casd_df1_inst_f32 HeartPart;
|
||
|
extern arm_biquad_casd_df1_inst_f32 BreathPart;
|
||
|
extern arm_biquad_casd_df1_inst_f32 CheckPart;
|
||
|
extern arm_biquad_casd_df1_inst_f32 HeartPart_NoCut;
|
||
|
|
||
|
extern float32_t FitterOPMData_CheckBed[LENGTH_SAMPLES_IN_OFF_BED];
|
||
|
|
||
|
extern float32_t FitterOPMData_Heart[HEART_FITTER_LENGTH];
|
||
|
extern float32_t FitterOPMData_Breath[BREATH_FITTER_LENGTH - BREATH_IGNORE_LENGTH];
|
||
|
|
||
|
extern float32_t outPutFitterOPMData_Heart[HEART_FITTER_LENGTH - HEART_IGNORE_LENGTH];
|
||
|
extern float32_t outPutFitterOPMData_Breath[BREATH_FITTER_LENGTH - BREATH_IGNORE_LENGTH];
|
||
|
extern float32_t outPutFitterOPMData_Heart_Lo[HEART_FITTER_LENGTH - HEART_IGNORE_LENGTH];
|
||
|
|
||
|
extern float32_t OPM_Data[LENGTH_SAMPLES_BREATH];
|
||
|
|
||
|
extern const float32_t IIRCoeffs32BP[5 * numStages];
|
||
|
extern const float32_t IIRCoeffs32BP_Heart[5 * numStages];
|
||
|
extern const float32_t IIRCoeffs32BP_Breath[5 * numStages];
|
||
|
extern const float32_t IIRCoeffs32BP_Heart_NoCut[5 * numStages];
|
||
|
|
||
|
extern const float32_t IIRs32BPScaleValue[numStages];
|
||
|
extern const float32_t IIRs32BPScaleValue_Heart[numStages];
|
||
|
extern const float32_t IIRs32BPScaleValue_Breath[numStages];
|
||
|
extern const float32_t IIRs32BPScaleValue_Heart_NoCut[numStages];
|
||
|
|
||
|
void arm_iir_f32_bp(float32_t *Input,
|
||
|
float32_t *Output,
|
||
|
BandFitterConfig_t FitterConfig);
|
||
|
|
||
|
void arm_iir_f32_bp_stream_Init(BandFitterConfig_t FitterConfig);
|
||
|
void arm_iir_f32_bp_stream_Output(float32_t *Input, float32_t *Output, BandFitterConfig_t FitterConfig);
|
||
|
|
||
|
void arm_iir_f32_bp_stream_Heart_Output(float32_t *Input, float32_t *Output);
|
||
|
void arm_iir_f32_bp_stream_Heart_Output_NoCut(float32_t *Input, float32_t *Output);
|
||
|
void arm_iir_f32_bp_stream_Heart_Output_NoCut_2(float32_t *Input, float32_t *Output);
|
||
|
|
||
|
void arm_iir_f32_bp_stream_Breath_Output(float32_t *Input, float32_t *Output);
|
||
|
|
||
|
void myFitterLocal_Hr(const arm_biquad_casd_df1_inst_f32 *S,
|
||
|
float32_t *Input, float32_t *Output, int Length, float ScaleValue);
|
||
|
void myFitterLocal_Br(const arm_biquad_casd_df1_inst_f32 *S,
|
||
|
float32_t *Input, float32_t *Output, int Length, float ScaleValue);
|
||
|
|
||
|
//----------------------------------------------------------------//
|
||
|
|
||
|
void breathInBedCheck(float32_t *Input);
|
||
|
void stream_Heart_Output(float32_t *Input);
|
||
|
#endif
|