Touch.c 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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 "MS928x.h"
  13. #include "uart_transfer.h"
  14. /*********************************************************************
  15. * @fn main
  16. *
  17. * @brief Main program.
  18. *
  19. * @return none
  20. */
  21. void touch_init(void)
  22. {
  23. tmos_init();
  24. //#if AUTO_TEST
  25. // AutoTestInit();
  26. //#endif
  27. Touch_IIC_Init();
  28. #if USBCONFIG
  29. ConfigInit();
  30. uart_transfer_init(9600);
  31. #else
  32. uart_transfer_init(9600);
  33. #endif
  34. //
  35. // //CheckFlag();
  36. //
  37. MS928XInit();
  38. CHIP_TYPE chip_type = GetChipTypeFromFlash();
  39. if(IsBerlinSeries())
  40. {
  41. if(!IsBerlinChipType(chip_type) || chip_type==CHIP_TYPE_UNKNOW)
  42. {
  43. ChipType = CHIP_TYPE_BERLIND;
  44. }
  45. else
  46. {
  47. ChipType = chip_type;
  48. }
  49. isBerlinSeries = TRUE;
  50. }
  51. else
  52. {
  53. if(IsBerlinChipType(chip_type) || chip_type==CHIP_TYPE_UNKNOW)
  54. {
  55. ChipType = CHIP_TYPE_9XXX;
  56. }
  57. else
  58. {
  59. ChipType = chip_type;
  60. }
  61. isBerlinSeries = FALSE;
  62. }
  63. if(chip_type==CHIP_TYPE_UNKNOW)
  64. {
  65. IICTouchInit();
  66. // if(config.intf == EN_USB_IIC)
  67. // {
  68. // SoftResetChip();
  69. // }
  70. #if USB_EN
  71. dev_init(40, 40);
  72. usb_init();
  73. usb_device_init();
  74. #endif // USB_EN
  75. }
  76. else
  77. {
  78. // ChipType = CHIP_TYPE_BERLINB;
  79. PRINT("Chip type in flash is %d\n", chip_type);
  80. #if USB_EN
  81. dev_init(40, 40);
  82. usb_init();
  83. usb_device_init();
  84. #endif // USB_EN
  85. // if(config.intf == EN_USB_IIC)
  86. // {
  87. // while(UsbReportPosEn == FALSE);
  88. // }
  89. IICTouchInit();
  90. }
  91. PRINT("Initial finish\n");
  92. }
  93. void touch_process(void)
  94. {
  95. #if AUTO_TEST
  96. AutoTestHandle();
  97. #endif
  98. //CheckUart0Comand();
  99. // CheckTouchInt();
  100. CommandHandle();
  101. TMOS_SystemProcess();
  102. }