一、配置过程
因为FSMC搞了半天没搞明白,然后使用SPI做了记录
1、配置RCC、SYS、84MHz
2、开启SPI1 Mode选择Full-Duplex Master
2、将SPI自动配置的PA5引脚改成PB3
3、将PB10、PB12、PB13设置为输出模式
4、生成代码
二、移植代码
1、将BSP中MyGUI Mylcd MySPI Mysys MyTC77文件加入
2、C/C++中添加路径
3、在main.h中添加代码
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
#include "Mylcd.h"
#include "MyGUI.h"
#include "MyTC77.h"
#define delay_ms(x) HAL_Delay(x)
#define Delay_ms(x) HAL_Delay(x)
4、重写fptc、fgetc
int fputc(int ch,FILE* f)
{
HAL_UART_Transmit(&huart1,(uint8_t *)&ch,1,HAL_MAX_DELAY);
return ch;
}
int fgetc(FILE *f)
{
uint8_t ch;
HAL_UART_Receive(&huart1,(uint8_t *)&ch,1,HAL_MAX_DELAY);
return ch;
}
5、初始化LCD
LCD_Init();
6、显示代码
sprintf(buffer,"I am fine.");
Show_Str(0,40,BLACK, WHITE, (u8 *)buffer, sizeof(buffer), 0);