Just a test

Dependencies:   BSP_DISCO_F769NI LCD_DISCO_F769NI lcd_log esp8266-driver

Fork of mbed-os-example-blinky-5 by Joscha Ihl

Committer:
joschaihl
Date:
Sun Dec 17 22:55:57 2017 +0000
Revision:
9:adfdb4ba838b
Parent:
8:084f05e528ba
ba

Who changed what in which revision?

UserRevisionLine numberNew contents of line
joschaihl 8:084f05e528ba 1 #include "stm32f769i_discovery.h"
joschaihl 8:084f05e528ba 2 #include "stm32f769i_discovery_ts.h"
joschaihl 8:084f05e528ba 3 #include "stm32f769i_discovery_lcd.h"
joschaihl 8:084f05e528ba 4
joschaihl 8:084f05e528ba 5 #include "LCD_DISCO_F769NI.h"
joschaihl 8:084f05e528ba 6 #include "lcd_log.h"
joschaihl 8:084f05e528ba 7 TS_StateTypeDef TS_State = {0};
joschaihl 8:084f05e528ba 8
joschaihl 8:084f05e528ba 9 LCD_DISCO_F769NI lcd;
joschaihl 8:084f05e528ba 10
joschaihl 8:084f05e528ba 11 void gui_thread2() {
joschaihl 8:084f05e528ba 12
joschaihl 8:084f05e528ba 13 uint32_t i = 0;
joschaihl 8:084f05e528ba 14 BSP_LCD_Init();
joschaihl 8:084f05e528ba 15 BSP_LCD_LayerDefaultInit(0, LCD_FB_START_ADDRESS);
joschaihl 8:084f05e528ba 16 LCD_LOG_SetHeader((uint8_t *) "Serielle Schnittstelle");
joschaihl 8:084f05e528ba 17 //LCD_LOG_Init();
joschaihl 8:084f05e528ba 18
joschaihl 8:084f05e528ba 19 while(1) {
joschaihl 8:084f05e528ba 20 // pc.printf("%c", targ.getc());
joschaihl 8:084f05e528ba 21 }
joschaihl 8:084f05e528ba 22 }
joschaihl 8:084f05e528ba 23
joschaihl 8:084f05e528ba 24 void gui_scope() {
joschaihl 8:084f05e528ba 25 lcd.DisplayOn();
joschaihl 8:084f05e528ba 26 /* BSP_LCD_Init();
joschaihl 8:084f05e528ba 27 BSP_LCD_LayerDefaultInit(0, LCD_FB_START_ADDRESS);
joschaihl 8:084f05e528ba 28 LCD_LOG_SetHeader((uint8_t *) "Oszilloskop");*/
joschaihl 8:084f05e528ba 29
joschaihl 8:084f05e528ba 30 double pi = 3.141592;
joschaihl 8:084f05e528ba 31 double a = 0.0;
joschaihl 8:084f05e528ba 32 double inc = pi/25.0;
joschaihl 8:084f05e528ba 33 double abstand = lcd.GetYSize() / 2;
joschaihl 8:084f05e528ba 34 double prev_x = 0, prev_y = abstand, x, y;
joschaihl 8:084f05e528ba 35
joschaihl 8:084f05e528ba 36 lcd.SetBackColor((uint32_t) 0x00000000);
joschaihl 8:084f05e528ba 37 lcd.SetTextColor((uint32_t) 0xffffffff);
joschaihl 8:084f05e528ba 38 //lcd.DrawLine(0, 0, 100, 100);
joschaihl 8:084f05e528ba 39 //for(int i=0; i<1000; i=i+4)
joschaihl 8:084f05e528ba 40 int i;
joschaihl 8:084f05e528ba 41 while(1){
joschaihl 8:084f05e528ba 42 x = i;
joschaihl 8:084f05e528ba 43 y = abstand + sin(a) * 200.0;
joschaihl 8:084f05e528ba 44
joschaihl 8:084f05e528ba 45 //lcd.Clear((uint32_t) 0xffffffff);
joschaihl 8:084f05e528ba 46 //lcd.SetColorKeying(1, (uint32_t) 0xff000000);
joschaihl 8:084f05e528ba 47 lcd.DrawLine(prev_x, prev_y, x, y);
joschaihl 8:084f05e528ba 48 prev_x = x;
joschaihl 8:084f05e528ba 49 prev_y = y;
joschaihl 8:084f05e528ba 50 a = a + inc;
joschaihl 8:084f05e528ba 51 i+=8;
joschaihl 8:084f05e528ba 52 if(i>lcd.GetXSize()) {
joschaihl 8:084f05e528ba 53 i = 0;
joschaihl 8:084f05e528ba 54 lcd.Clear((uint32_t) 0x00000000);
joschaihl 8:084f05e528ba 55 wait_ms(10);
joschaihl 8:084f05e528ba 56 //lcd.SetBackColor((uint32_t) 0x00000000);
joschaihl 8:084f05e528ba 57 //lcd.SetTextColor((uint32_t) 0xffffffff);
joschaihl 8:084f05e528ba 58 }
joschaihl 8:084f05e528ba 59 }
joschaihl 8:084f05e528ba 60 //lcd.LayerDefaultInit(0, LCD_FB_START_ADDRESS);
joschaihl 8:084f05e528ba 61 //LCD_SetTextColor((uint32_t) 0xffffffff);
joschaihl 8:084f05e528ba 62 //LCD_DrawLine(120, 70, 2, 30);
joschaihl 8:084f05e528ba 63 // LCD_DrawLine(122, 68, 2, 50);
joschaihl 8:084f05e528ba 64 //LCD_DrawLine(122, 72, 2, 60);
joschaihl 8:084f05e528ba 65
joschaihl 8:084f05e528ba 66 // lcd.DrawLine(100, 100, 100, 100);
joschaihl 8:084f05e528ba 67 while(1) {
joschaihl 8:084f05e528ba 68 }
joschaihl 8:084f05e528ba 69 }
joschaihl 8:084f05e528ba 70
joschaihl 8:084f05e528ba 71 void touch_thread() {
joschaihl 8:084f05e528ba 72 uint16_t x1, y1;
joschaihl 8:084f05e528ba 73 TS_StateTypeDef state;
joschaihl 8:084f05e528ba 74 /* Touchscreen initialization */
joschaihl 8:084f05e528ba 75 if (BSP_TS_Init(BSP_LCD_GetXSize(), BSP_LCD_GetYSize()) == TS_ERROR) {
joschaihl 8:084f05e528ba 76 printf("BSP_TS_Init error\n");
joschaihl 8:084f05e528ba 77 }
joschaihl 8:084f05e528ba 78 while (1) {
joschaihl 8:084f05e528ba 79 // BSP_TS_GetState(&TS_State);
joschaihl 8:084f05e528ba 80 // if(TS_State.touchDetected) {
joschaihl 8:084f05e528ba 81 /* One or dual touch have been detected */
joschaihl 8:084f05e528ba 82
joschaihl 8:084f05e528ba 83 /* Get X and Y position of the first touch post calibrated */
joschaihl 8:084f05e528ba 84 // x1 = TS_State.touchX[0];
joschaihl 8:084f05e528ba 85 // y1 = TS_State.touchY[0];
joschaihl 8:084f05e528ba 86 // printf("Touch Detected x=%d y=%d\n", x1, y1);
joschaihl 8:084f05e528ba 87
joschaihl 8:084f05e528ba 88 //BSP_LCD_SetTextColor(LCD_COLOR_BLUE);
joschaihl 8:084f05e528ba 89 //BSP_LCD_FillCircle(x1, y1, 20);
joschaihl 8:084f05e528ba 90
joschaihl 8:084f05e528ba 91 wait_ms(10);
joschaihl 8:084f05e528ba 92 //}
joschaihl 8:084f05e528ba 93 }
joschaihl 8:084f05e528ba 94
joschaihl 8:084f05e528ba 95 }
joschaihl 8:084f05e528ba 96
joschaihl 8:084f05e528ba 97
joschaihl 8:084f05e528ba 98