Just a test
Dependencies: BSP_DISCO_F769NI LCD_DISCO_F769NI lcd_log esp8266-driver
Fork of mbed-os-example-blinky-5 by
Diff: scope.h
- Revision:
- 8:084f05e528ba
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scope.h Wed Nov 15 20:45:07 2017 +0000 @@ -0,0 +1,98 @@ +#include "stm32f769i_discovery.h" +#include "stm32f769i_discovery_ts.h" +#include "stm32f769i_discovery_lcd.h" + +#include "LCD_DISCO_F769NI.h" +#include "lcd_log.h" +TS_StateTypeDef TS_State = {0}; + +LCD_DISCO_F769NI lcd; + +void gui_thread2() { + + uint32_t i = 0; + BSP_LCD_Init(); + BSP_LCD_LayerDefaultInit(0, LCD_FB_START_ADDRESS); + LCD_LOG_SetHeader((uint8_t *) "Serielle Schnittstelle"); + //LCD_LOG_Init(); + + while(1) { + // pc.printf("%c", targ.getc()); + } +} + +void gui_scope() { + lcd.DisplayOn(); + /* BSP_LCD_Init(); + BSP_LCD_LayerDefaultInit(0, LCD_FB_START_ADDRESS); + LCD_LOG_SetHeader((uint8_t *) "Oszilloskop");*/ + + double pi = 3.141592; + double a = 0.0; + double inc = pi/25.0; + double abstand = lcd.GetYSize() / 2; + double prev_x = 0, prev_y = abstand, x, y; + + lcd.SetBackColor((uint32_t) 0x00000000); + lcd.SetTextColor((uint32_t) 0xffffffff); + //lcd.DrawLine(0, 0, 100, 100); + //for(int i=0; i<1000; i=i+4) + int i; + while(1){ + x = i; + y = abstand + sin(a) * 200.0; + + //lcd.Clear((uint32_t) 0xffffffff); + //lcd.SetColorKeying(1, (uint32_t) 0xff000000); + lcd.DrawLine(prev_x, prev_y, x, y); + prev_x = x; + prev_y = y; + a = a + inc; + i+=8; + if(i>lcd.GetXSize()) { + i = 0; + lcd.Clear((uint32_t) 0x00000000); + wait_ms(10); + //lcd.SetBackColor((uint32_t) 0x00000000); + //lcd.SetTextColor((uint32_t) 0xffffffff); + } + } + //lcd.LayerDefaultInit(0, LCD_FB_START_ADDRESS); + //LCD_SetTextColor((uint32_t) 0xffffffff); + //LCD_DrawLine(120, 70, 2, 30); + // LCD_DrawLine(122, 68, 2, 50); + //LCD_DrawLine(122, 72, 2, 60); + + // lcd.DrawLine(100, 100, 100, 100); + while(1) { + } +} + +void touch_thread() { + uint16_t x1, y1; + TS_StateTypeDef state; + /* Touchscreen initialization */ + if (BSP_TS_Init(BSP_LCD_GetXSize(), BSP_LCD_GetYSize()) == TS_ERROR) { + printf("BSP_TS_Init error\n"); + } + while (1) { + // BSP_TS_GetState(&TS_State); + // if(TS_State.touchDetected) { + /* One or dual touch have been detected */ + + /* Get X and Y position of the first touch post calibrated */ + // x1 = TS_State.touchX[0]; + // y1 = TS_State.touchY[0]; + // printf("Touch Detected x=%d y=%d\n", x1, y1); + + //BSP_LCD_SetTextColor(LCD_COLOR_BLUE); + //BSP_LCD_FillCircle(x1, y1, 20); + + wait_ms(10); + //} + } + +} + + +