61 lines
1.4 KiB
C
61 lines
1.4 KiB
C
/*
|
||
*Copyright ,2023 , NANOCHAP
|
||
*File name: MIAN.C
|
||
*Author:
|
||
*Version: V1.0
|
||
*Date: 2023-11-
|
||
*Description: 定时器电刺激综合测试(TIMER0 + 电刺激)
|
||
*Function List:
|
||
|
||
History:
|
||
1.V1.0
|
||
Date:
|
||
Author:
|
||
Modification: 初版
|
||
|
||
*/
|
||
#include "my_header.h"
|
||
#include "ENS1_MTP.h"
|
||
#include "ENS1_CLOCK.h"
|
||
#include "ENS1_UART.h"
|
||
#include "ENS1_TIMER.h"
|
||
#include "ENS1_GPIO.h"
|
||
#include "ENS1_WAVEGEN.h"
|
||
|
||
|
||
int main(){
|
||
// 初始化系统
|
||
MTP_init();
|
||
ClockInit();
|
||
|
||
// 初始化GPIO19用于定时器指示
|
||
GPIO_IO_Init(GPIO_19, OUTPUT, GPIO_OType_PP, GPIO_NOPULL, OUTPUT_FAST, PDRV_4mA, ENABLE);
|
||
GPIO_Output(GPIO_19, LOW_LEVEL);
|
||
|
||
// 初始化UART
|
||
UART_Init(CMSDK_UART1, &UART1_Init);
|
||
UART_ITConfig(CMSDK_UART1, &UART1_ITSet);
|
||
// 初始化时间管理器
|
||
Time_Manager_Init();
|
||
// 初始化定时器(在wavegen_Init之前)
|
||
TIMER0_Init(1);
|
||
|
||
// 初始化波形生成器(电刺激)
|
||
wavegen_Init();
|
||
|
||
// 配置电刺激参数
|
||
|
||
EMS_Configure(&ems_config);
|
||
|
||
// 启动电刺激
|
||
EMS_Start();
|
||
|
||
while(1)
|
||
{
|
||
//if ( time_count <= ems_config.ramp_up_time*1000 ) waves_per_step = (g_ems_config.intensity ) / (ems_config.ramp_up_time*1000);
|
||
//else if(time_count <= (ems_config.ramp_up_time+ems_config.hold_time+ems_config.ramp_down_time)*1000) waves_per_step = (g_ems_config.intensity - 0) / (ems_config.ramp_down_time*1000);
|
||
|
||
}
|
||
}
|
||
|