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.
serial.cpp
00001 #include "serial.h" 00002 00003 char* buffer = new char[BUFFER_SIZE]; 00004 00005 USB_Serial serial; 00006 00007 void USB_Serial::flush() { 00008 while(serial.readable()) 00009 serial.getc(); 00010 } 00011 00012 int USB_Serial::gets (char* str, int size) { 00013 int i=0; 00014 char c; 00015 while(1) { 00016 c = serial.getc(); 00017 if(c=='\r' || c=='\n') break; 00018 str[i++] = c; 00019 if(i+1==size) break; 00020 } 00021 str[i]=0; 00022 return i; 00023 } 00024
Generated on Thu Jul 14 2022 20:41:36 by
1.7.2