赞
踩
- void HAL_GPIO_EXTI_Rising_Callback(uint16_t GPIO_Pin)
-
- {
-
- if (GPIO_Pin == BUTTON_USER_PIN)
-
- {
-
- UserButtonStatus = 1;
-
- }
-
- }
-
- int main(void)
-
- {
-
- uint8_t MLF[7]={'S','1','F','0','5','0','T'};
-
- uint8_t MLP[7]={'S','1','D','0','0','3','T'};
-
- uint8_t n=3;
-
- HAL_Init();
-
- SystemClock_Config();
-
- MX_GPIO_Init();
-
- MX_USART2_UART_Init();
-
- MX_ICACHE_Init();
-
- BSP_LED_Init(LED1);
-
- BSP_LED_Init(LED3);
-
- if (HAL_UART_Transmit(&huart2, (uint8_t *)MLF, 7, 5000) != HAL_OK)
-
- {
-
- Error_Handler();
-
- }
-
- while (1)
-
- {
-
- BSP_PB_Init(BUTTON_USER, BUTTON_MODE_EXTI);
-
- while (UserButtonStatus == 0)
-
- {
-
- BSP_LED_Toggle(LED1);
-
- HAL_Delay(100);
-
- }
-
- BSP_LED_Off(LED1);
-
- MLP[4]= n/10+'0';
-
- MLP[5]= n%10+'0';
-
- n=(n+1)%13;
-
- if(n==0) n=3;
-
- UserButtonStatus = 0;
-
- if (HAL_UART_Transmit(&huart2, (uint8_t *)MLP, 7, 5000) != HAL_OK)
-
- {
-
- Error_Handler();
-
- }
-
- HAL_Delay(100);
-
- }
-
- }
-
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。