From 8df0014a79c51af93a65c3b5b128c8baf3571a23 Mon Sep 17 00:00:00 2001 From: kidneygood <2979564623@qq.com> Date: Mon, 9 Jan 2023 21:50:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BB=BA=E7=AB=8B=E9=80=9A=E4=BF=A1=EF=BC=8C?= =?UTF-8?q?=E9=AA=8C=E8=AF=81=E5=9B=BE=E5=BD=A2=E7=BB=98=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HAL_N_Middlewares/Src/main.c | 12 +- modules/referee/crc.c | 26 +- modules/referee/referee.c | 2 + modules/referee/referee_UI.c | 514 ++++++++++++++--------------------- modules/referee/referee_UI.h | 36 ++- 5 files changed, 246 insertions(+), 344 deletions(-) diff --git a/HAL_N_Middlewares/Src/main.c b/HAL_N_Middlewares/Src/main.c index 13aa79d..4c31f58 100644 --- a/HAL_N_Middlewares/Src/main.c +++ b/HAL_N_Middlewares/Src/main.c @@ -119,11 +119,15 @@ int main(void) ////////////////////////////////////////////////// - // Graph_Data shoot_line; + Graph_Data graph[5]; UI_Delete(UI_Data_Del_ALL,0); - // //绘制发射基准线 - // Line_Draw(&shoot_line,"s1",UI_Graph_ADD,7,UI_Color_White,3,710,540,1210,540); - // UI_ReFresh(1,shoot_line); + Line_Draw(&graph[0],"s0",UI_Graph_ADD,0,UI_Color_White,3,710,540,1210,540); + Rectangle_Draw(&graph[1],"s1",UI_Graph_ADD,1,UI_Color_Yellow,4,600,200,800,500); + Circle_Draw(&graph[2],"s2",UI_Graph_ADD,2,UI_Color_Green,5,960,540,100); + Elliptical_Draw(&graph[3],"s3",UI_Graph_ADD,3,UI_Color_Orange,3,960,540,100,20); + Arc_Draw(&graph[4],"s4",UI_Graph_ADD,4,UI_Color_Purplish_red,30,160,3,1200,550,50,100); + UI_ReFresh(5,graph[0],graph[1],graph[2],graph[3],graph[4]); + ////////////////////////////////////////////////// /* USER CODE END 2 */ diff --git a/modules/referee/crc.c b/modules/referee/crc.c index a0cd359..c16b938 100644 --- a/modules/referee/crc.c +++ b/modules/referee/crc.c @@ -136,20 +136,18 @@ void Append_CRC8_Check_Sum( uint8_t *pchMessage, uint16_t dwLength) */ uint16_t Get_CRC16_Check_Sum(uint8_t *pchMessage,uint32_t dwLength,uint16_t wCRC) { - uint8_t chData; - - if (pchMessage == NULL) - { - return 0xFFFF; - } - while(dwLength--) - { - chData = *pchMessage++; - (wCRC) = ((uint16_t)(wCRC) >> 8) ^ - wCRC_Table[((uint16_t)(wCRC) ^ (uint16_t)(chData)) & 0x00ff]; - } - - return wCRC; + uint8_t chData; + if (pchMessage == NULL) + { + return 0xFFFF; + } + while(dwLength--) + { + chData = *pchMessage++; + (wCRC) = ((uint16_t)(wCRC) >> 8) ^ + wCRC_Table[((uint16_t)(wCRC) ^ (uint16_t)(chData)) & 0x00ff]; + } + return wCRC; } diff --git a/modules/referee/referee.c b/modules/referee/referee.c index 7cc9679..96df982 100644 --- a/modules/referee/referee.c +++ b/modules/referee/referee.c @@ -33,6 +33,8 @@ referee_info_t *RefereeInit(UART_HandleTypeDef *referee_usart_handle) void RefereeSend(uint8_t *send,uint16_t tx_len) { USARTSend(referee_usart_instance,send,tx_len); + /* syhtodo DMA请求过快会导致数据发送丢失,考虑数据尽可能打成一阵个包 */ + HAL_Delay(1); } diff --git a/modules/referee/referee_UI.c b/modules/referee/referee_UI.c index 6fbf7c1..994d5d3 100644 --- a/modules/referee/referee_UI.c +++ b/modules/referee/referee_UI.c @@ -10,11 +10,6 @@ uint16_t Robot_ID = UI_Data_RobotID_BHero; uint16_t Cilent_ID = UI_Data_CilentID_BHero; unsigned char UI_Seq; //包序号 -/****************************************串口驱动映射************************************/ -void UI_SendByte(unsigned char ch) -{ - HAL_UART_Transmit_DMA(&huart6,&ch,1); -} /********************************************删除操作************************************* **参数:Del_Operate 对应头文件删除操作 @@ -22,7 +17,7 @@ void UI_SendByte(unsigned char ch) *****************************************************************************************/ void UI_Delete(uint8_t Del_Operate,uint8_t Del_Layer) { - +/* syhtodo可化简,去掉读写指针 */ unsigned char *framepoint; //读写指针 uint16_t frametail=0xFFFF; //CRC16校验值 @@ -35,7 +30,7 @@ void UI_Delete(uint8_t Del_Operate,uint8_t Del_Layer) framehead.SOF=UI_SOF; framehead.Data_Length=8; framehead.Seq=UI_Seq; - framehead.CRC8=Get_CRC8_Check_Sum_UI(framepoint,4,0xFF); + framehead.CRC8=Get_CRC8_Check_Sum(framepoint,4,0xFF); framehead.CMD_ID=UI_CMD_Robo_Exchange; //填充包头数据 datahead.Data_ID=UI_Data_ID_Del; @@ -45,11 +40,11 @@ void UI_Delete(uint8_t Del_Operate,uint8_t Del_Layer) del.Delete_Operate=Del_Operate; del.Layer=Del_Layer; //控制信息 - frametail=Get_CRC16_Check_Sum_UI(framepoint,sizeof(framehead),frametail); + frametail=Get_CRC16_Check_Sum(framepoint,sizeof(framehead),frametail); framepoint=(unsigned char *)&datahead; - frametail=Get_CRC16_Check_Sum_UI(framepoint,sizeof(datahead),frametail); + frametail=Get_CRC16_Check_Sum(framepoint,sizeof(datahead),frametail); framepoint=(unsigned char *)&del; - frametail=Get_CRC16_Check_Sum_UI(framepoint,sizeof(del),frametail); //CRC16校验值计算 + frametail=Get_CRC16_Check_Sum(framepoint,sizeof(del),frametail); //CRC16校验值计算 RefereeSend((uint8_t *)&framehead,sizeof(framehead)); RefereeSend((uint8_t *)&datahead,sizeof(datahead)); @@ -59,150 +54,202 @@ void UI_Delete(uint8_t Del_Operate,uint8_t Del_Layer) UI_Seq++; //包序号+1 } /************************************************绘制直线************************************************* -**参数:*image Graph_Data类型变量指针,用于存放图形数据 - imagename[3] 图片名称,用于标识更改 +**参数:*graph Graph_Data类型变量指针,用于存放图形数据 + graphname[3] 图片名称,用于标识更改 Graph_Operate 图片操作,见头文件 Graph_Layer 图层0-9 Graph_Color 图形颜色 Graph_Width 图形线宽 - Start_x、Start_y 开始坐标 - End_x、End_y 结束坐标 + Start_x、Start_y 起点xy坐标 + End_x、End_y 终点xy坐标 **********************************************************************************************************/ -void Line_Draw(Graph_Data *image,char imagename[3],uint32_t Graph_Operate,uint32_t Graph_Layer,uint32_t Graph_Color,uint32_t Graph_Width,uint32_t Start_x,uint32_t Start_y,uint32_t End_x,uint32_t End_y) +void Line_Draw(Graph_Data *graph,char graphname[3],uint32_t Graph_Operate,uint32_t Graph_Layer,uint32_t Graph_Color, + uint32_t Graph_Width,uint32_t Start_x,uint32_t Start_y,uint32_t End_x,uint32_t End_y) { int i; - for(i=0;i<3&&imagename[i]!='\0';i++) - image->graphic_name[2-i]=imagename[i]; - image->operate_tpye = Graph_Operate; - image->layer = Graph_Layer; - image->color = Graph_Color; - image->width = Graph_Width; - image->start_x = Start_x; - image->start_y = Start_y; - image->end_x = End_x; - image->end_y = End_y; + //?????? + for(i=0;i<3&&graphname[i]!='\0';i++) + { + graph->graphic_name[2-i]=graphname[i]; + } + + graph->operate_tpye = Graph_Operate; + graph->graphic_tpye = UI_Graph_Line; + graph->layer = Graph_Layer; + graph->color = Graph_Color; + + graph->width = Graph_Width; + graph->start_x = Start_x; + graph->start_y = Start_y; + graph->end_x = End_x; + graph->end_y = End_y; } /************************************************绘制矩形************************************************* -**参数:*image Graph_Data类型变量指针,用于存放图形数据 - imagename[3] 图片名称,用于标识更改 +**参数:*graph Graph_Data类型变量指针,用于存放图形数据 + graphname[3] 图片名称,用于标识更改 Graph_Operate 图片操作,见头文件 Graph_Layer 图层0-9 Graph_Color 图形颜色 Graph_Width 图形线宽 - Start_x、Start_y 开始坐标 - End_x、End_y 结束坐标(对顶角坐标) -**********************************************************************************************************/ - -void Rectangle_Draw(Graph_Data *image,char imagename[3],uint32_t Graph_Operate,uint32_t Graph_Layer,uint32_t Graph_Color,uint32_t Graph_Width,uint32_t Start_x,uint32_t Start_y,uint32_t End_x,uint32_t End_y) + Start_x、Start_y 起点xy坐标 + End_x、End_y 对角顶点xy坐标 +**********************************************************************************************************/ +void Rectangle_Draw(Graph_Data *graph,char graphname[3],uint32_t Graph_Operate,uint32_t Graph_Layer,uint32_t Graph_Color, + uint32_t Graph_Width,uint32_t Start_x,uint32_t Start_y,uint32_t End_x,uint32_t End_y) { int i; - for(i=0;i<3&&imagename[i]!='\0';i++) - image->graphic_name[2-i]=imagename[i]; - image->graphic_tpye = UI_Graph_Rectangle; - image->operate_tpye = Graph_Operate; - image->layer = Graph_Layer; - image->color = Graph_Color; - image->width = Graph_Width; - image->start_x = Start_x; - image->start_y = Start_y; - image->end_x = End_x; - image->end_y = End_y; + for(i=0;i<3&&graphname[i]!='\0';i++) + { + graph->graphic_name[2-i]=graphname[i]; + } + + graph->graphic_tpye = UI_Graph_Rectangle; + graph->operate_tpye = Graph_Operate; + graph->layer = Graph_Layer; + graph->color = Graph_Color; + + graph->width = Graph_Width; + graph->start_x = Start_x; + graph->start_y = Start_y; + graph->end_x = End_x; + graph->end_y = End_y; } /************************************************绘制整圆************************************************* -**参数:*image Graph_Data类型变量指针,用于存放图形数据 - imagename[3] 图片名称,用于标识更改 +**参数:*graph Graph_Data类型变量指针,用于存放图形数据 + graphname[3] 图片名称,用于标识更改 Graph_Operate 图片操作,见头文件 Graph_Layer 图层0-9 Graph_Color 图形颜色 Graph_Width 图形线宽 - Start_x、Start_y 圆心坐标 - Graph_Radius 图形半径 + Start_x、Start_y 圆心xy坐标 + Graph_Radius 圆形半径 **********************************************************************************************************/ -void Circle_Draw(Graph_Data *image,char imagename[3],uint32_t Graph_Operate,uint32_t Graph_Layer,uint32_t Graph_Color,uint32_t Graph_Width,uint32_t Start_x,uint32_t Start_y,uint32_t Graph_Radius) +void Circle_Draw(Graph_Data *graph,char graphname[3],uint32_t Graph_Operate,uint32_t Graph_Layer,uint32_t Graph_Color, + uint32_t Graph_Width,uint32_t Start_x,uint32_t Start_y,uint32_t Graph_Radius) { int i; - for(i=0;i<3&&imagename[i]!='\0';i++) - image->graphic_name[2-i]=imagename[i]; - image->graphic_tpye = UI_Graph_Circle; - image->operate_tpye = Graph_Operate; - image->layer = Graph_Layer; - image->color = Graph_Color; - image->width = Graph_Width; - image->start_x = Start_x; - image->start_y = Start_y; - image->radius = Graph_Radius; -} + for(i=0;i<3&&graphname[i]!='\0';i++) + { + graph->graphic_name[2-i]=graphname[i]; + } -/************************************************绘制圆弧************************************************* -**参数:*image Graph_Data类型变量指针,用于存放图形数据 - imagename[3] 图片名称,用于标识更改 + graph->graphic_tpye = UI_Graph_Circle; + graph->operate_tpye = Graph_Operate; + graph->layer = Graph_Layer; + graph->color = Graph_Color; + + graph->width = Graph_Width; + graph->start_x = Start_x; + graph->start_y = Start_y; + graph->radius = Graph_Radius; +} +/************************************************绘制椭圆************************************************* +**参数:*graph Graph_Data类型变量指针,用于存放图形数据 + graphname[3] 图片名称,用于标识更改 Graph_Operate 图片操作,见头文件 Graph_Layer 图层0-9 Graph_Color 图形颜色 - Graph_StartAngle,Graph_EndAngle 开始,终止角度 - Graph_Width 图形线宽 - Start_y,Start_y 圆心坐标 - x_Length,y_Length x,y方向上轴长,参考椭圆 + Graph_Width 图形线宽 + Start_x、Start_y 圆心xy坐标 + End_x、End_y xy半轴长度 **********************************************************************************************************/ - -void Arc_Draw(Graph_Data *image,char imagename[3],uint32_t Graph_Operate,uint32_t Graph_Layer,uint32_t Graph_Color,uint32_t Graph_StartAngle,uint32_t Graph_EndAngle,uint32_t Graph_Width,uint32_t Start_x,uint32_t Start_y,uint32_t x_Length,uint32_t y_Length) +void Elliptical_Draw(Graph_Data *graph,char graphname[3],uint32_t Graph_Operate,uint32_t Graph_Layer,uint32_t Graph_Color, + uint32_t Graph_Width,uint32_t Start_x,uint32_t Start_y,uint32_t end_x,uint32_t end_y) { int i; - - for(i=0;i<3&&imagename[i]!='\0';i++) - image->graphic_name[2-i]=imagename[i]; - image->graphic_tpye = UI_Graph_Arc; - image->operate_tpye = Graph_Operate; - image->layer = Graph_Layer; - image->color = Graph_Color; - image->width = Graph_Width; - image->start_x = Start_x; - image->start_y = Start_y; - image->start_angle = Graph_StartAngle; - image->end_angle = Graph_EndAngle; - image->end_x = x_Length; - image->end_y = y_Length; + for(i=0;i<3&&graphname[i]!='\0';i++) + { + graph->graphic_name[2-i]=graphname[i]; + } + + graph->graphic_tpye = UI_Graph_Ellipse; + graph->operate_tpye = Graph_Operate; + graph->layer = Graph_Layer; + graph->color = Graph_Color; + graph->width = Graph_Width; + + graph->start_x = Start_x; + graph->start_y = Start_y; + graph->end_x = end_x; + graph->end_y = end_y; +} + + +/************************************************绘制圆弧************************************************* +**参数:*graph Graph_Data类型变量指针,用于存放图形数据 + graphname[3] 图片名称,用于标识更改 + Graph_Operate 图片操作,见头文件 + Graph_Layer 图层0-9 + Graph_Color 图形颜色 + Graph_StartAngle,Graph_EndAngle 起始终止角度 + Graph_Width 图形线宽 + Start_y,Start_y 圆心xy坐标 + x_Length,y_Length xy半轴长度 +**********************************************************************************************************/ + +void Arc_Draw(Graph_Data *graph,char graphname[3],uint32_t Graph_Operate,uint32_t Graph_Layer,uint32_t Graph_Color, + uint32_t Graph_StartAngle,uint32_t Graph_EndAngle,uint32_t Graph_Width,uint32_t Start_x,uint32_t Start_y,uint32_t end_x,uint32_t end_y) +{ + int i; + for(i=0;i<3&&graphname[i]!='\0';i++) + { + graph->graphic_name[2-i]=graphname[i]; + } + + graph->graphic_tpye = UI_Graph_Arc; + graph->operate_tpye = Graph_Operate; + graph->layer = Graph_Layer; + graph->color = Graph_Color; + + graph->start_angle = Graph_StartAngle; + graph->end_angle = Graph_EndAngle; + graph->width = Graph_Width; + graph->start_x = Start_x; + graph->start_y = Start_y; + graph->end_x = end_x; + graph->end_y = end_y; } /************************************************绘制浮点型数据************************************************* -**参数:*image Graph_Data类型变量指针,用于存放图形数据 - imagename[3] 图片名称,用于标识更改 +**参数:*graph Graph_Data类型变量指针,用于存放图形数据 + graphname[3] 图片名称,用于标识更改 Graph_Operate 图片操作,见头文件 Graph_Layer 图层0-9 Graph_Color 图形颜色 Graph_Size 字号 Graph_Digit 小数位数 - Graph_Width 图形线宽 + Graph_Width 图形线宽 Start_x、Start_y 开始坐标 Graph_Float 要显示的浮点数数值*1000 **********************************************************************************************************/ - -void Float_Draw(Float_Data *image,char imagename[3],uint32_t Graph_Operate,uint32_t Graph_Layer,uint32_t Graph_Color,uint32_t Graph_Size,uint32_t Graph_Digit,uint32_t Graph_Width,uint32_t Start_x,uint32_t Start_y,int32_t Graph_Float) +/* syhtodo浮点,整形,字符待编写或检查 */ +/* syhtodo需要解决位分配问腿,更换结构体 */ +void Float_Draw(Float_Data *graph,char graphname[3],uint32_t Graph_Operate,uint32_t Graph_Layer,uint32_t Graph_Color,uint32_t Graph_Size,uint32_t Graph_Digit,uint32_t Graph_Width,uint32_t Start_x,uint32_t Start_y,int32_t Graph_Float) { int i; - for(i=0;i<3&&imagename[i]!='\0';i++) - image->graphic_name[2-i]=imagename[i]; - image->graphic_tpye = UI_Graph_Float; - image->operate_tpye = Graph_Operate; - image->layer = Graph_Layer; - image->color = Graph_Color; - image->width = Graph_Width; - image->start_x = Start_x; - image->start_y = Start_y; - image->start_angle = Graph_Size; - image->end_angle = Graph_Digit; - image->graph_Float = Graph_Float; + for(i=0;i<3&&graphname[i]!='\0';i++) + graph->graphic_name[2-i]=graphname[i]; + graph->graphic_tpye = UI_Graph_Float; + graph->operate_tpye = Graph_Operate; + graph->layer = Graph_Layer; + graph->color = Graph_Color; + graph->width = Graph_Width; + graph->start_x = Start_x; + graph->start_y = Start_y; + graph->start_angle = Graph_Size; + graph->end_angle = Graph_Digit; + graph->graph_Float = Graph_Float; } /************************************************绘制字符型数据************************************************* -**参数:*image Graph_Data类型变量指针,用于存放图形数据 - imagename[3] 图片名称,用于标识更改 +**参数:*graph Graph_Data类型变量指针,用于存放图形数据 + graphname[3] 图片名称,用于标识更改 Graph_Operate 图片操作,见头文件 Graph_Layer 图层0-9 Graph_Color 图形颜色 @@ -210,61 +257,59 @@ void Float_Draw(Float_Data *image,char imagename[3],uint32_t Graph_Operate,uint3 Graph_Width 图形线宽 Start_x、Start_y 开始坐标 **********************************************************************************************************/ - -void Char_Draw(String_Data *image,char imagename[3],uint32_t Graph_Operate,uint32_t Graph_Layer,uint32_t Graph_Color,uint32_t Graph_Size,uint32_t Graph_Width,uint32_t Start_x,uint32_t Start_y) + +void Char_Draw(String_Data *graph,char graphname[3],uint32_t Graph_Operate,uint32_t Graph_Layer,uint32_t Graph_Color,uint32_t Graph_Size,uint32_t Graph_Width,uint32_t Start_x,uint32_t Start_y) { int i; - for(i=0;i<3&&imagename[i]!='\0';i++) - image->Graph_Control.graphic_name[2-i]=imagename[i]; - image->Graph_Control.graphic_tpye = UI_Graph_Char; - image->Graph_Control.operate_tpye = Graph_Operate; - image->Graph_Control.layer = Graph_Layer; - image->Graph_Control.color = Graph_Color; - image->Graph_Control.width = Graph_Width; - image->Graph_Control.start_x = Start_x; - image->Graph_Control.start_y = Start_y; - image->Graph_Control.start_angle = Graph_Size; + for(i=0;i<3&&graphname[i]!='\0';i++) + graph->Graph_Control.graphic_name[2-i]=graphname[i]; + graph->Graph_Control.graphic_tpye = UI_Graph_Char; + graph->Graph_Control.operate_tpye = Graph_Operate; + graph->Graph_Control.layer = Graph_Layer; + graph->Graph_Control.color = Graph_Color; + graph->Graph_Control.width = Graph_Width; + graph->Graph_Control.start_x = Start_x; + graph->Graph_Control.start_y = Start_y; + graph->Graph_Control.start_angle = Graph_Size; } -void Char_Write(String_Data *image,char* fmt, ...) +void Char_Write(String_Data *graph,char* fmt, ...) { uint16_t i = 0; va_list ap; va_start(ap, fmt); - vsprintf((char*)image->show_Data, fmt, ap); + vsprintf((char*)graph->show_Data, fmt, ap); va_end(ap); - i = strlen((const char*)image->show_Data); - image->Graph_Control.end_angle = i; + i = strlen((const char*)graph->show_Data); + graph->Graph_Control.end_angle = i; } /************************************************UI推送函数(使更改生效)********************************* **参数: cnt 图形个数 ... 图形变量参数 - - Tips::该函数只能推送1,2,5,7个图形,其他数目协议未涉及 **********************************************************************************************************/ int UI_ReFresh(int cnt,...) { - int i,n; - Graph_Data imageData; + int i; + UI_Packhead framehead; + UI_Data_Operate datahead; + Graph_Data graphData; + unsigned char *framepoint; //读写指针 uint16_t frametail=0xFFFF; //CRC16校验值 - UI_Packhead framehead; - UI_Data_Operate datahead; - - va_list ap; - va_start(ap,cnt); + va_list ap;//创建一个 va_list 类型变量 + va_start(ap,cnt);//初始化 va_list 变量为一个参数列表 framepoint=(unsigned char *)&framehead; framehead.SOF=UI_SOF; framehead.Data_Length=6+cnt*15; framehead.Seq=UI_Seq; - framehead.CRC8=Get_CRC8_Check_Sum_UI(framepoint,4,0xFF); + framehead.CRC8=Get_CRC8_Check_Sum(framepoint,4,0xFF); framehead.CMD_ID=UI_CMD_Robo_Exchange; //填充包头数据 - switch(cnt) + switch(cnt) //syhtodo可以直接计算式解决 { case 1: datahead.Data_ID=UI_Data_ID_Draw1; @@ -285,226 +330,69 @@ int UI_ReFresh(int cnt,...) datahead.Receiver_ID=Cilent_ID; //填充操作数据 framepoint=(unsigned char *)&framehead; - frametail=Get_CRC16_Check_Sum_UI(framepoint,sizeof(framehead),frametail); + frametail=Get_CRC16_Check_Sum(framepoint,sizeof(framehead),frametail); framepoint=(unsigned char *)&datahead; - frametail=Get_CRC16_Check_Sum_UI(framepoint,sizeof(datahead),frametail); //CRC16校验值计算(部分) + frametail=Get_CRC16_Check_Sum(framepoint,sizeof(datahead),frametail); //CRC16校验值计算(部分) - framepoint=(unsigned char *)&framehead; - for(i=0;i> 8) ^ wCRC_Table_UI[((uint16_t)(wCRC) ^ (uint16_t)(chData)) & - 0x00ff]; - } - return wCRC; -} - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/modules/referee/referee_UI.h b/modules/referee/referee_UI.h index 0efa2e2..e6b1712 100644 --- a/modules/referee/referee_UI.h +++ b/modules/referee/referee_UI.h @@ -112,7 +112,7 @@ typedef struct uint8_t Layer; //删除图层 } UI_Data_Delete; //删除图层帧 - +/* 是否有必要专门为浮点数定义?? */ typedef struct { uint8_t graphic_name[3]; @@ -125,10 +125,15 @@ typedef struct uint32_t width:10; uint32_t start_x:11; uint32_t start_y:11; - int32_t graph_Float; //浮点数据 + int32_t graph_Float; + /* syhtodo + uint32_t 正好对应 + radius:10; uint32_t end_x:11; uint32_t end_y:11; + 三个变量,考虑位操作赋值,则不需要专门定义结构体 + */ } Float_Data; - +/* 图形数据 */ typedef struct { uint8_t graphic_name[3]; @@ -143,7 +148,7 @@ uint32_t start_x:11; uint32_t start_y:11; uint32_t radius:10; uint32_t end_x:11; -uint32_t end_y:11; //图形数据 +uint32_t end_y:11; } Graph_Data; @@ -156,17 +161,22 @@ typedef struct #pragma pack() void UI_Delete(uint8_t Del_Operate,uint8_t Del_Layer); -void Line_Draw(Graph_Data *image,char imagename[3],uint32_t Graph_Operate,uint32_t Graph_Layer,uint32_t Graph_Color,uint32_t Graph_Width,uint32_t Start_x,uint32_t Start_y,uint32_t End_x,uint32_t End_y); +void Line_Draw(Graph_Data *graph,char graphname[3],uint32_t Graph_Operate,uint32_t Graph_Layer,uint32_t Graph_Color,uint32_t Graph_Width,uint32_t Start_x,uint32_t Start_y,uint32_t End_x,uint32_t End_y); + + +void Circle_Draw(Graph_Data *graph,char graphname[3],uint32_t Graph_Operate,uint32_t Graph_Layer,uint32_t Graph_Color,uint32_t Graph_Width,uint32_t Start_x,uint32_t Start_y,uint32_t Graph_Radius); +void Elliptical_Draw(Graph_Data *graph,char graphname[3],uint32_t Graph_Operate,uint32_t Graph_Layer,uint32_t Graph_Color,uint32_t Graph_Width,uint32_t Start_x,uint32_t Start_y,uint32_t end_x,uint32_t end_y); +void Rectangle_Draw(Graph_Data *graph,char graphname[3],uint32_t Graph_Operate,uint32_t Graph_Layer,uint32_t Graph_Color,uint32_t Graph_Width,uint32_t Start_x,uint32_t Start_y,uint32_t End_x,uint32_t End_y); +void Float_Draw(Float_Data *graph,char graphname[3],uint32_t Graph_Operate,uint32_t Graph_Layer,uint32_t Graph_Color,uint32_t Graph_Size,uint32_t Graph_Digit,uint32_t Graph_Width,uint32_t Start_x,uint32_t Start_y,int32_t Graph_Float); +void Char_Draw(String_Data *graph,char graphname[3],uint32_t Graph_Operate,uint32_t Graph_Layer,uint32_t Graph_Color,uint32_t Graph_Size,uint32_t Graph_Width,uint32_t Start_x,uint32_t Start_y); + +void Char_Write(String_Data *graph,char* fmt, ...); +void Arc_Draw(Graph_Data *graph,char graphname[3],uint32_t Graph_Operate,uint32_t Graph_Layer,uint32_t Graph_Color,uint32_t Graph_StartAngle,uint32_t Graph_EndAngle,uint32_t Graph_Width,uint32_t Start_x,uint32_t Start_y,uint32_t end_x,uint32_t end_y); +int Char_ReFresh(String_Data string_Data); int UI_ReFresh(int cnt,...); + + unsigned char Get_CRC8_Check_Sum_UI(unsigned char *pchMessage,unsigned int dwLength,unsigned char ucCRC8); uint16_t Get_CRC16_Check_Sum_UI(uint8_t *pchMessage,uint32_t dwLength,uint16_t wCRC); -void Circle_Draw(Graph_Data *image,char imagename[3],uint32_t Graph_Operate,uint32_t Graph_Layer,uint32_t Graph_Color,uint32_t Graph_Width,uint32_t Start_x,uint32_t Start_y,uint32_t Graph_Radius); -void Rectangle_Draw(Graph_Data *image,char imagename[3],uint32_t Graph_Operate,uint32_t Graph_Layer,uint32_t Graph_Color,uint32_t Graph_Width,uint32_t Start_x,uint32_t Start_y,uint32_t End_x,uint32_t End_y); -void Float_Draw(Float_Data *image,char imagename[3],uint32_t Graph_Operate,uint32_t Graph_Layer,uint32_t Graph_Color,uint32_t Graph_Size,uint32_t Graph_Digit,uint32_t Graph_Width,uint32_t Start_x,uint32_t Start_y,int32_t Graph_Float); -void Char_Draw(String_Data *image,char imagename[3],uint32_t Graph_Operate,uint32_t Graph_Layer,uint32_t Graph_Color,uint32_t Graph_Size,uint32_t Graph_Width,uint32_t Start_x,uint32_t Start_y); -int Char_ReFresh(String_Data string_Data); -void Char_Write(String_Data *image,char* fmt, ...); -void Arc_Draw(Graph_Data *image,char imagename[3],uint32_t Graph_Operate,uint32_t Graph_Layer,uint32_t Graph_Color,uint32_t Graph_StartAngle,uint32_t Graph_EndAngle,uint32_t Graph_Width,uint32_t Start_x,uint32_t Start_y,uint32_t x_Length,uint32_t y_Length); - #endif