main.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #include "nim_config.h"
  2. #include "lwiplib.h"
  3. #include "lwipopts.h"
  4. #include "hlx.h"
  5. #define LEN_IP_ADDR (4u)
  6. #define ASCII_NUM_IDX (48u)
  7. void DeviceInit();
  8. double inputdata[2000]={0};
  9. double outputdata[2000]={0};
  10. int main()
  11. {
  12. DeviceInit();
  13. ConsolePuts("\r\n ============NIM DSP START===========.\r\n", -1);
  14. lwip_tcp_init(TCP_SERVER_PORT); //开启本设备TCP服务器
  15. struct udp_pcb *upcb = udp_new();
  16. lwip_udp_connect(upcb, UI_IP_ADDRESS, UI_UDP_PORT);
  17. //emg_denoised(inputdata,2000,1000,outputdata);
  18. // 主循环
  19. for (;;)
  20. {
  21. // ConsoleRecvWait(10);
  22. // if (ConsoleRecvFlag() == REV_OK)
  23. // {
  24. // unsigned char *data = ConsoleRecvData();
  25. // lwip_udp_send(upcb, data, ConsoleRecvLen());
  26. // ConsoleRecvClear();
  27. // }
  28. HlxMain();
  29. }
  30. }
  31. /**
  32. * @title 全局中断
  33. */
  34. void InterruptInit(void)
  35. {
  36. // 初始化 DSP 中断控制器
  37. IntDSPINTCInit();
  38. // 使能 DSP 全局中断
  39. IntGlobalEnable();
  40. }
  41. /**
  42. * 设备初始化
  43. */
  44. void DeviceInit()
  45. {
  46. InterruptInit();
  47. ConsoleDeviceInit();//控制台初始化
  48. lwip_device_init(); //以太网模块初始化
  49. HlxInit();
  50. }