大家好,我又又来啦~!先祝愿ST社区论坛越来越好~!
传统节目:桂花~上酸菜~!
小伙伴们说我只有旧板子,来,给你们看看新的。
废话不多说,桂花~上酸菜~!
部分Main函数代码:
- /* Private user code ---------------------------------------------------------*/
- /* USER CODE BEGIN 0 */
- static int steps=0;//状态
- static int Status=0;//步骤
- /* USER CODE END 0 */
- /**
- * @brief The application entry point.
- * @retval int
- */
- int main(void)
- {
- /* USER CODE BEGIN 1 */
- /* USER CODE END 1 */
- /* MCU Configuration--------------------------------------------------------*/
- /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
- HAL_Init();
- /* USER CODE BEGIN Init */
- /* USER CODE END Init */
- /* Configure the system clock */
- SystemClock_Config();
- /* USER CODE BEGIN SysInit */
- /* USER CODE END SysInit */
- /* Initialize all configured peripherals */
- MX_GPIO_Init();
- MX_LPUART1_UART_Init();
- MX_SPI2_Init();
- /* USER CODE BEGIN 2 */
- Status=1;
- HAL_GPIO_WritePin(LD2_GPIO_Port, LD2_Pin, GPIO_PIN_SET);
- steps = HT_1in54b_V2_init();
- /* USER CODE END 2 */
- /* Infinite loop */
- /* USER CODE BEGIN WHILE */
- while (1)
- {
- /* USER CODE END WHILE */
- /* USER CODE BEGIN 3 */
- }
- /* USER CODE END 3 */
- }
复制代码- /* USER CODE BEGIN 4 */
- void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
- {
- /* NOTE: This function Should not be modified, when the callback is needed,
- the HAL_GPIO_EXTI_Callback could be implemented in the user file
- */
- switch(GPIO_Pin)
- { //LD3_Pin|LD2_Pin
- case B1_Pin:
- if(Status==1)
- {
- if(steps==1)
- {
- Status=0;
- HT_1in54b_V2_clear();
- Status=HT_1in54b_V2_showLogo1();
- }
- else if(steps==2)
- {
- Status=0;
- HT_1in54b_V2_clear();
- Status=HT_1in54b_V2_showWord1();
- }
- else if(steps==3)
- {
- Status=0;
- HT_1in54b_V2_clear();
- Status=HT_1in54b_V2_showLogo2();
- }
- else if(steps==4)
- {
- Status=0;
- HT_1in54b_V2_clear();
- Status=HT_1in54b_V2_showWord2();
- }
- steps+=1;
- if(steps>=5)
- {
- steps=1;
- }
- }
-
- break;
- default:
- break;
- }
- }
- /* USER CODE END 4 */
复制代码
双手奉上代码。
全部代码及CubeMX配置:
链接:https://pan.baidu.com/s/19vbPL4WoJOzACWszifYSKQ
提取码:rtnb
|