Library for my home monitoring classes and serial communication protocol. It monitors temperature and movement on the mbed application board.
Diff: Communication/Communication.cpp
- Revision:
- 2:84432add9142
- Parent:
- 1:2f5a62eb52ad
diff -r 2f5a62eb52ad -r 84432add9142 Communication/Communication.cpp --- a/Communication/Communication.cpp Tue Sep 03 08:54:55 2013 +0000 +++ b/Communication/Communication.cpp Tue Sep 03 20:24:12 2013 +0000 @@ -11,14 +11,17 @@ extern USBSerial serial; +/* ! \fn Gets character from host */ int mon_get() { return serial._getc(); } +/// Sends character to the host int mon_send(char c) { return serial._putc(c); } +/// Waits for the host to ack bool host_wait() { char resp; // FIXME - check buffer size before waiting so @@ -31,6 +34,7 @@ } } +/// Listens for connection message from host bool check_connection() { if (serial.available()) { if (mon_get() == 'c') { @@ -43,7 +47,7 @@ } } - +/// Sends actual alert to the host bool send_alert(alert_type alert) { int response; mon_send('a'); // Send alert