Supachai Vorapojpisut
/
le484_2016
Course project for LE484 at Thammasat University, class of 2016
Diff: main.cpp.orig
- Revision:
- 12:845639da2f03
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp.orig Mon May 08 05:11:22 2017 +0000 @@ -0,0 +1,33 @@ +/** +* @brief Main loop: XBee protocol handler +* @author Supachai Vorapojpisut,Vissarut Prakobpon , Natanich Bunsila +* @date May 8, 2017 +*/ + +#include "mbed.h" +#include "platform.h" + + +RawSerial pc(USBTX, USBRX); // use USB-serial for testing purpose +Mail<char, 2> mbx; // use Mail API to forward data +Thread ledThred; + + +/** +* @brief ISR code: reception of XBee API frame +*/ +void rxHandler() { + char *mail = mbx.alloc(); + *mail = pc.getc(); + mbx.put(mail); +} + + +/** +* @brief Main code: initial serial RX handler, then wait for detected frame +*/ +int main() { + ledThread.start(led1_thread); + while(1); +} +