Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: LCD_DISCO_F429ZI mbed TS_DISCO_F429ZI BSP_DISCO_F429ZI
Diff: main.cpp
- Revision:
- 1:9770f292298c
- Parent:
- 0:e579c6f35abf
- Child:
- 2:1be4e7457636
diff -r e579c6f35abf -r 9770f292298c main.cpp
--- a/main.cpp Sun Nov 15 21:53:52 2020 +0000
+++ b/main.cpp Sun Nov 15 22:31:19 2020 +0000
@@ -16,13 +16,38 @@
TS_StateTypeDef TS_State;
uint16_t x, y;
uint8_t text[30];
- //uint8_t status;
+ uint8_t status;
BSP_LCD_SetFont(&Font20);
+
+ status = ts.Init(lcd.GetXSize(), lcd.GetYSize());
+ if (status != TS_OK)
+ {
+ lcd.Clear(LCD_COLOR_RED);
+ lcd.SetBackColor(LCD_COLOR_RED);
+ lcd.SetTextColor(LCD_COLOR_WHITE);
+ lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"TOUCHSCREEN", CENTER_MODE);
+ lcd.DisplayStringAt(0, LINE(6), (uint8_t *)"INIT FAIL", CENTER_MODE);
+ }
+ else
+ {
+ lcd.Clear(LCD_COLOR_GREEN);
+ lcd.SetBackColor(LCD_COLOR_GREEN);
+ lcd.SetTextColor(LCD_COLOR_WHITE);
+ lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"TOUCHSCREEN", CENTER_MODE);
+ lcd.DisplayStringAt(0, LINE(6), (uint8_t *)"INIT OK", CENTER_MODE);
+ }
+
+ wait(1);
+ lcd.Clear(LCD_COLOR_BLUE);
+ lcd.SetBackColor(LCD_COLOR_BLUE);
+
+
lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"Project 3!!!", CENTER_MODE);
+
wait(1);
-
+
int xSize = lcd.GetXSize()/2;
int ySize = lcd.GetYSize()/2;
@@ -39,10 +64,6 @@
lcd.FillRect(xSize, 0, xSize, ySize);
lcd.SetTextColor(yellow); //yellow
lcd.FillRect(xSize, ySize, xSize, ySize);
-
- //status = ts.Init(lcd.GetXSize(), lcd.GetYSize());
-
- wait(1);
while(1)
{
@@ -52,9 +73,11 @@
x = TS_State.X;
y = TS_State.Y;
sprintf((char*)text, "x=%d y=%d ", x, y);
- lcd.DisplayStringAt(0, LINE(0), (uint8_t *)&text, LEFT_MODE);
-
- int quad = getQuad(x, y);
+ lcd.DisplayStringAt(0, LINE(0), (uint8_t *)&text, LEFT_MODE);
+ }
+
+ int quad = getQuad(x, y);
+
if(quad == 1){
blue = swapRedBlue(blue);
@@ -67,12 +90,12 @@
lcd.FillRect(xSize, 0, xSize, ySize);
}
else if(quad == 3){
+
}
else if(quad == 4){
}
-
- }
+ wait(.2);
}
}