/* USER CODE END Header */
/* Includes ------------------------------------------------------------------*/
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
/* USER CODE END Includes */
/* Private typedef -----------------------------------------------------------*/
/* USER CODE BEGIN PTD */
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
TIM_HandleTypeDef htim17;
UART_HandleTypeDef huart1;
UART_HandleTypeDef huart2;
const uint8_t SendTbl[50] = {0x55,};
uint8_t RlyChkCnt = 0x00;
/* Private function prototypes -----------------------------------------------*/
void SystemClock_Config(void);
static void SystemPower_Config(void);
static void MX_GPIO_Init(void);
static void MX_USART1_UART_Init(void);
static void MX_ICACHE_Init(void);
static void MX_TIM17_Init(void);
static void MX_TIM1_Init(void);
static void MX_USART2_UART_Init(void);
/* USER CODE BEGIN PFP */
/* Private user code ---------------------------------------------------------*/
*
@brief The application entry point.
/* MCU Configuration--------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
/* USER CODE BEGIN Init */
/* Configure the system clock */
/* Configure the System Power */
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
HAL_GPIO_WritePin(GPIOC,GPIO_PIN_7,GPIO_PIN_SET);
printf("AT+RESTORE\r\n");
printf("AT+CWMODE=1\r\n");
printf("AT+CIPSNTPCFG=1,8,\"ntp1.aliyun.com\"\r\n");
printf("AT+CWJAP=\"Xiaomi 12 Pro\",\"12345678\"\r\n");
printf("AT+MQTTUSERCFG=0,1,\"NULL\",\"ESP8266&i7lwyBCAcAH\",\"86600e03e84f061e3714219ee04e72505ef186e5041aa05c00e125d4f6560905\",0,0,\"\"\r\n");
printf("AT+MQTTCLIENTID=0,\"i7lwyBCAcAH.ESP8266|securemode=2\\,signmethod=hmacsha256\\,timestamp=1679045538771|\"\r\n");
printf("AT+MQTTCONN=0,\"iot-06z00dmxlk2ol65.mqtt.iothub.aliyuncs.com\",1883,1\r\n");
printf("AT+MQTTSUB=0,\"/i7lwyBCAcAH/ESP8266/user/get\",1\r\n");
HAL_GPIO_WritePin(GPIOC,GPIO_PIN_7,GPIO_PIN_RESET);
huart2.Instance->CR1 |= (1<<5);
/* USER CODE BEGIN WHILE */
/* USER CODE END WHILE */
if(HAL_GPIO_ReadPin(GPIOC,GPIO_PIN_13) == 0)
HAL_GPIO_WritePin(GPIOG,GPIO_PIN_2,GPIO_PIN_SET); //R
HAL_GPIO_WritePin(GPIOG,GPIO_PIN_2,GPIO_PIN_RESET);
if(HAL_GPIO_ReadPin(GPIOC,GPIO_PIN_13) == 0)
HAL_GPIO_WritePin(GPIOB,GPIO_PIN_7,GPIO_PIN_RESET); //B Rly1
HAL_GPIO_WritePin(GPIOC,GPIO_PIN_7,GPIO_PIN_SET); //G Rly2
HAL_GPIO_WritePin(GPIOG,GPIO_PIN_2,GPIO_PIN_SET); //R Alarm
{ if((HAL_GPIO_ReadPin(GPIOB,GPIO_PIN_7) == 1) && (HAL_GPIO_ReadPin(GPIOC,GPIO_PIN_7) == 0)) //ÓÐÊä³öÇé¿öÏÂ,Rly1£ºon ÇÒ Rly2:0ffµÄÇé¿ö
HAL_GPIO_WritePin(GPIOG,GPIO_PIN_2,GPIO_PIN_RESET);
if(HAL_GPIO_ReadPin(GPIOC,GPIO_PIN_13) == 1)
HAL_GPIO_WritePin(GPIOB,GPIO_PIN_7,GPIO_PIN_RESET); //Rly1
HAL_GPIO_WritePin(GPIOC,GPIO_PIN_7,GPIO_PIN_SET); //Rly2
HAL_GPIO_WritePin(GPIOG,GPIO_PIN_2,GPIO_PIN_SET);
HAL_GPIO_WritePin(GPIOC,GPIO_PIN_7,GPIO_PIN_RESET); //Î޸澯²Åµ¯¿ªRly2
//if((HAL_GPIO_ReadPin(GPIOB,GPIO_PIN_7) == 0) || (HAL_GPIO_ReadPin(GPIOC,GPIO_PIN_7) == 1)) //ûÓÐÊä³öÇé¿öÏÂ,Rly1£ºoff »òÕß Rly2:0nµÄÇé¿ö
HAL_GPIO_WritePin(GPIOG,GPIO_PIN_2,GPIO_PIN_RESET);
LineAd = HAL_ADC_GetValue(&hadc4) / 4;
if((wTemp <= 20) && (LineAd< LineAdOld)) // Maybe N times zerocorr detect
if(FreqCnt > 250) //12.5ms 80Hz²»µ½ÅжÏΪ¸ÉÈÅ
if(b1sFlag & 0x02) //ÉϵçÑÓʱ1s ´ýÎÈ
*
@brief System Clock Configuration
void SystemClock_Config(void)
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
/** Configure the main internal regulator output voltage
if (HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1) != HAL_OK)
/** Initializes the CPU, AHB and APB buses clocks
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_MSI;
RCC_OscInitStruct.MSIState = RCC_MSI_ON;
RCC_OscInitStruct.MSICalibrationValue = RCC_MSICALIBRATION_DEFAULT;
RCC_OscInitStruct.MSIClockRange = RCC_MSIRANGE_4;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_MSI;
RCC_OscInitStruct.PLL.PLLMBOOST = RCC_PLLMBOOST_DIV1;
RCC_OscInitStruct.PLL.PLLM = 1;
RCC_OscInitStruct.PLL.PLLN = 80;
RCC_OscInitStruct.PLL.PLLP = 2;
RCC_OscInitStruct.PLL.PLLQ = 2;
RCC_OscInitStruct.PLL.PLLR = 2;
RCC_OscInitStruct.PLL.PLLRGE = RCC_PLLVCIRANGE_0;
RCC_OscInitStruct.PLL.PLLFRACN = 0;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
/** Initializes the CPU, AHB and APB buses clocks
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
RCC_ClkInitStruct.APB3CLKDivider = RCC_HCLK_DIV1;
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_4) != HAL_OK)
static void SystemPower_Config(void)
HAL_PWREx_EnableVddIO2();
* Disable the internal Pull-Up in Dead Battery pins of UCPD peripheral
HAL_PWREx_DisableUCPDDeadBattery();
* Switch to SMPS regulator instead of LDO
if (HAL_PWREx_ConfigSupply(PWR_SMPS_SUPPLY) != HAL_OK)
/* USER CODE BEGIN PWR */
* @brief ICACHE Initialization Function
static void MX_ICACHE_Init(void)
/* USER CODE BEGIN ICACHE_Init 0 */
/* USER CODE END ICACHE_Init 0 */
/* USER CODE BEGIN ICACHE_Init 1 */
/* USER CODE END ICACHE_Init 1 */
/** Enable instruction cache in 1-way (direct mapped cache)
if (HAL_ICACHE_ConfigAssociativityMode(ICACHE_1WAY) != HAL_OK)
if (HAL_ICACHE_Enable() != HAL_OK)
/* USER CODE BEGIN ICACHE_Init 2 */
/* USER CODE END ICACHE_Init 2 */
* @brief TIM1 Initialization Function
static void MX_TIM1_Init(void)
/* USER CODE BEGIN TIM1_Init 0 */
/* USER CODE END TIM1_Init 0 */
TIM_ClockConfigTypeDef sClockSourceConfig = {0};
TIM_MasterConfigTypeDef sMasterConfig = {0};
/* USER CODE BEGIN TIM1_Init 1 */
/* USER CODE END TIM1_Init 1 */
htim1.Init.Prescaler = 0;
htim1.Init.CounterMode = TIM_COUNTERMODE_UP;
htim1.Init.Period = 8000;
htim1.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
htim1.Init.RepetitionCounter = 0;
htim1.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
if (HAL_TIM_Base_Init(&htim1) != HAL_OK)
sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL;
if (HAL_TIM_ConfigClockSource(&htim1, &sClockSourceConfig) != HAL_OK)
sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
sMasterConfig.MasterOutputTrigger2 = TIM_TRGO2_RESET;
sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
if (HAL_TIMEx_MasterConfigSynchronization(&htim1, &sMasterConfig) != HAL_OK)
/* USER CODE BEGIN TIM1_Init 2 */
/* USER CODE END TIM1_Init 2 */
* @brief TIM17 Initialization Function
static void MX_TIM17_Init(void)
/* USER CODE BEGIN TIM17_Init 0 */
/* USER CODE END TIM17_Init 0 */
/* USER CODE BEGIN TIM17_Init 1 */
/* USER CODE END TIM17_Init 1 */
htim17.Init.Prescaler = 160;
htim17.Init.CounterMode = TIM_COUNTERMODE_UP;
htim17.Init.Period = 65535;
htim17.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
htim17.Init.RepetitionCounter = 0;
htim17.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_ENABLE;
if (HAL_TIM_Base_Init(&htim17) != HAL_OK)
/* USER CODE BEGIN TIM17_Init 2 */
/* USER CODE END TIM17_Init 2 */
* @brief USART1 Initialization Function
static void MX_USART1_UART_Init(void)
/* USER CODE BEGIN USART1_Init 0 */
/* USER CODE END USART1_Init 0 */
/* USER CODE BEGIN USART1_Init 1 */
/* USER CODE END USART1_Init 1 */
huart1.Instance = USART1;
huart1.Init.BaudRate = 115200;
huart1.Init.WordLength = UART_WORDLENGTH_8B;
huart1.Init.StopBits = UART_STOPBITS_1;
huart1.Init.Parity = UART_PARITY_NONE;
huart1.Init.Mode = UART_MODE_TX_RX;
huart1.Init.HwFlowCtl = UART_HWCONTROL_NONE;
huart1.Init.OverSampling = UART_OVERSAMPLING_16;
huart1.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
huart1.Init.ClockPrescaler = UART_PRESCALER_DIV1;
huart1.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
if (HAL_UART_Init(&huart1) != HAL_OK)
if (HAL_UARTEx_SetTxFifoThreshold(&huart1, UART_TXFIFO_THRESHOLD_1_8) != HAL_OK)
if (HAL_UARTEx_SetRxFifoThreshold(&huart1, UART_RXFIFO_THRESHOLD_1_8) != HAL_OK)
if (HAL_UARTEx_DisableFifoMode(&huart1) != HAL_OK)
/* USER CODE BEGIN USART1_Init 2 */
/* USER CODE END USART1_Init 2 */
* @brief USART2 Initialization Function
static void MX_USART2_UART_Init(void)
/* USER CODE BEGIN USART2_Init 0 */
/* USER CODE END USART2_Init 0 */
/* USER CODE BEGIN USART2_Init 1 */
/* USER CODE END USART2_Init 1 */
huart2.Instance = USART2;
huart2.Init.BaudRate = 115200;
huart2.Init.WordLength = UART_WORDLENGTH_8B;
huart2.Init.StopBits = UART_STOPBITS_1;
huart2.Init.Parity = UART_PARITY_NONE;
huart2.Init.Mode = UART_MODE_TX_RX;
huart2.Init.HwFlowCtl = UART_HWCONTROL_NONE;
huart2.Init.OverSampling = UART_OVERSAMPLING_16;
huart2.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
huart2.Init.ClockPrescaler = UART_PRESCALER_DIV1;
huart2.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
if (HAL_UART_Init(&huart2) != HAL_OK)
if (HAL_UARTEx_SetTxFifoThreshold(&huart2, UART_TXFIFO_THRESHOLD_1_8) != HAL_OK)
if (HAL_UARTEx_SetRxFifoThreshold(&huart2, UART_RXFIFO_THRESHOLD_1_8) != HAL_OK)
if (HAL_UARTEx_DisableFifoMode(&huart2) != HAL_OK)
/* USER CODE BEGIN USART2_Init 2 */
/* USER CODE END USART2_Init 2 */
* @brief GPIO Initialization Function
static void MX_GPIO_Init(void)
GPIO_InitTypeDef GPIO_InitStruct = {0};
/* USER CODE BEGIN MX_GPIO_Init_1 */
/* USER CODE END MX_GPIO_Init_1 */
/* GPIO Ports Clock Enable */
__HAL_RCC_GPIOC_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOG_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOG, GPIO_PIN_2, GPIO_PIN_RESET);
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_7, GPIO_PIN_RESET);
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_7, GPIO_PIN_RESET);
/*Configure GPIO pin : PC13 */
GPIO_InitStruct.Pin = GPIO_PIN_13;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
/*Configure GPIO pin : PC3 */
GPIO_InitStruct.Pin = GPIO_PIN_3;
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
/*Configure GPIO pin : PG2 */
GPIO_InitStruct.Pin = GPIO_PIN_2;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOG, &GPIO_InitStruct);
/*Configure GPIO pin : PC7 */
GPIO_InitStruct.Pin = GPIO_PIN_7;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
/*Configure GPIO pin : PB7 */
GPIO_InitStruct.Pin = GPIO_PIN_7;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
/* USER CODE BEGIN MX_GPIO_Init_2 */
/* USER CODE END MX_GPIO_Init_2 */
#define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)
USART_SendData_8bit(CW_UART1, (uint8_t)ch);
while (USART_GetFlagStatus(CW_UART1, USART_FLAG_TXE) == RESET);
#define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)
HAL_UART_Transmit(&huart1,(uint8_t *)f,1,HAL_MAX_DELAY);
int fputc(int c, FILE* f)
HAL_UART_Transmit(&huart1,(uint8_t*)&c,1,HAL_MAX_DELAY);
int fputc(int c, FILE* f)
HAL_UART_Transmit(&huart2,(uint8_t*)&c,1,HAL_MAX_DELAY);
int fputc(int c, FILE* f)
HAL_UART_Transmit(&huart1,&ch,1,HAL_MAX_DELAY);
* @brief This function is executed in case of error occurrence.
/* USER CODE BEGIN Error_Handler_Debug */
/* User can add his own implementation to report the HAL error return state */
/* USER CODE END Error_Handler_Debug */
* @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
void assert_failed(uint8_t *file, uint32_t line)
/* User can add his own implementation to report the file name and line number,
ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
#endif /* USE_FULL_ASSERT */
/* Includes ------------------------------------------------------------------*/
#include "stm32u5xx_it.h"
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
//extern ADC_HandleTypeDef hadc4;
/* USER CODE END Includes */
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
#define HalSetInvPwmPosDuty(Temp) TIM1->CCR1 = Temp
#define HalSetInvPwmNegDuty(Temp) TIM1->CCR2 = Temp
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
uint8_t RxBuff[8] = {0,};
uint8_t DataParsingCnt = 0x00;
uint8_t DataRecCnt = 0x00;
/* Private function prototypes -----------------------------------------------*/
/* USER CODE BEGIN PFP */
extern UART_HandleTypeDef huart1;
extern uint8_t fRly1OnOff;
/* Private user code ---------------------------------------------------------*/
/* External variables --------------------------------------------------------*/
extern TIM_HandleTypeDef htim1;
extern UART_HandleTypeDef huart2;
/******************************************************************************/
/* Cortex Processor Interruption and Exception Handlers */
/******************************************************************************/
* @brief This function handles Non maskable interrupt.
/* USER CODE BEGIN NonMaskableInt_IRQn 0 */
/* USER CODE END NonMaskableInt_IRQn 0 */
/* USER CODE BEGIN NonMaskableInt_IRQn 1 */
/* USER CODE END NonMaskableInt_IRQn 1 */
* @brief This function handles Hard fault interrupt.
void HardFault_Handler(void)
/* USER CODE BEGIN HardFault_IRQn 0 */
/* USER CODE END HardFault_IRQn 0 */
/* USER CODE BEGIN W1_HardFault_IRQn 0 */
/* USER CODE END W1_HardFault_IRQn 0 */
* @brief This function handles Memory management fault.
void MemManage_Handler(void)
/* USER CODE BEGIN MemoryManagement_IRQn 0 */
/* USER CODE END MemoryManagement_IRQn 0 */
/* USER CODE BEGIN W1_MemoryManagement_IRQn 0 */
/* USER CODE END W1_MemoryManagement_IRQn 0 */
* @brief This function handles Prefetch fault, memory access fault.
void BusFault_Handler(void)
/* USER CODE BEGIN BusFault_IRQn 0 */
/* USER CODE END BusFault_IRQn 0 */
/* USER CODE BEGIN W1_BusFault_IRQn 0 */
/* USER CODE END W1_BusFault_IRQn 0 */
* @brief This function handles Undefined instruction or illegal state.
void UsageFault_Handler(void)
/* USER CODE BEGIN UsageFault_IRQn 0 */
/* USER CODE END UsageFault_IRQn 0 */
/* USER CODE BEGIN W1_UsageFault_IRQn 0 */
/* USER CODE END W1_UsageFault_IRQn 0 */
* @brief This function handles System service call via SWI instruction.
/* USER CODE BEGIN SVCall_IRQn 0 */
/* USER CODE END SVCall_IRQn 0 */
/* USER CODE BEGIN SVCall_IRQn 1 */
/* USER CODE END SVCall_IRQn 1 */
* @brief This function handles Debug monitor.
void DebugMon_Handler(void)
/* USER CODE BEGIN DebugMonitor_IRQn 0 */
/* USER CODE END DebugMonitor_IRQn 0 */
/* USER CODE BEGIN DebugMonitor_IRQn 1 */
/* USER CODE END DebugMonitor_IRQn 1 */
* @brief This function handles Pendable request for system service.
void PendSV_Handler(void)
/* USER CODE BEGIN PendSV_IRQn 0 */
/* USER CODE END PendSV_IRQn 0 */
/* USER CODE BEGIN PendSV_IRQn 1 */
/* USER CODE END PendSV_IRQn 1 */
* @brief This function handles System tick timer.
void SysTick_Handler(void)
/* USER CODE BEGIN SysTick_IRQn 0 */
/* USER CODE END SysTick_IRQn 0 */
/* USER CODE BEGIN SysTick_IRQn 1 */
/* USER CODE END SysTick_IRQn 1 */
/******************************************************************************/
/* STM32U5xx Peripheral Interrupt Handlers */
/* Add here the Interrupt Handlers for the used peripherals. */
/* For the available peripheral interrupt handler names, */
/* please refer to the startup file (startup_stm32u5xx.s). */
/******************************************************************************/
* @brief This function handles TIM1 Update interrupt.
void TIM1_UP_IRQHandler(void)
/* USER CODE BEGIN TIM1_UP_IRQn 0 */
/* USER CODE END TIM1_UP_IRQn 0 */
HAL_TIM_IRQHandler(&htim1);
/* USER CODE BEGIN TIM1_UP_IRQn 1 */
if((TIM1->SR & TIM_FLAG_UPDATE) == TIM_FLAG_UPDATE)
//__HAL_TIM_CLEAR_FLAG(&htim1,TIM_FLAG_UPDATE);
TIM1->SR = ~TIM_FLAG_UPDATE;
if((hadc4.Instance->ISR & (1<<2)) != 0) //EOS:3 EOC:2
LineAd = HAL_ADC_GetValue(&hadc4);
/* USER CODE END TIM1_UP_IRQn 1 */
* @brief This function handles USART2 global interrupt.
void USART2_IRQHandler(void)
/* USER CODE BEGIN USART2_IRQn 0 */
/* USER CODE END USART2_IRQn 0 */
//HAL_UART_IRQHandler(&huart2);
/* USER CODE BEGIN USART2_IRQn 1 */
if((huart2.Instance->ISR & UART_FLAG_RXNE) != RESET)
Temp = huart2.Instance->RDR; //Read RxReg,Clear RXNE
if((DataParsingCnt == 1) && (DataRecCnt == 1))
if((DataParsingCnt == 2) && (DataRecCnt == 2))
if(DataParsingCnt >= 3) //½ÓÊÕon/off
if((DataParsingCnt == 4) && (DataRecCnt == 1))
HAL_GPIO_WritePin(GPIOB,GPIO_PIN_7,GPIO_PIN_SET); //Rly1
HAL_GPIO_WritePin(GPIOC,GPIO_PIN_7,GPIO_PIN_RESET); //Rly2
if((DataParsingCnt == 4) && (DataRecCnt == 1))
else if((DataParsingCnt == 5) && (DataRecCnt == 2))
HAL_GPIO_WritePin(GPIOB,GPIO_PIN_7,GPIO_PIN_RESET); //Rly1
//HAL_GPIO_WritePin(GPIOC,GPIO_PIN_7,GPIO_PIN_SET); //Rly2
else if((DataRecCnt > 8) || (Temp == '}'))
/* USER CODE END USART2_IRQn 1 */