#include "stm32f0xx_hal.h"
#include "Uart.h"
#include "string.h"
#include "ws2812.h"
#include "IWDG.h"
RGB_COLOR USER_RGB_COLOR;
unsigned char TX_Mode = 1;
unsigned char BLINK_2=0;
unsigned char RX3_BUF[32];
#define BUTTON1
#define BUTTON2
#define BUTTON3
#define BUTTON4
#define BUTTON5
#define BUTTON6
#define BUTTON7
#define BUTTON8
#define BUTTON9
#define BUTTON0
#define CLEAR
unsigned int r_flag1 = 0;
unsigned int quan_hang1 = 0;
unsigned int quan_hang2 = 0;
unsigned int quan_hang3 = 0;
unsigned int quan_lie1 = 0;
unsigned int quan_lie2 = 0;
unsigned int quan_lie3 = 0;
unsigned int quan_zuoxia = 0;
unsigned int quan_youxia = 0;
unsigned int cha_hang1 = 0;
unsigned int cha_hang2 = 0;
unsigned int cha_hang3 = 0;
unsigned int cha_lie1 = 0;
unsigned int cha_lie2 = 0;
unsigned int cha_lie3 = 0;
unsigned int cha_zuoxia = 0;
unsigned int cha_youxia = 0;
//unsigned int r_flag10 = 0;
void SystemClock_Config(void);
void Error_Handler(void);
static void MX_GPIO_Init(void);
int main(void)
{
uint8_t color_buf = 0;
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* Configure the system clock */
SystemClock_Config();
//Selección de funciones
/* Initialize all configured peripherals */
MX_GPIO_Init();
TX_Mode = HAL_GPIO_ReadPin(GPIOA,GPIO_PIN_4);
if(TX_Mode)
MX_USART1_UART_Init2();
else
MX_USART1_UART_Init();
while(1)
{
//232 inicializar
//TTl inicializar
//Inversión del puente, reinicio para reiniciar
if(TX_Mode != HAL_GPIO_ReadPin(GPIOA,GPIO_PIN_4)) HAL_NVIC_SystemReset();
if(MNG_USART1.RX_OVER_FLG ==TRUE)
{
// Bit de bandera de recepción de datos en serie
//Método 2: Obtener el nombre de un control de longitud fija
//Seleccione el control
RX3_BUF[0]=MNG_USART1.RX_BUF[7];
RX3_BUF[1]=MNG_USART1.RX_BUF[8];
RX3_BUF[2]=MNG_USART1.RX_BUF[9];
RX3_BUF[3]=MNG_USART1.RX_BUF[10];
RX3_BUF[4]=MNG_USART1.RX_BUF[11];
RX3_BUF[5]=MNG_USART1.RX_BUF[12];
RX3_BUF[6]=MNG_USART1.RX_BUF[13];
//RX3_BUF[7]=MNG_USART1.RX_BUF[14];
color_buf = BUTTON1;
color_buf = BUTTON5;
color_buf = BUTTON4;
color_buf = BUTTON3;
color_buf = BUTTON2;
if((strcmp("button1",(const char *)RX3_BUF))==0)
{
}
if((strcmp("button2",(const char *)RX3_BUF))==0)
{
}
if((strcmp("button3",(const char *)RX3_BUF))==0)
{
}
if((strcmp("button4",(const char *)RX3_BUF))==0)
{
}
if((strcmp("button5",(const char *)RX3_BUF))==0)
{
}
if((strcmp("button6",(const char *)RX3_BUF))==0)
{
}
if((strcmp("button7",(const char *)RX3_BUF))==0)
{
}
if((strcmp("button8",(const char *)RX3_BUF))==0)
{
}
if((strcmp("button9",(const char *)RX3_BUF))==0)
{
}
if((strcmp("button0",(const char *)RX3_BUF))==0)
{
}
color_buf = BUTTON6;
color_buf = BUTTON7;
color_buf = BUTTON9;
color_buf = BUTTON0;
color_buf = BUTTON8;
switch (color_buf)
{
case BUTTON1:
if((r_flag1 == 0)&&(MNG_USART1.RX_BUF[14] == 0x02))
//if(r_flag1 == 0)
{
memset(MNG_USART1.TX_BUF,0,USART1_TX_LEN);
sprintf((char *)MNG_USART1.TX_BUF,
"ST<{\"cmd_code\":\"set_image\",\"type\":\"image\",\"widget\":\"image2\",\"image\":\"circle\"}>ET");
"ST<{\"cmd_code\":\"set_image\",\"type\":\"image\",\"widget\":\"image2\",\"image\":\"x\"}>ET");
"ST<{\"cmd_code\":\"set_image\",\"type\":\"image\",\"widget\":\"image3\",\"image\":\"circle\"}>ET");
"ST<{\"cmd_code\":\"set_image\",\"type\":\"image\",\"widget\":\"image3\",\"image\":\"x\"}>ET");
MNG_USART1.TX_Byte_Num = strlen((const char *)MNG_USART1.TX_BUF);
USART_TX_Data(MNG_USART1);
r_flag1 = 1;
quan_hang1++;
quan_lie1++;
quan_youxia++;
//memset(RX3_BUF,0,7);
//memset(MNG_USART1.RX_BUF,0,USART1_RX_LEN);
color_buf = CLEAR;
}
else if((r_flag1 == 1)&&(MNG_USART1.RX_BUF[14] == 0x02))
{
memset(MNG_USART1.TX_BUF,0,USART1_TX_LEN);
sprintf((char *)MNG_USART1.TX_BUF,
MNG_USART1.TX_Byte_Num = strlen((const char *)MNG_USART1.TX_BUF);
USART_TX_Data(MNG_USART1);
r_flag1 = 0;
cha_hang1++;
cha_lie1++;
cha_youxia++;
//memset(RX3_BUF,0,7);
color_buf = CLEAR;
}
//r_flag1 = 1;
break;
case BUTTON2:
{
if((r_flag1 == 0)&&(MNG_USART1.RX_BUF[14] == 0x02))
memset(MNG_USART1.TX_BUF,0,USART1_TX_LEN);
sprintf((char *)MNG_USART1.TX_BUF,
MNG_USART1.TX_Byte_Num = strlen((const char *)MNG_USART1.TX_BUF);
USART_TX_Data(MNG_USART1);
r_flag1 = 1;
quan_hang1++;
quan_lie2++;
//memset(RX3_BUF,0,7);
color_buf = CLEAR;
}
else if((r_flag1 == 1)&&(MNG_USART1.RX_BUF[14] == 0x02))
{
memset(MNG_USART1.TX_BUF,0,USART1_TX_LEN);
sprintf((char *)MNG_USART1.TX_BUF,
MNG_USART1.TX_Byte_Num = strlen((const char *)MNG_USART1.TX_BUF);
USART_TX_Data(MNG_USART1);
r_flag1 = 0;
cha_hang1++;
cha_lie2++;
//memset(RX3_BUF,0,7);
color_buf = CLEAR;
{
if((r_flag1 == 0)&&(MNG_USART1.RX_BUF[14] == 0x02))
memset(MNG_USART1.TX_BUF,0,USART1_TX_LEN);
sprintf((char *)MNG_USART1.TX_BUF,
MNG_USART1.TX_Byte_Num = strlen((const char *)MNG_USART1.TX_BUF);
USART_TX_Data(MNG_USART1);
r_flag1 = 1;
quan_hang1++;
quan_lie3++;
quan_zuoxia++;
//memset(RX3_BUF,0,7);
color_buf = CLEAR;
}
else if((r_flag1 == 1)&&(MNG_USART1.RX_BUF[14] == 0x02))
{
memset(MNG_USART1.TX_BUF,0,USART1_TX_LEN);
sprintf((char *)MNG_USART1.TX_BUF,
MNG_USART1.TX_Byte_Num = strlen((const char *)MNG_USART1.TX_BUF);
USART_TX_Data(MNG_USART1);
r_flag1 = 0;
}
break;
case BUTTON3:
"ST<{\"cmd_code\":\"set_image\",\"type\":\"image\",\"widget\":\"image4\",\"image\":\"circle\"}>ET");
"ST<{\"cmd_code\":\"set_image\",\"type\":\"image\",\"widget\":\"image4\",\"image\":\"x\"}>ET");
cha_hang1++;
cha_lie3++;
cha_zuoxia++;
//memset(RX3_BUF,0,7);
color_buf = CLEAR;
}
break;
case BUTTON4:
{
"ST<{\"cmd_code\":\"set_image\",\"type\":\"image\",\"widget\":\"image5\",\"image\":\"circle\"}>ET");
"ST<{\"cmd_code\":\"set_image\",\"type\":\"image\",\"widget\":\"image5\",\"image\":\"x\"}>ET");
"ST<{\"cmd_code\":\"set_image\",\"type\":\"image\",\"widget\":\"image6\",\"image\":\"circle\"}>ET");
}
break;
case BUTTON5:
{
if((r_flag1 == 0)&&(MNG_USART1.RX_BUF[14] == 0x02))
memset(MNG_USART1.TX_BUF,0,USART1_TX_LEN);
sprintf((char *)MNG_USART1.TX_BUF,
MNG_USART1.TX_Byte_Num = strlen((const char *)MNG_USART1.TX_BUF);
USART_TX_Data(MNG_USART1);
r_flag1 = 1;
quan_hang2++;
quan_lie1++;
//memset(RX3_BUF,0,7);
//r_flag10=1;
color_buf = CLEAR;
}
else if((r_flag1 == 1)&&(MNG_USART1.RX_BUF[14] == 0x02))
{
memset(MNG_USART1.TX_BUF,0,USART1_TX_LEN);
sprintf((char *)MNG_USART1.TX_BUF,
MNG_USART1.TX_Byte_Num = strlen((const char *)MNG_USART1.TX_BUF);
USART_TX_Data(MNG_USART1);
r_flag1 = 0;
cha_hang2++;
cha_lie1++;
//memset(RX3_BUF,0,7);
color_buf = CLEAR;
if((r_flag1 == 0)&&(MNG_USART1.RX_BUF[14] == 0x02))
memset(MNG_USART1.TX_BUF,0,USART1_TX_LEN);
sprintf((char *)MNG_USART1.TX_BUF,
MNG_USART1.TX_Byte_Num = strlen((const char *)MNG_USART1.TX_BUF);
USART_TX_Data(MNG_USART1);
r_flag1 = 1;
quan_hang2++;
quan_lie2++;
quan_zuoxia++;
quan_youxia++;
//memset(RX3_BUF,0,7);
color_buf = CLEAR;
}
else if((r_flag1 == 1)&&(MNG_USART1.RX_BUF[14] == 0x02))
{
memset(MNG_USART1.TX_BUF,0,USART1_TX_LEN);
sprintf((char *)MNG_USART1.TX_BUF,
MNG_USART1.TX_Byte_Num = strlen((const char *)MNG_USART1.TX_BUF);
USART_TX_Data(MNG_USART1);
r_flag1 = 0;
cha_hang2++;
cha_lie2++;
cha_zuoxia++;
cha_youxia++;
//memset(RX3_BUF,0,7);
color_buf = CLEAR;
}
break;
case BUTTON6:
"ST<{\"cmd_code\":\"set_image\",\"type\":\"image\",\"widget\":\"image6\",\"image\":\"x\"}>ET");
"ST<{\"cmd_code\":\"set_image\",\"type\":\"image\",\"widget\":\"image7\",\"image\":\"circle\"}>ET");
{
if((r_flag1 == 0)&&(MNG_USART1.RX_BUF[14] == 0x02))
memset(MNG_USART1.TX_BUF,0,USART1_TX_LEN);
sprintf((char *)MNG_USART1.TX_BUF,
MNG_USART1.TX_Byte_Num = strlen((const char *)MNG_USART1.TX_BUF);
USART_TX_Data(MNG_USART1);
r_flag1 = 1;
"ST<{\"cmd_code\":\"set_image\",\"type\":\"image\",\"widget\":\"image8\",\"image\":\"circle\"}>ET");
quan_hang2++;
quan_lie3++;
//memset(RX3_BUF,0,7);
color_buf = CLEAR;
"ST<{\"cmd_code\":\"set_image\",\"type\":\"image\",\"widget\":\"image7\",\"image\":\"x\"}>ET");
}
break;
case BUTTON7:
{
}
else if((r_flag1 == 1)&&(MNG_USART1.RX_BUF[14] == 0x02))
{
memset(MNG_USART1.TX_BUF,0,USART1_TX_LEN);
sprintf((char *)MNG_USART1.TX_BUF,
MNG_USART1.TX_Byte_Num = strlen((const char *)MNG_USART1.TX_BUF);
USART_TX_Data(MNG_USART1);
r_flag1 = 0;
cha_hang2++;
cha_lie3++;
//memset(RX3_BUF,0,7);
color_buf = CLEAR;
if((r_flag1 == 0)&&(MNG_USART1.RX_BUF[14] == 0x02))
memset(MNG_USART1.TX_BUF,0,USART1_TX_LEN);
sprintf((char *)MNG_USART1.TX_BUF,
MNG_USART1.TX_Byte_Num = strlen((const char *)MNG_USART1.TX_BUF);
USART_TX_Data(MNG_USART1);
r_flag1 = 1;
quan_hang3++;
quan_lie1++;
quan_zuoxia++;
//memset(RX3_BUF,0,7);
color_buf = CLEAR;
}
else if((r_flag1 == 1)&&(MNG_USART1.RX_BUF[14] == 0x02))
{
memset(MNG_USART1.TX_BUF,0,USART1_TX_LEN);
sprintf((char *)MNG_USART1.TX_BUF,
MNG_USART1.TX_Byte_Num = strlen((const char *)MNG_USART1.TX_BUF);
USART_TX_Data(MNG_USART1);
r_flag1 = 0;
cha_hang3++;
cha_lie1++;
cha_zuoxia++;
//memset(RX3_BUF,0,7);
color_buf = CLEAR;
}
break;
case BUTTON8:
{
if((r_flag1 == 0)&&(MNG_USART1.RX_BUF[14] == 0x02))
memset(MNG_USART1.TX_BUF,0,USART1_TX_LEN);
sprintf((char *)MNG_USART1.TX_BUF,
MNG_USART1.TX_Byte_Num = strlen((const char *)MNG_USART1.TX_BUF);
USART_TX_Data(MNG_USART1);
r_flag1 = 1;
quan_hang3++;
quan_lie2++;
//memset(RX3_BUF,0,7);
color_buf = CLEAR;
}
else if((r_flag1 == 1)&&(MNG_USART1.RX_BUF[14] == 0x02))
{
memset(MNG_USART1.TX_BUF,0,USART1_TX_LEN);
sprintf((char *)MNG_USART1.TX_BUF,
MNG_USART1.TX_Byte_Num = strlen((const char *)MNG_USART1.TX_BUF);
USART_TX_Data(MNG_USART1);
r_flag1 = 0;
cha_hang3++;
cha_lie2++;
//memset(RX3_BUF,0,7);
color_buf = CLEAR;
}
break;
"ST<{\"cmd_code\":\"set_image\",\"type\":\"image\",\"widget\":\"image8\",\"image\":\"x\"}>ET");
"ST<{\"cmd_code\":\"set_image\",\"type\":\"image\",\"widget\":\"image9\",\"image\":\"x\"}>ET");
"ST<{\"cmd_code\":\"set_image\",\"type\":\"image\",\"widget\":\"image9\",\"image\":\"circle\"}>ET");
F:\work\jingziqi\button ctrl\Src\main.c
case BUTTON9:
{
"ST<{\"cmd_code\":\"set_image\",\"type\":\"image\",\"widget\":\"image10\",\"image\":\"circle\"}>ET");
"ST<{\"cmd_code\":\"set_image\",\"type\":\"image\",\"widget\":\"image10\",\"image\":\"x\"}>ET");
if((r_flag1 == 0)&&(MNG_USART1.RX_BUF[14] == 0x02))
memset(MNG_USART1.TX_BUF,0,USART1_TX_LEN);
sprintf((char *)MNG_USART1.TX_BUF,
MNG_USART1.TX_Byte_Num = strlen((const char *)MNG_USART1.TX_BUF);
USART_TX_Data(MNG_USART1);
r_flag1 = 1;
quan_hang3++;
quan_lie3++;
quan_youxia++;
//memset(RX3_BUF,0,7);
color_buf = CLEAR;
}
else if((r_flag1 == 1)&&(MNG_USART1.RX_BUF[14] == 0x02))
{
memset(MNG_USART1.TX_BUF,0,USART1_TX_LEN);
sprintf((char *)MNG_USART1.TX_BUF,
MNG_USART1.TX_Byte_Num = strlen((const char *)MNG_USART1.TX_BUF);
USART_TX_Data(MNG_USART1);
r_flag1 = 0;
cha_hang3++;
cha_lie3++;
cha_youxia++;
//memset(RX3_BUF,0,7);
color_buf = CLEAR;
}
break;
case BUTTON0:
r_flag1 = 0;
quan_hang1=quan_hang2=quan_hang3=cha_hang1=cha_hang2=cha_hang3=0;
quan_lie1=quan_lie2=quan_lie3=cha_lie1=cha_lie2=cha_lie3=0;
quan_zuoxia=quan_youxia=cha_zuoxia=cha_youxia=0;
memset(MNG_USART1.TX_BUF,0,USART1_TX_LEN);
sprintf((char *)MNG_USART1.TX_BUF,
MNG_USART1.TX_Byte_Num = strlen((const char *)MNG_USART1.TX_BUF);
USART_TX_Data(MNG_USART1);
memset(MNG_USART1.TX_BUF,0,USART1_TX_LEN);
sprintf((char *)MNG_USART1.TX_BUF,
MNG_USART1.TX_Byte_Num = strlen((const char *)MNG_USART1.TX_BUF);
USART_TX_Data(MNG_USART1);
memset(MNG_USART1.TX_BUF,0,USART1_TX_LEN);
sprintf((char *)MNG_USART1.TX_BUF,
MNG_USART1.TX_Byte_Num = strlen((const char *)MNG_USART1.TX_BUF);
USART_TX_Data(MNG_USART1);
memset(MNG_USART1.TX_BUF,0,USART1_TX_LEN);
sprintf((char *)MNG_USART1.TX_BUF,
MNG_USART1.TX_Byte_Num = strlen((const char *)MNG_USART1.TX_BUF);
USART_TX_Data(MNG_USART1);
memset(MNG_USART1.TX_BUF,0,USART1_TX_LEN);
sprintf((char *)MNG_USART1.TX_BUF,
MNG_USART1.TX_Byte_Num = strlen((const char *)MNG_USART1.TX_BUF);
USART_TX_Data(MNG_USART1);
memset(MNG_USART1.TX_BUF,0,USART1_TX_LEN);
sprintf((char *)MNG_USART1.TX_BUF,
MNG_USART1.TX_Byte_Num = strlen((const char *)MNG_USART1.TX_BUF);
USART_TX_Data(MNG_USART1);
memset(MNG_USART1.TX_BUF,0,USART1_TX_LEN);
sprintf((char *)MNG_USART1.TX_BUF,
MNG_USART1.TX_Byte_Num = strlen((const char *)MNG_USART1.TX_BUF);
USART_TX_Data(MNG_USART1);
"ST<{\"cmd_code\":\"set_image\",\"type\":\"image\",\"widget\":\"image5\",\"image\":\"bai\"}>ET");
"ST<{\"cmd_code\":\"set_image\",\"type\":\"image\",\"widget\":\"image6\",\"image\":\"bai\"}>ET");
"ST<{\"cmd_code\":\"set_image\",\"type\":\"image\",\"widget\":\"image7\",\"image\":\"bai\"}>ET");
"ST<{\"cmd_code\":\"set_image\",\"type\":\"image\",\"widget\":\"image8\",\"image\":\"bai\"}>ET");
"ST<{\"cmd_code\":\"set_image\",\"type\":\"image\",\"widget\":\"image2\",\"image\":\"bai\"}>ET");
"ST<{\"cmd_code\":\"set_image\",\"type\":\"image\",\"widget\":\"image3\",\"image\":\"bai\"}>ET");
"ST<{\"cmd_code\":\"set_image\",\"type\":\"image\",\"widget\":\"image4\",\"image\":\"bai\"}>ET");
"ST<{\"cmd_code\":\"set_image\",\"type\":\"image\",\"widget\":\"image9\",\"image\":\"bai\"}>ET");
"ST<{\"cmd_code\":\"set_image\",\"type\":\"image\",\"widget\":\"image10\",\"image\":\"bai\"}>ET");
"ST<{\"cmd_code\":\"set_visible\",\"type\":\"widget\",\"widget\":\"gif4\",\"visible\":false}>ET");
"ST<{\"cmd_code\":\"set_visible\",\"type\":\"widget\",\"widget\":\"gif5\",\"visible\":false}>ET");
memset(MNG_USART1.TX_BUF,0,USART1_TX_LEN);
sprintf((char *)MNG_USART1.TX_BUF,
MNG_USART1.TX_Byte_Num = strlen((const char *)MNG_USART1.TX_BUF);
USART_TX_Data(MNG_USART1);
memset(MNG_USART1.TX_BUF,0,USART1_TX_LEN);
sprintf((char *)MNG_USART1.TX_BUF,
MNG_USART1.TX_Byte_Num = strlen((const char *)MNG_USART1.TX_BUF);
USART_TX_Data(MNG_USART1);
memset(MNG_USART1.TX_BUF,0,USART1_TX_LEN);
sprintf((char *)MNG_USART1.TX_BUF,
MNG_USART1.TX_Byte_Num = strlen((const char *)MNG_USART1.TX_BUF);
USART_TX_Data(MNG_USART1);
memset(MNG_USART1.TX_BUF,0,USART1_TX_LEN);
sprintf((char *)MNG_USART1.TX_BUF,
MNG_USART1.TX_Byte_Num = strlen((const char *)MNG_USART1.TX_BUF);
USART_TX_Data(MNG_USART1);
memset(MNG_USART1.TX_BUF,0,USART1_TX_LEN);
sprintf((char *)MNG_USART1.TX_BUF,
MNG_USART1.TX_Byte_Num = strlen((const char *)MNG_USART1.TX_BUF);
USART_TX_Data(MNG_USART1);
memset(MNG_USART1.TX_BUF,0,USART1_TX_LEN);
sprintf((char *)MNG_USART1.TX_BUF,
MNG_USART1.TX_Byte_Num = strlen((const char *)MNG_USART1.TX_BUF);
USART_TX_Data(MNG_USART1);
memset(MNG_USART1.TX_BUF,0,USART1_TX_LEN);
sprintf((char *)MNG_USART1.TX_BUF,
MNG_USART1.TX_Byte_Num = strlen((const char *)MNG_USART1.TX_BUF);
USART_TX_Data(MNG_USART1);
memset(MNG_USART1.TX_BUF,0,USART1_TX_LEN);
sprintf((char *)MNG_USART1.TX_BUF,
MNG_USART1.TX_Byte_Num = strlen((const char *)MNG_USART1.TX_BUF);
USART_TX_Data(MNG_USART1);
memset(MNG_USART1.TX_BUF,0,USART1_TX_LEN);
sprintf((char *)MNG_USART1.TX_BUF,
MNG_USART1.TX_Byte_Num = strlen((const char *)MNG_USART1.TX_BUF);
USART_TX_Data(MNG_USART1);
memset(MNG_USART1.TX_BUF,0,USART1_TX_LEN);
sprintf((char *)MNG_USART1.TX_BUF,
MNG_USART1.TX_Byte_Num = strlen((const char *)MNG_USART1.TX_BUF);
USART_TX_Data(MNG_USART1);
//memset(RX3_BUF,0,7);
memset(MNG_USART1.RX_BUF,0,USART1_RX_LEN);
break;
MNG_USART1.RX_OVER_FLG = FALSE;
break;
default:
"ST<{\"cmd_code\":\"set_visible\",\"type\":\"widget\",\"widget\":\"gif6\",\"visible\":false}>ET");
"ST<{\"cmd_code\":\"set_visible\",\"type\":\"widget\",\"widget\":\"gif7\",\"visible\":false}>ET");
"ST<{\"cmd_code\":\"set_visible\",\"type\":\"widget\",\"widget\":\"gif8\",\"visible\":false}>ET");
"ST<{\"cmd_code\":\"set_visible\",\"type\":\"widget\",\"widget\":\"gif9\",\"visible\":false}>ET");
"ST<{\"cmd_code\":\"set_visible\",\"type\":\"widget\",\"widget\":\"gif10\",\"visible\":false}>ET");
"ST<{\"cmd_code\":\"set_visible\",\"type\":\"widget\",\"widget\":\"gif11\",\"visible\":false}>ET");
"ST<{\"cmd_code\":\"set_visible\",\"type\":\"widget\",\"widget\":\"gif4\",\"visible\":true}>ET");
}
////////////////////////////////////////////////////////////////////
if((quan_hang1==3)||(cha_hang1==3))
{
memset(MNG_USART1.TX_BUF,0,USART1_TX_LEN);
sprintf((char *)MNG_USART1.TX_BUF,
MNG_USART1.TX_Byte_Num = strlen((const char *)MNG_USART1.TX_BUF);
USART_TX_Data(MNG_USART1);
quan_hang1=quan_hang2=quan_hang3=cha_hang1=cha_hang2=cha_hang3=0;
quan_lie1=quan_lie2=quan_lie3=cha_lie1=cha_lie2=cha_lie3=0;
quan_zuoxia=quan_youxia=cha_zuoxia=cha_youxia=0;
"ST<{\"cmd_code\":\"set_visible\",\"type\":\"widget\",\"widget\":\"gif7\",\"visible\":true}>ET");
"ST<{\"cmd_code\":\"set_visible\",\"type\":\"widget\",\"widget\":\"gif6\",\"visible\":true}>ET");
}
else if((quan_hang2==3)||(cha_hang2==3))
{
"ST<{\"cmd_code\":\"set_visible\",\"type\":\"widget\",\"widget\":\"gif5\",\"visible\":true}>ET");
memset(MNG_USART1.TX_BUF,0,USART1_TX_LEN);
sprintf((char *)MNG_USART1.TX_BUF,
MNG_USART1.TX_Byte_Num = strlen((const char *)MNG_USART1.TX_BUF);
USART_TX_Data(MNG_USART1);
quan_hang1=quan_hang2=quan_hang3=cha_hang1=cha_hang2=cha_hang3=0;
quan_lie1=quan_lie2=quan_lie3=cha_lie1=cha_lie2=cha_lie3=0;
quan_zuoxia=quan_youxia=cha_zuoxia=cha_youxia=0;
}
else if((quan_hang3==3)||(cha_hang3==3))
{
memset(MNG_USART1.TX_BUF,0,USART1_TX_LEN);
sprintf((char *)MNG_USART1.TX_BUF,
MNG_USART1.TX_Byte_Num = strlen((const char *)MNG_USART1.TX_BUF);
USART_TX_Data(MNG_USART1);
quan_hang1=quan_hang2=quan_hang3=cha_hang1=cha_hang2=cha_hang3=0;
quan_lie1=quan_lie2=quan_lie3=cha_lie1=cha_lie2=cha_lie3=0;
quan_zuoxia=quan_youxia=cha_zuoxia=cha_youxia=0;
}
else if((quan_lie1==3)||(cha_lie1==3))
{
memset(MNG_USART1.TX_BUF,0,USART1_TX_LEN);
sprintf((char *)MNG_USART1.TX_BUF,
MNG_USART1.TX_Byte_Num = strlen((const char *)MNG_USART1.TX_BUF);
USART_TX_Data(MNG_USART1);
quan_hang1=quan_hang2=quan_hang3=cha_hang1=cha_hang2=cha_hang3=0;
quan_lie1=quan_lie2=quan_lie3=cha_lie1=cha_lie2=cha_lie3=0;
quan_zuoxia=quan_youxia=cha_zuoxia=cha_youxia=0;
}
else if((quan_lie2==3)||(cha_lie2==3))
{
memset(MNG_USART1.TX_BUF,0,USART1_TX_LEN);
sprintf((char *)MNG_USART1.TX_BUF,
MNG_USART1.TX_Byte_Num = strlen((const char *)MNG_USART1.TX_BUF);
USART_TX_Data(MNG_USART1);
quan_hang1=quan_hang2=quan_hang3=cha_hang1=cha_hang2=cha_hang3=0;
quan_lie1=quan_lie2=quan_lie3=cha_lie1=cha_lie2=cha_lie3=0;
quan_zuoxia=quan_youxia=cha_zuoxia=cha_youxia=0;
}
else if((quan_lie3==3)||(cha_lie3==3))
{
memset(MNG_USART1.TX_BUF,0,USART1_TX_LEN);
sprintf((char *)MNG_USART1.TX_BUF,
MNG_USART1.TX_Byte_Num = strlen((const char *)MNG_USART1.TX_BUF);
USART_TX_Data(MNG_USART1);
quan_hang1=quan_hang2=quan_hang3=cha_hang1=cha_hang2=cha_hang3=0;
quan_lie1=quan_lie2=quan_lie3=cha_lie1=cha_lie2=cha_lie3=0;
quan_zuoxia=quan_youxia=cha_zuoxia=cha_youxia=0;
}
else if((quan_zuoxia==3)||(cha_zuoxia==3))
{
memset(MNG_USART1.TX_BUF,0,USART1_TX_LEN);
sprintf((char *)MNG_USART1.TX_BUF,
MNG_USART1.TX_Byte_Num = strlen((const char *)MNG_USART1.TX_BUF);
USART_TX_Data(MNG_USART1);
quan_hang1=quan_hang2=quan_hang3=cha_hang1=cha_hang2=cha_hang3=0;
quan_lie1=quan_lie2=quan_lie3=cha_lie1=cha_lie2=cha_lie3=0;
quan_zuoxia=quan_youxia=cha_zuoxia=cha_youxia=0;
}
else if((quan_youxia==3)||(cha_youxia==3))
{
memset(MNG_USART1.TX_BUF,0,USART1_TX_LEN);
sprintf((char *)MNG_USART1.TX_BUF,
MNG_USART1.TX_Byte_Num = strlen((const char *)MNG_USART1.TX_BUF);
USART_TX_Data(MNG_USART1);
quan_hang1=quan_hang2=quan_hang3=cha_hang1=cha_hang2=cha_hang3=0;
quan_lie1=quan_lie2=quan_lie3=cha_lie1=cha_lie2=cha_lie3=0;
quan_zuoxia=quan_youxia=cha_zuoxia=cha_youxia=0;
"ST<{\"cmd_code\":\"set_visible\",\"type\":\"widget\",\"widget\":\"gif8\",\"visible\":true}>ET");
"ST<{\"cmd_code\":\"set_visible\",\"type\":\"widget\",\"widget\":\"gif9\",\"visible\":true}>ET");
"ST<{\"cmd_code\":\"set_visible\",\"type\":\"widget\",\"widget\":\"gif10\",\"visible\":true}>ET");
"ST<{\"cmd_code\":\"set_visible\",\"type\":\"widget\",\"widget\":\"gif11\",\"visible\":true}>ET");
MNG_USART1.RX_OVER_FLG = FALSE;
RCC_OscInitTypeDef RCC_OscInitStruct;
RCC_ClkInitTypeDef RCC_ClkInitStruct;
RCC_PeriphCLKInitTypeDef PeriphClkInit;
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
RCC_OscInitStruct.HSICalibrationValue = 16;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL12;
RCC_OscInitStruct.PLL.PREDIV = RCC_PREDIV_DIV1;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
{
}
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
|RCC_CLOCKTYPE_PCLK1;
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK)
{
}
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USART1;
PeriphClkInit.Usart1ClockSelection = RCC_USART1CLKSOURCE_PCLK1;
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)
{
}
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000);
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
/* SysTick_IRQn interrupt configuration */
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
Error_Handler();
}
}
}
Error_Handler();
}
/** System Clock Configuration
*/
void SystemClock_Config(void)
{
}
/** Pinout Configuration
*/
static void MX_GPIO_Init(void)
{
Error_Handler();
GPIO_InitTypeDef GPIO_InitStruct;
/* GPIO Ports Clock Enable */
__HAL_RCC_GPIOA_CLK_ENABLE();
GPIO_InitStruct.Pin = GPIO_PIN_7;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP ;
GPIO_InitStruct.Pull = GPIO_PULLDOWN;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
GPIO_InitStruct.Pin = GPIO_PIN_4;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
/* USER CODE BEGIN Error_Handler */
/* User can add his own implementation to report the HAL error return state */
while(1)
{
}
/* USER CODE END Error_Handler */
}
/* USER CODE BEGIN 4 */
/* USER CODE END 4 */
/**
* @brief This function is executed in case of error occurrence.
* @param None
* @retval None
*/
void Error_Handler(void)
{
}
#ifdef USE_FULL_ASSERT
/**
* @brief Reports the name of the source file and the source line number
* where the assert_param error has occurred.
* @param file: pointer to the source file name
* @param line: assert_param error line source number
* @retval None
*/
void assert_failed(uint8_t* file, uint32_t line)
{
ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
}
#endif
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
/* USER CODE BEGIN 6 */
/* User can add his own implementation to report the file name and line number,
/* USER CODE END 6 */