Just a test
Dependencies: BSP_DISCO_F769NI LCD_DISCO_F769NI lcd_log esp8266-driver
Fork of mbed-os-example-blinky-5 by
scope.h
00001 #include "stm32f769i_discovery.h" 00002 #include "stm32f769i_discovery_ts.h" 00003 #include "stm32f769i_discovery_lcd.h" 00004 00005 #include "LCD_DISCO_F769NI.h" 00006 #include "lcd_log.h" 00007 TS_StateTypeDef TS_State = {0}; 00008 00009 LCD_DISCO_F769NI lcd; 00010 00011 void gui_thread2() { 00012 00013 uint32_t i = 0; 00014 BSP_LCD_Init(); 00015 BSP_LCD_LayerDefaultInit(0, LCD_FB_START_ADDRESS); 00016 LCD_LOG_SetHeader((uint8_t *) "Serielle Schnittstelle"); 00017 //LCD_LOG_Init(); 00018 00019 while(1) { 00020 // pc.printf("%c", targ.getc()); 00021 } 00022 } 00023 00024 void gui_scope() { 00025 lcd.DisplayOn(); 00026 /* BSP_LCD_Init(); 00027 BSP_LCD_LayerDefaultInit(0, LCD_FB_START_ADDRESS); 00028 LCD_LOG_SetHeader((uint8_t *) "Oszilloskop");*/ 00029 00030 double pi = 3.141592; 00031 double a = 0.0; 00032 double inc = pi/25.0; 00033 double abstand = lcd.GetYSize() / 2; 00034 double prev_x = 0, prev_y = abstand, x, y; 00035 00036 lcd.SetBackColor((uint32_t) 0x00000000); 00037 lcd.SetTextColor((uint32_t) 0xffffffff); 00038 //lcd.DrawLine(0, 0, 100, 100); 00039 //for(int i=0; i<1000; i=i+4) 00040 int i; 00041 while(1){ 00042 x = i; 00043 y = abstand + sin(a) * 200.0; 00044 00045 //lcd.Clear((uint32_t) 0xffffffff); 00046 //lcd.SetColorKeying(1, (uint32_t) 0xff000000); 00047 lcd.DrawLine(prev_x, prev_y, x, y); 00048 prev_x = x; 00049 prev_y = y; 00050 a = a + inc; 00051 i+=8; 00052 if(i>lcd.GetXSize()) { 00053 i = 0; 00054 lcd.Clear((uint32_t) 0x00000000); 00055 wait_ms(10); 00056 //lcd.SetBackColor((uint32_t) 0x00000000); 00057 //lcd.SetTextColor((uint32_t) 0xffffffff); 00058 } 00059 } 00060 //lcd.LayerDefaultInit(0, LCD_FB_START_ADDRESS); 00061 //LCD_SetTextColor((uint32_t) 0xffffffff); 00062 //LCD_DrawLine(120, 70, 2, 30); 00063 // LCD_DrawLine(122, 68, 2, 50); 00064 //LCD_DrawLine(122, 72, 2, 60); 00065 00066 // lcd.DrawLine(100, 100, 100, 100); 00067 while(1) { 00068 } 00069 } 00070 00071 void touch_thread() { 00072 uint16_t x1, y1; 00073 TS_StateTypeDef state; 00074 /* Touchscreen initialization */ 00075 if (BSP_TS_Init(BSP_LCD_GetXSize(), BSP_LCD_GetYSize()) == TS_ERROR) { 00076 printf("BSP_TS_Init error\n"); 00077 } 00078 while (1) { 00079 // BSP_TS_GetState(&TS_State); 00080 // if(TS_State.touchDetected) { 00081 /* One or dual touch have been detected */ 00082 00083 /* Get X and Y position of the first touch post calibrated */ 00084 // x1 = TS_State.touchX[0]; 00085 // y1 = TS_State.touchY[0]; 00086 // printf("Touch Detected x=%d y=%d\n", x1, y1); 00087 00088 //BSP_LCD_SetTextColor(LCD_COLOR_BLUE); 00089 //BSP_LCD_FillCircle(x1, y1, 20); 00090 00091 wait_ms(10); 00092 //} 00093 } 00094 00095 } 00096 00097 00098
Generated on Fri Jul 22 2022 06:22:47 by 1.7.2