Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
reader.cpp
00001 #include "main.h" 00002 00003 extern Serial pc; 00004 extern Queue<string, 16> ReaderQueue; 00005 00006 void Reader_thread(void const *args) 00007 { 00008 string message= ""; 00009 char c; 00010 unsigned int count = 0; 00011 00012 while(1) 00013 { 00014 if(pc.readable() == 1) 00015 { 00016 c = pc.getc(); 00017 if (c == 0xD) 00018 { 00019 if( message != "") 00020 { 00021 ReaderQueue.put(new string(message)); 00022 pc.printf("%s", message); 00023 message = ""; 00024 pc.putc(0xA); 00025 pc.putc(0xD); 00026 count =0; 00027 00028 } 00029 } 00030 else if(c == 0x8) 00031 { 00032 if( message != "") 00033 { 00034 pc.putc(c); 00035 pc.putc(0x20); 00036 pc.putc(c); 00037 message = message.substr(0, message.length()-1); 00038 count--; 00039 } 00040 } 00041 else if(count <= 80) 00042 { 00043 pc.putc(c); 00044 count++; 00045 message += c; 00046 } 00047 } 00048 } 00049 }
Generated on Wed Jul 27 2022 13:56:09 by
