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

/*
* @Author: sunlight 2524828700@qq.com
* @Date: 2024-09-13 11:35:08
* @LastEditors: sunlight 2524828700@qq.com
* @LastEditTime: 2024-09-23 16:14:59
* @FilePath: \auxiliary_addition\Usr\service\Processer\tjc_screen_process.c
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
#include "tjc_screen_process.h"
#include <string.h>
#include <stdbool.h>
#include <stdio.h>
#include "tjc_screen_event.h"
#include "tjc_screen_page.h"
#include "tjc_screen_receive.h"
#include "usart.h"
static packet_t packet;
/***********************************************************************************************************************
* 页面处理变量 *
***********************************************************************************************************************/
void tjc_process_init(void) {
printf("Init\n");
tjc_receive_init(&huart2);
regCallBack(tjc_process_page);
}
/*
*
* @brief 数据包解析
*
*/
void tjc_analysis_packet(uint8_t* packet, uint16_t len) {
uint8_t packetType = packet[0];
if (!(packet[len - 3] == 0xff && packet[len - 2] == 0xff && packet[len - 1] == 0xff)) {
printf("packet end error\n");
return;
}
// 事件处理
event_process(packet);
}
/*
*
* @brief 屏幕处理
*
*/
void tjc_processe(void) {
tjc_date_pack(&packet);
if (packet.len != 0) {
tjc_analysis_packet(packet.date, packet.len);
packet.len = 0;
}
}