Electricity/FWLIB/include/ENS1_WAVEGEN.h

64 lines
1.8 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
*Copyright (C),2023 , NANOCHAP
*File name: ENS1_WAVEGEN.H
*Author:
*Version: V1.0
*Date: 2023-11-
*Description: 波形生成器电刺激功能
*Function List:
1 int wavegen_driverA_sine_test(CMSDK_WAVE_GEN_TypeDef *CMSDK_WAVEGEN_DRVA, uint16_t incount);
2 void wavegen_Stop(CMSDK_WAVE_GEN_TypeDef *CMSDK_WAVEGEN_DRVA);
3 void wavegen_Init(void);
4 void wavegen_Start(void);
History:
1.V1.0
Date:
Author:
Modification: 初版
*/
#ifndef ENS1_WAVEGEN_H
#define ENS1_WAVEGEN_H
#include "CMSDK_CM0.h"
#include "my_header.h"
// 波形生成器驱动器A正弦波测试
int wavegen_driverA_sine_test(CMSDK_WAVE_GEN_TypeDef *CMSDK_WAVEGEN_DRVA, uint16_t incount);
// 停止波形生成器
void wavegen_Stop(CMSDK_WAVE_GEN_TypeDef *CMSDK_WAVEGEN_DRVA);
// 初始化波形生成器
void wavegen_Init(void);
// 启动波形生成器
void wavegen_Start(void);
// 电刺激参数配置
typedef struct {
uint16_t frequency; // 频率 (Hz)
uint16_t duration; // 持续时间 (ms)
uint16_t intensity; // 强度 (0-255)
uint16_t rest_time; // 休息时间 (ms)
uint16_t silent_time; // 静默时间 (ms)
// 缓进缓出控制参数
uint8_t ramp_up_time; // 缓进时间2秒
uint8_t hold_time; // 保持时间6秒
uint8_t ramp_down_time; // 缓出时间2秒
uint8_t enable_ramp; // 启用渐进控制
} EMS_Config_TypeDef;
extern uint16_t time_count;
extern float waves_per_step;
extern EMS_Config_TypeDef g_ems_config;
// 电刺激控制函数
void EMS_Configure(EMS_Config_TypeDef *config);
void EMS_Start(void);
void EMS_Stop(void);
void EMS_UpdateIntensity(uint16_t intensity);
void EMS_Process(void);
void EMS_Process_Ramp(void); // 缓进缓出处理函数
extern EMS_Config_TypeDef ems_config;
#endif