
Just a test
Dependencies: BSP_DISCO_F769NI LCD_DISCO_F769NI lcd_log esp8266-driver
Fork of mbed-os-example-blinky-5 by
Revision 6:37ebd143b246, committed 2017-09-14
- Comitter:
- joschaihl
- Date:
- Thu Sep 14 07:46:05 2017 +0000
- Parent:
- 5:250c357b6bf5
- Child:
- 7:8c5ef9c24734
- Commit message:
- test
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Mon May 29 03:18:13 2017 +0000 +++ b/main.cpp Thu Sep 14 07:46:05 2017 +0000 @@ -12,9 +12,10 @@ #include "LCD_DISCO_F769NI.h" #include "lcd_log.h" - +#include <stdio.h> +#include <time.h> +#include <math.h> #include <iostream> -#include <cmath> using namespace std; #define HTTP_STATUS_LINE "HTTP/1.0 200 OK" @@ -36,6 +37,8 @@ TS_StateTypeDef TS_State = {0}; Serial pc(USBTX, USBRX); + +Serial targ(D1, D0); #define WIFI_RX PC_12 #define WIFI_TX PD_2 @@ -54,9 +57,11 @@ } void led_thread() { + led_green = !led_green; while(true) { Thread::wait(200); led1 = !led1; + led_green = !led_green; } } @@ -65,32 +70,26 @@ void clock_thread() { char timestr[64] = ""; while(1) { - time_t seconds = time(NULL); - sprintf(timestr, "Time = %s\0", ctime(&seconds)); + time_t seconds; + time(&seconds); + sprintf(timestr, "Time = %s", ctime(&seconds)); LCD_LOG_SetHeader((uint8_t *) timestr); Thread::wait(1000); } - + } void gui_thread2() { - - - uint32_t i = 0; - + + 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) { - led1 = 0; - led_green = 1; - printf("Test %d\n",i++ ); + pc.printf("%c", targ.getc()); - - led1 = 1; - led_green = 0; } } @@ -99,22 +98,22 @@ /* BSP_LCD_Init(); BSP_LCD_LayerDefaultInit(0, LCD_FB_START_ADDRESS); LCD_LOG_SetHeader((uint8_t *) "Oszilloskop");*/ - - double M_PI = 3.14159265358979323846; + + double pi = 3.141592; double a = 0.0; - double inc = M_PI/25.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) + //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); @@ -170,25 +169,25 @@ void srvLoop() { printf("Basic HTTP server example\n"); - + EthernetInterface eth; eth.connect(); - + printf("The target IP address is '%s'\n", eth.get_ip_address()); - + TCPServer srv; TCPSocket clt_sock; SocketAddress clt_addr; - + /* Open the server on ethernet stack */ srv.open(ð); - + /* Bind the HTTP port (TCP 80) to the server */ srv.bind(eth.get_ip_address(), 80); - + /* Can handle 5 simultaneous connections */ srv.listen(5); - + while (true) { srv.accept(&clt_sock, &clt_addr); printf("accept %s:%d\n", clt_addr.get_ip_address(), clt_addr.get_port()); @@ -197,30 +196,32 @@ } void esp_thread() { - + while(1) { // pc.putc(wifi.getc()); } } int main(void) { - pc.baud(115200*2); + pc.baud(115200); + targ.baud(115200); //wifi.baud(115200); cout << "Hallo Joscha!!!" << endl; - Thread printThread(osPriorityNormal), ledThread(osPriorityNormal), + Thread printThread(osPriorityNormal), ledThread(osPriorityNormal), guiThread(osPriorityNormal), touchThread(osPriorityNormal), clockThread(osPriorityNormal), espThread(osPriorityNormal); - + // printThread.start(print_thread); - // ledThread.start(led_thread); - guiThread.start(gui_scope); + ledThread.start(led_thread); + guiThread.start(gui_thread2); + // guiThread.start(gui_scope); // touchThread.start(touch_thread); - // clockThread.start(clock_thread); + clockThread.start(clock_thread); // espThread.start(esp_thread); // Thread tsrv; // tsrv.start(srvLoop); while(1) { - + } -} +} \ No newline at end of file