Add two threads into the IOT WIFIDemo for test_JacobShi
Dependencies: C12832 HTTPClient wifiontros wifirtos mbed
Fork of frdm_rtos by
Diff: sysinterface.cpp
- Revision:
- 4:242715d40e54
- Parent:
- 3:5f921ff0868d
diff -r 5f921ff0868d -r 242715d40e54 sysinterface.cpp --- a/sysinterface.cpp Fri Nov 28 12:52:56 2014 +0000 +++ b/sysinterface.cpp Fri Dec 05 02:14:44 2014 +0000 @@ -1,29 +1,46 @@ +#include "sysinterface.h" -#include "sysinterface.h" -//GLOBAL_DATA globaldata; +PUBLICDATA globaldata; + +DigitalOut threadled(LED1); void send_task(void const *args) { - while(1) - { -// if(globaldata.send_ready==1) -// { -// globaldata.send_ready=0; -// int idx=baselevel_send_data(globaldata.send_buffer,globaldata.send_length); -// globaldata.send_length_over=idx; -// globaldata.send_completed=1; -// } - int a=0; - Thread::wait(40); + { + if(globaldata.send_ready==1) + { + globaldata.send_ready=0; + short idx=baselevel_send_data(globaldata.send_buffer,globaldata.send_length); + globaldata.send_length_over=idx; + globaldata.send_completed=1; + } + + + threadled=!threadled; + Thread::wait(20); } } + void recv_task(void const *args) { + + int lengthtemp; while(1) { - int b=0; - Thread::wait(40); + //recv_app(); + if(globaldata.receive_start==1) + { + globaldata.receive_length=baselevel_receive_data(globaldata.receive_buffer,globaldata.need_receive); + if(globaldata.receive_length>0) + { + globaldata.receive_start=0; + globaldata.receive_completed=1; + } } -} \ No newline at end of file + + Thread::wait(20); + } + +}