Created
March 26, 2019 12:48
-
-
Save maciekmm/d2b2af8ccc1708fc32e490b9cca4f7be to your computer and use it in GitHub Desktop.
ts.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BSP_LCD_SelectLayer(0); | |
srand(time(NULL)); | |
for (int i = 0; i < 3; i++) { | |
BSP_LCD_SetTextColor((((uint32_t) rand()) & 0x00FFFFFF) + 0xFF000000); | |
int x1 = rand() % LCD_X_SIZE; | |
int x2 = rand() % LCD_X_SIZE; | |
int y1 = rand() % LCD_Y_SIZE; | |
int y2 = rand() % LCD_Y_SIZE; | |
int xl = min(x1, x2); | |
int xr = max(x1, x2); | |
int yt = min(y1, y2); | |
int yb = max(x1, x2); | |
BSP_LCD_FillRect(xl, yt, xr-xl, yb-yt); | |
} | |
Point points[4] = { {50, 50}, {200, 50}, {200, 100}, {80, 100} }; | |
BSP_LCD_FillPolygon(points, 4); | |
TS_StateTypeDef TS_State; | |
BSP_TS_GetState(&TS_State); | |
for (int i = 0; i < TS_State.touchDetected; i++) { | |
uint16_t x = TS_State.touchX[i]; | |
uint16_t y = TS_State.touchY[i]; | |
BSP_LCD_FillCircle(x, y, 6); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment