Add to 11U68 11E68
Dependencies: DirectoryList MODSERIAL mbed
Fork of ika_shouyu_poppoyaki by
Revision 9:ca4c9a2ac8e1, committed 2013-08-25
- Comitter:
- okano
- Date:
- Sun Aug 25 06:33:14 2013 +0000
- Parent:
- 8:b220fadbb3d8
- Child:
- 10:90bd46dadeb4
- Commit message:
- target response timeout added. program will treat no response for 1 second as command-fail
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Sun Aug 25 06:22:33 2013 +0000 +++ b/main.cpp Sun Aug 25 06:33:14 2013 +0000 @@ -400,10 +400,23 @@ } +Timeout timeout; + +int timeout_flag = 0; + +void set_flag() +{ + timeout_flag = 1; +} + + void get_string( char *s ) { int i = 0; char c = 0; + timeout_flag = 0; + + timeout.attach( &set_flag, 1 ); do { do { @@ -416,8 +429,13 @@ *s++ = c; i++; } + + if ( timeout_flag ) + return; } while ( 1 ); } while ( !i ); *s = '\0'; } + +