This commit is contained in:
JiXieShi
2024-09-21 13:18:06 +08:00
parent 919a9ed1a7
commit 4e53f936d8
5 changed files with 45 additions and 39 deletions

View File

@@ -105,20 +105,21 @@ uint8_t tft_senddata(uint8_t *data, size_t len) {
void Test_tft() {
demo_tft.width = 480;
demo_tft.height = 320;
demo_tft.wgramcmd = WGRAM_CMD;
demo_tft.setycmd = SETYCMD;
demo_tft.setxcmd = SETXCMD;
demo_tft.writeReg = tft_writereg;
demo_tft.sendData = tft_senddata;
demo_tft.dir = HORIZONTAL;
//设备信息预填充
demo_tft.width = 480;//实际如有支持不用填(如ST7735/7796)
demo_tft.height = 320;//实际如有支持不用填(如ST7735/7796)
demo_tft.wgramcmd = WGRAM_CMD;//实际如有支持不用填(如ST7735/7796)
demo_tft.setycmd = SETYCMD;//实际如有支持不用填(如ST7735/7796)
demo_tft.setxcmd = SETXCMD;//实际如有支持不用填(如ST7735/7796)
demo_tft.writeReg = tft_writereg;//必须实现
demo_tft.sendData = tft_senddata;//必须实现
demo_tft.dir = HORIZONTAL;//必填
//模拟初始化
SIM_Display_INIT(demo_tft.width, demo_tft.height, 0xFFFF, 0x0000, 2, 0);
SIM_Display_START();
// SIM_Color_DrawPiexl(RGB565_to_RGB888(0xFFFFF),0,0);
Sleep(2000);
TFT_Init(&demo_tft);
TFT_Init(&demo_tft);//初始化
TFT_Color_t t;
t.color = 0XFFFF;
TFT_Fill(&demo_tft, 0, 0, demo_tft.width, demo_tft.height, t);
@@ -152,8 +153,11 @@ void Test_tft() {
TFT_ShowString(&demo_tft, 0, 160,
"abcdefghigklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ<>(){}[]\\/?.,;:'\"!@#$%^&*-=_+~|", 16, 1);
for (float p = 0; p < 1; p += 0.0001) {
for (float p = 0; p < 1; p += 0.001) {
TFT_ShowBar(&demo_tft, 0, 100, demo_tft.width, 24, p);
TFT_ShowBar(&demo_tft, 0, 125, demo_tft.width, 16, p);
TFT_ShowBar(&demo_tft, 0, 142, demo_tft.width, 12, p);
TFT_ShowBar(&demo_tft, 0, 155, demo_tft.width, 3, p);
}
while (1) {