![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
.
Dependencies: BME280 BMP280 TextLCD mbed
Fork of CW_watchdog_09012018_copy by
Diff: main.cpp
- Revision:
- 6:f95438838ece
- Parent:
- 5:8aa72ee456fc
--- a/main.cpp Tue Jan 09 15:45:56 2018 +0000 +++ b/main.cpp Wed Jan 10 01:27:01 2018 +0000 @@ -1,19 +1,28 @@ #include "mbed.h" #include "TextLCD.h" #include "BME280.h" -#include "sd.h" +#include "net.h" #define watchdog_time 15 //DigitalOut myled(LED1); -int dislcd = 0, wdcounter = 0, watchdog = 0; +int dislcd = 1, wdcounter = 0, watchdog = 0, netflag = 1; float T = 15; char ch = 0; Ticker display; Ticker second_pass; InterruptIn button(USER_BUTTON); +//InterruptIn button2(PE_12); +//osThreadId mainThreadID; //NVIC_SetPriority(display, 0); //NVIC_SetPriority(second_pass, 1); //NVIC_SetPriority(button, 1); +//void network_main() +//{ +// while(1) +// { +// network(); +// } +//} void second_tick() @@ -47,7 +56,7 @@ NVIC_SystemReset(); } } -void watchdog() +void watchdog_start() { wdcounter = 0; watchdog = 1; @@ -78,30 +87,25 @@ else {dislcd = 0;} } - - -int main() +void network_bit() { - lcd.cls(); - - //display_date_time(); -// while (pointer != 14) -// { -// select_date(); -// } - //bmp.initialize(); - pc.printf("\n\rputty ready\n\r"); - display.attach(&lcddisp, T); - second_pass.attach(&second_tick, 1.0); - button.rise(&check_display); + network(); + //osSignalSet(mainThreadID, 0x1); +} +void putty_main() +{ while(1) - { - check_display(); + { if (putty_enabled == 1) { - //watchdog(); + //watchdog_start(); + + pc.printf("\n\rputty ready\n\r"); + //stdio_mutex.lock(); putty_write(); - watchdog = 0; + //stdio_mutex.unlock(); + + //watchdog = 0; } if (putty_enabled == 0) @@ -122,6 +126,67 @@ display.attach(&lcddisp, T); interrupt = 0; } + } + +} + +int main() +{ + //network_bit(); + lcd.cls(); + //getdata(); + //display_date_time(); +// while (pointer != 14) +// { +// select_date(); +// } + //bmp.initialize(); + + //t1.start(network_main); + //Thread t2(osPriorityBelowNormal); + //Thread t1(osPriorityAboveNormal); + display.attach(&lcddisp, T); + second_pass.attach(&second_tick, 1.0); + //net_tick.attach(&network, 15); + button.rise(&check_display); + network(); + + while(1) + { + Thread t2; + Thread t1; + t1.start(network_bit); + Thread::wait(2000); + t1.terminate(); + t2.start(putty_main); + Thread::wait(13000); + t2.terminate(); + //check_display(); +// if (putty_enabled == 1) +// { +// //watchdog_start(); +// putty_write(); +// //watchdog = 0; +// } +// +// if (putty_enabled == 0) +// { +// while(ch != 'p') +// { +// ch = 0; +// yellowLED = 1; +// ch = pc.getc(); +// } +// putty_enabled = 1; +// } +// yellowLED = 0; +// check_display(); +// if (interrupt == 1) +// { +// T = t; +// display.attach(&lcddisp, T); +// interrupt = 0; +// } //if(sw1 == 1 && sw2 == 1) // { // sd();