This commit is contained in:
JiXieShi
2024-09-21 23:07:22 +08:00
parent 6c9a999c71
commit 8f7f72712c
27 changed files with 100 additions and 81 deletions

View File

@@ -1,6 +1,6 @@
#ifndef HW_LIB_T_TFT_H
#define HW_LIB_T_TFT_H
void Test_tft(void *);
int Test_tft(void *);
#endif //HW_LIB_T_TFT_H

View File

@@ -9,7 +9,7 @@
TFT_T demo_tft;
uint16_t xs = 0, ys = 0, xe = 0, ye = 0;
bool fill;
static SIM_Display_t tft_display;
SIM_Display_t tft_display;
//屏幕指令
#define WGRAM_CMD 0x5C
#define SETXCMD 0x2A
@@ -79,7 +79,7 @@ uint8_t tft_senddata(uint8_t *data, size_t len) {
if (len == 2) {
color_u.u8[1] = *data;
color_u.u8[0] = *data++;
SIM_Color_DrawPiexl(&tft_display, (SIM_Color_t) RGB565_to_RGB888(color_u.u16, true), xs, ys);
SIM_Color_DrawPiexl(&tft_display, (SIM_Color_t) RGB565_to_ARGB8888(color_u.u16, true), xs, ys);
// LOGT("Piexl","color:%x,x:%d,y:%d,len:%d",color_u.u16,xs,ys,len);
// SIM_Color_ImgFromBuffer(color,xs, ys, uint16_t width, 1)
} else {
@@ -88,7 +88,7 @@ uint8_t tft_senddata(uint8_t *data, size_t len) {
data++;
color_u.u8[0] = *data;
data++;
color[i] = RGB565_to_RGB888(color_u.u16, true) | 0xFF000000;
color[i] = RGB565_to_ARGB8888(color_u.u16, true);
}
SIM_Color_ImgFromBuffer(&tft_display, color, xs, ys, len / 2 - 1, 1);
// SIM_Color_DrawHLineBuffer(color, xs, ys, len / 2);
@@ -103,8 +103,7 @@ uint8_t tft_senddata(uint8_t *data, size_t len) {
return result;
}
void Test_tft(void *) {
int Test_tft(void *arg) {
//设备信息预填充
demo_tft.width = 480;//实际如有支持不用填(如ST7735/7796)
demo_tft.height = 320;//实际如有支持不用填(如ST7735/7796)
@@ -159,9 +158,10 @@ void Test_tft(void *) {
TFT_ShowBar(&demo_tft, 0, 142, demo_tft.width, 12, p);
TFT_ShowBar(&demo_tft, 0, 155, demo_tft.width, 3, p);
}
while (1) {
Sleep(5);
}
// while (1) {
//
// Sleep(5);
// }
SIM_Display_STOP(&tft_display);
return 0;
}