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_F769NI mbed
main.cpp
00001 #include "mbed.h" 00002 #include "stm32f769i_discovery.h" 00003 #include "stm32f769i_discovery_ts.h" 00004 #include "stm32f769i_discovery_lcd.h" 00005 00006 TS_StateTypeDef TS_State = {0}; 00007 00008 00009 Serial pc(USBTX, USBRX); 00010 00011 DigitalOut led1(LED1); 00012 00013 void print_thread() 00014 { 00015 while (true) { 00016 Thread::wait(1000); 00017 pc.printf("Hallo Welt!!!\r\n"); 00018 } 00019 } 00020 00021 void led_thread() { 00022 while(true) { 00023 Thread::wait(200); 00024 led1 = !led1; 00025 } 00026 } 00027 00028 void gui_thread() { 00029 uint16_t x1, y1; 00030 BSP_LCD_Init(); 00031 BSP_LCD_LayerDefaultInit(0, LCD_FB_START_ADDRESS); 00032 /* Touchscreen initialization */ 00033 if (BSP_TS_Init(BSP_LCD_GetXSize(), BSP_LCD_GetYSize()) == TS_ERROR) { 00034 printf("BSP_TS_Init error\n"); 00035 } 00036 00037 /* Clear the LCD */ 00038 BSP_LCD_Clear(LCD_COLOR_WHITE); 00039 00040 /* Set Touchscreen Demo1 description */ 00041 BSP_LCD_SetTextColor(LCD_COLOR_BLUE); 00042 BSP_LCD_FillRect(0, 0, BSP_LCD_GetXSize(), 40); 00043 BSP_LCD_SetTextColor(LCD_COLOR_WHITE); 00044 BSP_LCD_SetBackColor(LCD_COLOR_BLUE); 00045 BSP_LCD_SetFont(&Font24); 00046 BSP_LCD_DisplayStringAt(0, 0, (uint8_t *)"Touchscreen basic example", CENTER_MODE); 00047 00048 while (1) { 00049 BSP_TS_GetState(&TS_State); 00050 if(TS_State.touchDetected) { 00051 /* One or dual touch have been detected */ 00052 00053 /* Get X and Y position of the first touch post calibrated */ 00054 x1 = TS_State.touchX[0]; 00055 y1 = TS_State.touchY[0]; 00056 printf("Touch Detected x=%d y=%d\n", x1, y1); 00057 00058 BSP_LCD_SetTextColor(LCD_COLOR_BLUE); 00059 BSP_LCD_FillCircle(x1, y1, 20); 00060 00061 wait_ms(10); 00062 } 00063 } 00064 } 00065 00066 int main() 00067 { 00068 pc.baud(115200*2); 00069 pc.printf("*** Joscha ***\r\n"); 00070 Thread printThread(osPriorityNormal), ledThread(osPriorityNormal), guiThread(osPriorityNormal); 00071 00072 00073 t1.start(print_thread); 00074 t2.start(led_thread); 00075 t3.start(gui_thread); 00076 00077 while(1) { 00078 } 00079 00080 00081 }
Generated on Fri Jul 15 2022 11:09:24 by
1.7.2