You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
1.6 KiB

  1. /*
  2. * @Author: sunlight 2524828700@qq.com
  3. * @Date: 2024-09-13 11:35:08
  4. * @LastEditors: sunlight 2524828700@qq.com
  5. * @LastEditTime: 2024-09-23 16:14:59
  6. * @FilePath: \auxiliary_addition\Usr\service\Processer\tjc_screen_process.c
  7. * @Description: Ĭ,`customMade`, koroFileHeader : https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  8. */
  9. #include "tjc_screen_process.h"
  10. #include <string.h>
  11. #include <stdbool.h>
  12. #include <stdio.h>
  13. #include "tjc_screen_event.h"
  14. #include "tjc_screen_page.h"
  15. #include "tjc_screen_receive.h"
  16. #include "usart.h"
  17. static packet_t packet;
  18. /***********************************************************************************************************************
  19. * ҳ *
  20. ***********************************************************************************************************************/
  21. void tjc_process_init(void) {
  22. printf("Init\n");
  23. tjc_receive_init(&huart2);
  24. regCallBack(tjc_process_page);
  25. }
  26. /*
  27. *
  28. * @brief ݰ
  29. *
  30. */
  31. void tjc_analysis_packet(uint8_t* packet, uint16_t len) {
  32. uint8_t packetType = packet[0];
  33. if (!(packet[len - 3] == 0xff && packet[len - 2] == 0xff && packet[len - 1] == 0xff)) {
  34. printf("packet end error\n");
  35. return;
  36. }
  37. // �¼�����
  38. event_process(packet);
  39. }
  40. /*
  41. *
  42. * @brief Ļ
  43. *
  44. */
  45. void tjc_processe(void) {
  46. tjc_date_pack(&packet);
  47. if (packet.len != 0) {
  48. tjc_analysis_packet(packet.date, packet.len);
  49. packet.len = 0;
  50. }
  51. }