| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- #include "nim_config.h"
- #include "lwiplib.h"
- #include "lwipopts.h"
- #include "hlx.h"
- #define LEN_IP_ADDR (4u)
- #define ASCII_NUM_IDX (48u)
- void DeviceInit();
- char* dd;
- int main()
- {
- DeviceInit();
- ConsolePuts("\r\n ============NIM DSP START===========.\r\n", -1);
- lwip_tcp_init(TCP_SERVER_PORT); //开启本设备TCP服务器
- // 主循环
- float t = 0;
- #define ALGORITHM_SIZE 1000
- for (;;)
- {
- if(t>2){
- t=0;
- }
- t += 0.1;
- // 发送数据
- float ch1[ALGORITHM_SIZE];
- float ch2[ALGORITHM_SIZE];
- int i=0;
- for(i = 0;i<ALGORITHM_SIZE;i++)
- {
- ch1[i] = (t*i);
- }
- emg_denoised(ch1, ALGORITHM_SIZE, 1000, ch2);
- // 发送帧尾
- lwip_udp_send_vofa2(ch1,ch2,sizeof(ch1)/sizeof(float));
- // ConsoleRecvWait(10);
- // if (ConsoleRecvFlag() == REV_OK)
- // {
- // unsigned char *data = ConsoleRecvData();
- // lwip_udp_send_gui(sdata, sizeof(sdata));
- // ConsolePrintf("data %s,len %d,%d",sdata,sizeof(sdata),sizeof(struct pbuf));
- // ConsoleRecvClear();
- // }
- short s1[ALGORITHM_SIZE] = {0};
- for(i = 0;i<ALGORITHM_SIZE;i++)
- {
- s1[i] = i;
- }
- //lwip_udp_send_gui((unsigned char*)s1,sizeof(s1));
- HlxMain();
- }
- }
- /**
- * @title 全局中断
- */
- void InterruptInit(void)
- {
- // 初始化 DSP 中断控制器
- IntDSPINTCInit();
- // 使能 DSP 全局中断
- IntGlobalEnable();
- }
- /**
- * 设备初始化
- */
- void DeviceInit()
- {
- InterruptInit();
- ConsoleDeviceInit();//控制台初始化
- lwip_device_init(); //以太网模块初始化
- HlxInit();
- }
|