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: BSP_DISCO_F429ZI LCD_DISCO_F429ZI TS_DISCO_F429ZI mbed
main.cpp
00001 #include "mbed.h" 00002 #include "TS_DISCO_F429ZI.h" 00003 #include "LCD_DISCO_F429ZI.h" 00004 00005 LCD_DISCO_F429ZI lcd; 00006 TS_DISCO_F429ZI ts; 00007 00008 int main() 00009 { 00010 TS_StateTypeDef TS_State; 00011 uint16_t x, y; 00012 uint8_t text[30]; 00013 uint8_t status; 00014 00015 BSP_LCD_SetFont(&Font20); 00016 00017 lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"TOUCHSCREEN", CENTER_MODE); 00018 lcd.DisplayStringAt(0, LINE(6), (uint8_t *)"DEMO", CENTER_MODE); 00019 wait(1); 00020 00021 status = ts.Init(lcd.GetXSize(), lcd.GetYSize()); 00022 00023 if (status != TS_OK) 00024 { 00025 lcd.Clear(LCD_COLOR_RED); 00026 lcd.SetBackColor(LCD_COLOR_RED); 00027 lcd.SetTextColor(LCD_COLOR_WHITE); 00028 lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"TOUCHSCREEN", CENTER_MODE); 00029 lcd.DisplayStringAt(0, LINE(6), (uint8_t *)"INIT FAIL", CENTER_MODE); 00030 } 00031 else 00032 { 00033 lcd.Clear(LCD_COLOR_GREEN); 00034 lcd.SetBackColor(LCD_COLOR_GREEN); 00035 lcd.SetTextColor(LCD_COLOR_WHITE); 00036 lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"TOUCHSCREEN", CENTER_MODE); 00037 lcd.DisplayStringAt(0, LINE(6), (uint8_t *)"INIT OK", CENTER_MODE); 00038 } 00039 00040 wait(1); 00041 lcd.Clear(LCD_COLOR_BLUE); 00042 lcd.SetBackColor(LCD_COLOR_BLUE); 00043 lcd.SetTextColor(LCD_COLOR_WHITE); 00044 00045 while(1) 00046 { 00047 00048 ts.GetState(&TS_State); 00049 if (TS_State.TouchDetected) 00050 { 00051 x = TS_State.X; 00052 y = TS_State.Y; 00053 sprintf((char*)text, "x=%d y=%d ", x, y); 00054 lcd.DisplayStringAt(0, LINE(0), (uint8_t *)&text, LEFT_MODE); 00055 } 00056 } 00057 }
Generated on Wed Jul 13 2022 07:22:33 by
1.7.2