软件SPI可以驱动屏幕

This commit is contained in:
2026-07-14 14:44:07 +08:00
parent 3577003fb6
commit 0a5c478a42
53 changed files with 9354 additions and 87 deletions

View File

@@ -18,12 +18,16 @@
/* USER CODE END Header */
/* Includes ------------------------------------------------------------------*/
#include "main.h"
#include "dma.h"
#include "spi.h"
#include "usart.h"
#include "gpio.h"
#include "lcd_data.h"
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include <stdio.h>
#include "button_driver.h"
#include "st7735s.h"
/* USER CODE END Includes */
@@ -87,9 +91,21 @@ int main(void)
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_DMA_Init();
MX_USART1_UART_Init();
MX_SPI2_Init();
/* USER CODE BEGIN 2 */
printf("\r\nSTM32F103C8T6 Boot OK\r\n");
button_driver_init();
st7735s_init();
st7735s_fill_screen(COLOR_RED);
HAL_Delay(500);
st7735s_fill_screen(COLOR_GREEN);
HAL_Delay(500);
st7735s_fill_screen(COLOR_BLUE);
HAL_Delay(500);
st7735s_fill_screen(COLOR_BLACK);
st7735s_draw_string(0, 0, "LCD OK", COLOR_WHITE, COLOR_BLACK);
/* USER CODE END 2 */
/* Infinite loop */
@@ -101,7 +117,7 @@ int main(void)
/* USER CODE BEGIN 3 */
HAL_Delay(500);
HAL_GPIO_TogglePin(LED_GPIO_Port, LED_Pin);
printf("Hello word\n");
//printf("Hello word\n");
}
/* USER CODE END 3 */
}