stm32cubemx的设计如下:
接线如下:
代码如下:
main.h
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_SPI1_Init();
/* USER CODE BEGIN 2 */
float t=0;
LCD_Init();//LCD初始化
LCD_Fill(0,0,LCD_W,LCD_H,WHITE);
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
LCD_ShowChinese(0,0,"新年快乐",RED,WHITE,32,0);
LCD_ShowString(0,33,"Happy New Year!",BLUE,WHITE,32,0);
LCD_ShowString(0,66,"LCD_W:",RED,WHITE,32,0);
LCD_ShowIntNum(106,66,LCD_W,3,RED,WHITE,32);
LCD_ShowString(0,99,"LCD_H:",RED,WHITE,32,0);
LCD_ShowIntNum(106,99,LCD_H,3,RED,WHITE,32);
LCD_ShowFloatNum1(0,135,t,4,GREEN,WHITE,32);
t+=0.11;
LCD_ShowPicture(160,95,40,40,gImage_1);
}
/* USER CODE END 3 */
}
效果如下:
————————————————
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
原文链接:https://blog.csdn.net/kukunet/article/details/135720960
|
共1人点赞
|