Just a test

Dependencies:   BSP_DISCO_F769NI LCD_DISCO_F769NI lcd_log esp8266-driver

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

main.cpp

Committer:
joschaihl
Date:
2017-12-17
Revision:
9:adfdb4ba838b
Parent:
8:084f05e528ba

File content as of revision 9:adfdb4ba838b:

#include "mbed.h"
#include "ESP8266.h"
#include <stdio.h>
#include <time.h>
#include <math.h>
#include <iostream>
#include "scope.h"
using namespace std;

Serial pc(USBTX, USBRX);

Serial targ(D1, D0);
#define WIFI_RX PC_12
#define WIFI_TX PD_2

//Serial wifi(WIFI_TX, WIFI_RX);

DigitalOut led1(LED1);

DigitalOut led_green(LED2);

void print_thread()
{
    while (true) {
        Thread::wait(1000);
        printf("Hallo Welt!!!\n");
    }
}

void led_thread() {
    led_green = !led_green;
    while(true) {
        Thread::wait(200);
        led1 = !led1;
        led_green = !led_green;
    }
}

extern void LCD_LOG_SetHeader(uint8_t *Title);

void clock_thread() {
    char timestr[64] = "";
    while(1) {
        time_t seconds;
        time(&seconds);
        sprintf(timestr, "Time = %s", ctime(&seconds));
        LCD_LOG_SetHeader((uint8_t *) timestr);
        Thread::wait(1000);
    }

}

void esp_thread() {

    while(1) {
       // pc.putc(wifi.getc());
    }
}
int main(void) {
    pc.baud(115200);
    targ.baud(115200);
    //wifi.baud(115200);
    cout << "Hallo Joscha!!!" << endl;
    Thread printThread(osPriorityNormal), ledThread(osPriorityNormal),
        guiThread(osPriorityNormal), touchThread(osPriorityNormal), clockThread(osPriorityNormal), espThread(osPriorityNormal);

  //  printThread.start(print_thread);
    ledThread.start(led_thread);
    guiThread.start(gui_thread2);
   // guiThread.start(gui_scope);
  //   touchThread.start(touch_thread);
     clockThread.start(clock_thread);
  //   espThread.start(esp_thread);
  //  Thread tsrv;
  //  tsrv.start(srvLoop);


    while(1) {

    }
}