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 0:2e946c38e476 1 #include "mbed.h"
joschaihl 7:8c5ef9c24734 2 #include "ESP8266.h"
joschaihl 6:37ebd143b246 3 #include <stdio.h>
joschaihl 6:37ebd143b246 4 #include <time.h>
joschaihl 6:37ebd143b246 5 #include <math.h>
joschaihl 3:7c7587c666e1 6 #include <iostream>
joschaihl 8:084f05e528ba 7 #include "scope.h"
joschaihl 2:6a613cb4b302 8 using namespace std;
joschaihl 4:7876f757c6e8 9
joschaihl 0:2e946c38e476 10 Serial pc(USBTX, USBRX);
joschaihl 6:37ebd143b246 11
joschaihl 6:37ebd143b246 12 Serial targ(D1, D0);
joschaihl 3:7c7587c666e1 13 #define WIFI_RX PC_12
joschaihl 3:7c7587c666e1 14 #define WIFI_TX PD_2
joschaihl 3:7c7587c666e1 15
joschaihl 3:7c7587c666e1 16 //Serial wifi(WIFI_TX, WIFI_RX);
joschaihl 0:2e946c38e476 17
joschaihl 0:2e946c38e476 18 DigitalOut led1(LED1);
joschaihl 8:084f05e528ba 19
joschaihl 3:7c7587c666e1 20 DigitalOut led_green(LED2);
joschaihl 0:2e946c38e476 21
joschaihl 0:2e946c38e476 22 void print_thread()
joschaihl 0:2e946c38e476 23 {
joschaihl 0:2e946c38e476 24 while (true) {
joschaihl 3:7c7587c666e1 25 Thread::wait(1000);
joschaihl 3:7c7587c666e1 26 printf("Hallo Welt!!!\n");
joschaihl 0:2e946c38e476 27 }
joschaihl 0:2e946c38e476 28 }
joschaihl 0:2e946c38e476 29
joschaihl 0:2e946c38e476 30 void led_thread() {
joschaihl 6:37ebd143b246 31 led_green = !led_green;
joschaihl 0:2e946c38e476 32 while(true) {
joschaihl 0:2e946c38e476 33 Thread::wait(200);
joschaihl 0:2e946c38e476 34 led1 = !led1;
joschaihl 6:37ebd143b246 35 led_green = !led_green;
joschaihl 0:2e946c38e476 36 }
joschaihl 0:2e946c38e476 37 }
joschaihl 0:2e946c38e476 38
joschaihl 3:7c7587c666e1 39 extern void LCD_LOG_SetHeader(uint8_t *Title);
joschaihl 3:7c7587c666e1 40
joschaihl 3:7c7587c666e1 41 void clock_thread() {
joschaihl 3:7c7587c666e1 42 char timestr[64] = "";
joschaihl 3:7c7587c666e1 43 while(1) {
joschaihl 6:37ebd143b246 44 time_t seconds;
joschaihl 6:37ebd143b246 45 time(&seconds);
joschaihl 6:37ebd143b246 46 sprintf(timestr, "Time = %s", ctime(&seconds));
joschaihl 3:7c7587c666e1 47 LCD_LOG_SetHeader((uint8_t *) timestr);
joschaihl 3:7c7587c666e1 48 Thread::wait(1000);
joschaihl 3:7c7587c666e1 49 }
joschaihl 6:37ebd143b246 50
joschaihl 3:7c7587c666e1 51 }
joschaihl 3:7c7587c666e1 52
joschaihl 3:7c7587c666e1 53 void esp_thread() {
joschaihl 6:37ebd143b246 54
joschaihl 3:7c7587c666e1 55 while(1) {
joschaihl 3:7c7587c666e1 56 // pc.putc(wifi.getc());
joschaihl 3:7c7587c666e1 57 }
joschaihl 3:7c7587c666e1 58 }
joschaihl 3:7c7587c666e1 59 int main(void) {
joschaihl 6:37ebd143b246 60 pc.baud(115200);
joschaihl 6:37ebd143b246 61 targ.baud(115200);
joschaihl 3:7c7587c666e1 62 //wifi.baud(115200);
joschaihl 3:7c7587c666e1 63 cout << "Hallo Joscha!!!" << endl;
joschaihl 6:37ebd143b246 64 Thread printThread(osPriorityNormal), ledThread(osPriorityNormal),
joschaihl 3:7c7587c666e1 65 guiThread(osPriorityNormal), touchThread(osPriorityNormal), clockThread(osPriorityNormal), espThread(osPriorityNormal);
joschaihl 6:37ebd143b246 66
joschaihl 4:7876f757c6e8 67 // printThread.start(print_thread);
joschaihl 6:37ebd143b246 68 ledThread.start(led_thread);
joschaihl 6:37ebd143b246 69 guiThread.start(gui_thread2);
joschaihl 6:37ebd143b246 70 // guiThread.start(gui_scope);
joschaihl 4:7876f757c6e8 71 // touchThread.start(touch_thread);
joschaihl 6:37ebd143b246 72 clockThread.start(clock_thread);
joschaihl 3:7c7587c666e1 73 // espThread.start(esp_thread);
joschaihl 3:7c7587c666e1 74 // Thread tsrv;
joschaihl 3:7c7587c666e1 75 // tsrv.start(srvLoop);
joschaihl 2:6a613cb4b302 76
joschaihl 2:6a613cb4b302 77
joschaihl 2:6a613cb4b302 78 while(1) {
joschaihl 6:37ebd143b246 79
joschaihl 2:6a613cb4b302 80 }
joschaihl 6:37ebd143b246 81 }