a
Dependencies: BSP_DISCO_F429ZI LCD_DISCO_F429ZI TS_DISCO_F429ZI mbed
main.cpp@0:ae4537d183ba, 2016-04-23 (annotated)
- Committer:
- Dom952
- Date:
- Sat Apr 23 17:41:29 2016 +0000
- Revision:
- 0:ae4537d183ba
a
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Dom952 | 0:ae4537d183ba | 1 | #include "mbed.h" |
Dom952 | 0:ae4537d183ba | 2 | #include "LCD_DISCO_F429ZI.h" |
Dom952 | 0:ae4537d183ba | 3 | #include "TS_DISCO_F429ZI.h" |
Dom952 | 0:ae4537d183ba | 4 | |
Dom952 | 0:ae4537d183ba | 5 | LCD_DISCO_F429ZI lcd; |
Dom952 | 0:ae4537d183ba | 6 | TS_DISCO_F429ZI ts; |
Dom952 | 0:ae4537d183ba | 7 | |
Dom952 | 0:ae4537d183ba | 8 | int main() |
Dom952 | 0:ae4537d183ba | 9 | { |
Dom952 | 0:ae4537d183ba | 10 | BSP_LCD_SetFont(&Font24); |
Dom952 | 0:ae4537d183ba | 11 | TS_StateTypeDef TS_State; |
Dom952 | 0:ae4537d183ba | 12 | uint16_t x, y; |
Dom952 | 0:ae4537d183ba | 13 | lcd.Clear(LCD_COLOR_BLACK); |
Dom952 | 0:ae4537d183ba | 14 | |
Dom952 | 0:ae4537d183ba | 15 | while(1) |
Dom952 | 0:ae4537d183ba | 16 | { |
Dom952 | 0:ae4537d183ba | 17 | ts.GetState(&TS_State); |
Dom952 | 0:ae4537d183ba | 18 | x = TS_State.X; |
Dom952 | 0:ae4537d183ba | 19 | y = TS_State.Y; |
Dom952 | 0:ae4537d183ba | 20 | for ( int i = 0; i < 4; i++ ) |
Dom952 | 0:ae4537d183ba | 21 | { |
Dom952 | 0:ae4537d183ba | 22 | lcd.SetTextColor(LCD_COLOR_GREEN); |
Dom952 | 0:ae4537d183ba | 23 | lcd.DrawRect(0,80*i,80,80); |
Dom952 | 0:ae4537d183ba | 24 | if ( (TS_State.TouchDetected) && ( x > 0 ) && ( x <= 80 ) && ( y >= 80*i ) && ( y < 80*( i+1 ) ) ) |
Dom952 | 0:ae4537d183ba | 25 | lcd.SetTextColor(LCD_COLOR_YELLOW); |
Dom952 | 0:ae4537d183ba | 26 | else lcd.SetTextColor(LCD_COLOR_BLUE); |
Dom952 | 0:ae4537d183ba | 27 | lcd.FillRect(1,(80*i+1),78,78); |
Dom952 | 0:ae4537d183ba | 28 | } |
Dom952 | 0:ae4537d183ba | 29 | lcd.SetBackColor(LCD_COLOR_RED); |
Dom952 | 0:ae4537d183ba | 30 | lcd.SetTextColor(LCD_COLOR_WHITE); |
Dom952 | 0:ae4537d183ba | 31 | lcd.DisplayStringAt(0,0, (uint8_t *) "0", LEFT_MODE); |
Dom952 | 0:ae4537d183ba | 32 | lcd.DisplayStringAt(0,80, (uint8_t *) "1", LEFT_MODE); |
Dom952 | 0:ae4537d183ba | 33 | lcd.DisplayStringAt(0,160, (uint8_t *) "2", LEFT_MODE); |
Dom952 | 0:ae4537d183ba | 34 | lcd.DisplayStringAt(0,240, (uint8_t *) "3", LEFT_MODE); |
Dom952 | 0:ae4537d183ba | 35 | wait(0.1); |
Dom952 | 0:ae4537d183ba | 36 | } |
Dom952 | 0:ae4537d183ba | 37 | } |