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:
- 2:1be4e7457636
- Parent:
- 1:9770f292298c
- Child:
- 3:d050fe8ebd78
diff -r 9770f292298c -r 1be4e7457636 main.cpp
--- a/main.cpp Sun Nov 15 22:31:19 2020 +0000
+++ b/main.cpp Mon Nov 16 06:17:37 2020 +0000
@@ -5,12 +5,17 @@
extern "C" uint32_t getQuad ( uint16_t x, uint16_t y);
extern "C" uint32_t swapRedBlue ( uint32_t color);
extern "C" uint32_t toggleAlphaMSB ( uint32_t color);
-//extern "C" uint32_t rotateRGBBytes ( uint32_t color);
-//extern "C" uint32_t setRGBBits ( uint32_t color, uint8_t n);
+extern "C" uint32_t rotateRGBBytes ( uint32_t color);
+extern "C" uint32_t setRGBBits ( uint32_t color, uint8_t n);
LCD_DISCO_F429ZI lcd;
TS_DISCO_F429ZI ts;
+uint32_t blue = 0xFF0000FF;
+uint32_t green = 0xFF00FF00;
+uint32_t red = 0xFFFF0000;
+uint32_t yellow = 0xFFFFFF00;
+
int main()
{
TS_StateTypeDef TS_State;
@@ -45,28 +50,37 @@
lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"Project 3!!!", CENTER_MODE);
+ wait(1);
- wait(1);
+ lcd.Clear(LCD_COLOR_WHITE);
+ lcd.SetBackColor(LCD_COLOR_WHITE);
+
+ wait(.5);
int xSize = lcd.GetXSize()/2;
int ySize = lcd.GetYSize()/2;
- uint32_t blue = 0xFF0000FF;
- uint32_t green = 0xFF00FF00;
- uint32_t red = 0xFFFF0000;
- uint32_t yellow = 0xFFFFFF00;
+ int quad = 0;
lcd.SetTextColor(blue); //blue
+ lcd.DrawRect(0, 0, xSize, ySize);
lcd.FillRect(0, 0, xSize, ySize);
+
lcd.SetTextColor(green); //green
+ lcd.DrawRect(0, ySize, xSize, ySize);
lcd.FillRect(0, ySize, xSize, ySize);
+
lcd.SetTextColor(red); //red
+ lcd.DrawRect(xSize, 0, xSize, ySize);
lcd.FillRect(xSize, 0, xSize, ySize);
+
lcd.SetTextColor(yellow); //yellow
+ lcd.DrawRect(xSize, ySize, xSize, ySize);
lcd.FillRect(xSize, ySize, xSize, ySize);
while(1)
{
+ quad = 0;
ts.GetState(&TS_State);
if (TS_State.TouchDetected)
{
@@ -76,26 +90,33 @@
lcd.DisplayStringAt(0, LINE(0), (uint8_t *)&text, LEFT_MODE);
}
- int quad = getQuad(x, y);
+ quad = getQuad(x, y);
if(quad == 1){
blue = swapRedBlue(blue);
lcd.SetTextColor(blue);
+ lcd.DrawRect(0, 0, xSize, ySize);
lcd.FillRect(0, 0, xSize, ySize);
}
else if(quad == 2){
red = toggleAlphaMSB(red);
lcd.SetTextColor(red);
+ lcd.DrawRect(xSize, 0, xSize, ySize);
lcd.FillRect(xSize, 0, xSize, ySize);
}
else if(quad == 3){
-
+ yellow = rotateRGBBytes(yellow);
+ lcd.SetTextColor(yellow);
+ lcd.DrawRect(xSize, ySize, xSize, ySize);
+ lcd.FillRect(xSize, ySize, xSize, ySize);
}
else if(quad == 4){
-
+ green = setRGBBits(green, 2);
+ lcd.SetTextColor(green);
+ lcd.DrawRect(xSize, ySize, xSize, ySize);
+ lcd.FillRect(xSize, ySize, xSize, ySize);
}
-
wait(.2);
}
}