Touch.c 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /********************************** (C) COPYRIGHT *******************************
  2. * File Name : main.c
  3. * Author : Wingcool
  4. * Version : V1.0.0
  5. * Date : 2024/01/05
  6. * Description : Main program body.
  7. *********************************************************************************/
  8. #include "include.h"
  9. #include "GoodixTouch.h"
  10. #include "HidReport.h"
  11. #include "usb_com.h"
  12. //#include "uart_transfer.h"
  13. /*********************************************************************
  14. * @fn main
  15. *
  16. * @brief Main program.
  17. *
  18. * @return none
  19. */
  20. void touch_init(void)
  21. {
  22. tmos_init();
  23. //#if AUTO_TEST
  24. // AutoTestInit();
  25. //#endif
  26. Touch_IIC_Init();
  27. #if USBCONFIG
  28. ConfigInit();
  29. //uart_transfer_init(9600);
  30. #else
  31. uart_transfer_init(9600);
  32. #endif
  33. //
  34. // //CheckFlag();
  35. //
  36. //CHIP_TYPE chip_type = GetChipTypeFromFlash();
  37. /*
  38. if(IsBerlinSeries())
  39. {
  40. if(!IsBerlinChipType(chip_type) || chip_type==CHIP_TYPE_UNKNOW)
  41. {
  42. ChipType = CHIP_TYPE_BERLIND;
  43. }
  44. else
  45. {
  46. ChipType = chip_type;
  47. }
  48. isBerlinSeries = TRUE;
  49. }
  50. else
  51. {
  52. if(IsBerlinChipType(chip_type) || chip_type==CHIP_TYPE_UNKNOW)
  53. {
  54. ChipType = CHIP_TYPE_9XXX;
  55. }
  56. else
  57. {
  58. ChipType = chip_type;
  59. }
  60. isBerlinSeries = FALSE;
  61. }
  62. if(chip_type==CHIP_TYPE_UNKNOW)
  63. {
  64. IICTouchInit();
  65. // if(config.intf == EN_USB_IIC)
  66. // {
  67. // SoftResetChip();
  68. // }
  69. #if USB_EN
  70. dev_init(40, 40);
  71. usb_init();
  72. usb_device_init();
  73. #endif // USB_EN
  74. }
  75. else
  76. {
  77. // ChipType = CHIP_TYPE_BERLINB;
  78. PRINT("Chip type in flash is %d\n", chip_type);
  79. #if USB_EN
  80. dev_init(40, 40);
  81. usb_init();
  82. usb_device_init();
  83. #endif // USB_EN
  84. // if(config.intf == EN_USB_IIC)
  85. // {
  86. // while(UsbReportPosEn == FALSE);
  87. // }
  88. IICTouchInit();
  89. }
  90. */
  91. //chip_type = CHIP_TYPE_JD9366;
  92. ChipType = CHIP_TYPE_JD9366;
  93. isBerlinSeries = FALSE;
  94. IICTouchInit();
  95. PRINT("Initial finish\n");
  96. }
  97. void touch_process(void)
  98. {
  99. #if AUTO_TEST
  100. AutoTestHandle();
  101. #endif
  102. //CheckUart0Comand();
  103. // CheckTouchInt();
  104. CommandHandle();
  105. TMOS_SystemProcess();
  106. }