
Final Version Program 4 Kornreich
Dependencies: LCD_DISCO_F429ZI mbed TS_DISCO_F429ZI BSP_DISCO_F429ZI
Revision 0:9c65f066245c, committed 2021-12-07
- Comitter:
- wkornreich
- Date:
- Tue Dec 07 07:20:04 2021 +0000
- Commit message:
- FInal Version Program 4;
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Alpha.S Tue Dec 07 07:20:04 2021 +0000 @@ -0,0 +1,29 @@ + AREA alpha, CODE, READONLY + GLOBAL alphaC + + ; uint32_t alphaC(uint32_t *) +alphaC + + PUSH {R4} + LDR R3,[R0]; color value + + LDR R0, =0x80000000 + + + + + + ADD R3, R3, R0 + + MOV R0, R3 + + + pop {R4} + + + + + BX LR + + + END \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BSP_DISCO_F429ZI.lib Tue Dec 07 07:20:04 2021 +0000 @@ -0,0 +1,1 @@ +https://developer.mbed.org/teams/ST/code/BSP_DISCO_F429ZI/#53d9067a4feb
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LCD_DISCO_F429ZI.lib Tue Dec 07 07:20:04 2021 +0000 @@ -0,0 +1,1 @@ +https://developer.mbed.org/teams/ST/code/LCD_DISCO_F429ZI/#dc55a068bc1a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/RotateRight.S Tue Dec 07 07:20:04 2021 +0000 @@ -0,0 +1,43 @@ + AREA R, CODE, READONLY + GLOBAL rotate + + ; uint32_t alphaC(uint32_t *) +rotate + + PUSH {R4,R5,R6} + LDR R3,[R0]; color value + + LDR R0, =0x000000FF + LDR R1, =0x0000FF00 + LDR R2, =0x00FF0000 + + + AND R4, R3, R0 + AND R5, R3, R1 + AND R6, R3, R2 + + BIC R3, R3, R0 + BIC R3, R3, R1 + BIC R3, R3, R2 + + + + LSL R4, R4, #16 + LSR R5, R5, #8 + LSR R6, R6, #8 + + + ADD R3, R3, R4 + ADD R3, R3, R5 + ADD R3, R3, R6 + MOV R0, R3 + + POP {R4,R5,R6} + + + + + BX LR + + + END \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Swap.S Tue Dec 07 07:20:04 2021 +0000 @@ -0,0 +1,31 @@ + AREA Swap, CODE, READONLY + GLOBAL swap + + ; uint32_t swap(uint32_t *) +swap + + PUSH {R4} + LDR R3,[R0]; color value + + LDR R0, =0x000000FF + LDR R1, =0x0000FF00 + AND R2, R3, R0 + AND R4, R3, R1 + BIC R3, R3, R0 + BIC R3, R3, R1 + LSL R2, R2, #8 + LSR R4, R4, #8 + ADD R3, R3, R2 + ADD R3, R3, R4 + MOV R0, R3 + + + pop {R4} + + + + + BX LR + + + END \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TS_DISCO_F429ZI.lib Tue Dec 07 07:20:04 2021 +0000 @@ -0,0 +1,1 @@ +https://developer.mbed.org/teams/ST/code/TS_DISCO_F429ZI/#4f8b6df8e235
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fourth.S Tue Dec 07 07:20:04 2021 +0000 @@ -0,0 +1,29 @@ + AREA R, CODE, READONLY + GLOBAL optionFour + + ; uint32_t optionFour(uint32_t *) +optionFour + + PUSH {R4,R5,R6} + LDR R0,[R0]; color value + LDR R1, =0x00FFFFFF + LDR R3, =0xFF000000 + AND R2, R0, R1 + MVN R2, R2 + BIC R2, R3 + BIC R0, R1 + ADD R0, R2 + MOV R3, R0 + + + + + POP {R4,R5,R6} + + + + + BX LR + + + END \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Dec 07 07:20:04 2021 +0000 @@ -0,0 +1,168 @@ +#include "mbed.h" +#include "TS_DISCO_F429ZI.h" +#include "LCD_DISCO_F429ZI.h" + +LCD_DISCO_F429ZI lcd; +TS_DISCO_F429ZI ts; + +uint16_t winningSection = 1; +uint32_t counter1 = 0; +uint32_t color1 = 0xFFFF00F0; // +uint32_t color2 = 0xFF00FF00; //green +uint32_t color3 = 0xFF0000FF; //blue +uint32_t color4 = 0xF3FF1427; // + + +extern "C" void AddOne(uint32_t *); +extern "C" uint16_t compare(uint32_t *); +extern "C" uint16_t swap(uint32_t *); +extern "C" uint16_t alphaC(uint32_t *); +extern "C" uint16_t rotate(uint32_t *); +extern "C" uint16_t optionFour(uint32_t *); + +InterruptIn user_button(USER_BUTTON); + +void button_pressed() { +/* + lcd.Clear(LCD_COLOR_BLUE); + lcd.SetBackColor(LCD_COLOR_RED); + lcd.SetTextColor(LCD_COLOR_WHITE); + wait(.5); + lcd.DisplayStringAt(0, LINE(4), (uint8_t *)"RESETING", CENTER_MODE); + lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"GAME", CENTER_MODE); + wait(1); + winningSection = rand()%3+1; + lcd.Clear(LCD_COLOR_BLUE); + lcd.SetBackColor(LCD_COLOR_BLUE); + + lcd.SetTextColor(color4); + lcd.FillRect(0, 00, 240, 80); + lcd.SetTextColor(color3); + lcd.FillRect(0, 80, 240, 80); + lcd.SetTextColor(color2); + lcd.FillRect(0, 160, 240, 80); + lcd.SetTextColor(color1); + lcd.FillRect(0, 240, 240, 80); + + */ + } + + +void button_released() +{ + +} + +int main() +{ + + user_button.rise(&button_pressed); + user_button.fall(&button_released); + + TS_StateTypeDef TS_State; + uint16_t x, y; + uint8_t text[30]; + uint8_t status; + + BSP_LCD_SetFont(&Font20); + + lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"COLOR FUN", CENTER_MODE); + lcd.DisplayStringAt(0, LINE(6), (uint8_t *)"IM SORRY ITS LATE", CENTER_MODE); + lcd.DisplayStringAt(0, LINE(7), (uint8_t *)"I HAD THE FLU", CENTER_MODE); + + wait(3); + + 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.SetTextColor(color4); + lcd.FillRect(0, 00, 240, 80); + lcd.SetTextColor(color3); + lcd.FillRect(0, 80, 240, 80); + lcd.SetTextColor(color2); + lcd.FillRect(0, 160, 240, 80); + lcd.SetTextColor(color1); + lcd.FillRect(0, 240, 240, 80); + + while(1) + { + + + ts.GetState(&TS_State); + if (TS_State.TouchDetected) + { + 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); + + uint16_t winner = compare((uint32_t *) &y); + //bool Yout = compare((uint32_t *) &winningSection,(uint16_t *) &y); + + //bool winner = true; + // sprintf((char*)text, "%d", Yout); + // lcd.DisplayStringAt(0, LINE(2), (uint8_t *)&text, LEFT_MODE); + + + + + sprintf((char*)text, "quadrant=%d ", winner); + lcd.DisplayStringAt(0, LINE(0), (uint8_t *)&text, LEFT_MODE); + + if(winner == 1) { + wait(1); + + color1 = swap(&color1); + + } + if(winner == 2) { + wait(1); + + color2 = alphaC(&color2); + + } + if(winner == 3) { + wait(1); + + color3 = rotate(&color3); + + } + + if(winner == 4) { + wait(1); + + color4 = optionFour(&color4); + + } + + lcd.SetTextColor(color4); + lcd.FillRect(0, 00, 240, 80); + lcd.SetTextColor(color3); + lcd.FillRect(0, 80, 240, 80); + lcd.SetTextColor(color2); + lcd.FillRect(0, 160, 240, 80); + lcd.SetTextColor(color1); + lcd.FillRect(0, 240, 240, 80); + + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Dec 07 07:20:04 2021 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/myAssembly.S Tue Dec 07 07:20:04 2021 +0000 @@ -0,0 +1,37 @@ + AREA myAssembly, CODE, READONLY + GLOBAL compare + + ; bool compare(uint32_t *) +compare + LDRH R3,[R0]; Y position + + + MOV R1, #0; 1/4 of y length of screen + + + CMP R3, R1 ; return true if screen section is withing the 1/3 of the screen selected. + + MOVGT R0, #1 + ADD R1, R1, #80 + + CMP R3, R1 ; return true if screen section is withing the 1/4 of the screen selected. + + MOVGT R0, #2 + ADD R1, R1, #80 + + CMP R3, R1 ; return true if screen section is withing the 1/4 of the screen selected. + + MOVGT R0, #3 + + + ADD R1, R1, #80 + CMP R3, R1 + MOVGT R0, #4 + + + + + BX LR + + + END \ No newline at end of file