Just a test

Dependencies:   BSP_DISCO_F769NI LCD_DISCO_F769NI lcd_log esp8266-driver

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

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "ESP8266.h"
00003 #include <stdio.h>
00004 #include <time.h>
00005 #include <math.h>
00006 #include <iostream>
00007 #include "scope.h"
00008 using namespace std;
00009 
00010 Serial pc(USBTX, USBRX);
00011 
00012 Serial targ(D1, D0);
00013 #define WIFI_RX PC_12
00014 #define WIFI_TX PD_2
00015 
00016 //Serial wifi(WIFI_TX, WIFI_RX);
00017 
00018 DigitalOut led1(LED1);
00019 
00020 DigitalOut led_green(LED2);
00021 
00022 void print_thread()
00023 {
00024     while (true) {
00025         Thread::wait(1000);
00026         printf("Hallo Welt!!!\n");
00027     }
00028 }
00029 
00030 void led_thread() {
00031     led_green = !led_green;
00032     while(true) {
00033         Thread::wait(200);
00034         led1 = !led1;
00035         led_green = !led_green;
00036     }
00037 }
00038 
00039 extern void LCD_LOG_SetHeader(uint8_t *Title);
00040 
00041 void clock_thread() {
00042     char timestr[64] = "";
00043     while(1) {
00044         time_t seconds;
00045         time(&seconds);
00046         sprintf(timestr, "Time = %s", ctime(&seconds));
00047         LCD_LOG_SetHeader((uint8_t *) timestr);
00048         Thread::wait(1000);
00049     }
00050 
00051 }
00052 
00053 void esp_thread() {
00054 
00055     while(1) {
00056        // pc.putc(wifi.getc());
00057     }
00058 }
00059 int main(void) {
00060     pc.baud(115200);
00061     targ.baud(115200);
00062     //wifi.baud(115200);
00063     cout << "Hallo Joscha!!!" << endl;
00064     Thread printThread(osPriorityNormal), ledThread(osPriorityNormal),
00065         guiThread(osPriorityNormal), touchThread(osPriorityNormal), clockThread(osPriorityNormal), espThread(osPriorityNormal);
00066 
00067   //  printThread.start(print_thread);
00068     ledThread.start(led_thread);
00069     guiThread.start(gui_thread2);
00070    // guiThread.start(gui_scope);
00071   //   touchThread.start(touch_thread);
00072      clockThread.start(clock_thread);
00073   //   espThread.start(esp_thread);
00074   //  Thread tsrv;
00075   //  tsrv.start(srvLoop);
00076 
00077 
00078     while(1) {
00079 
00080     }
00081 }