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.
Dependents: Dumb_box_rev2 mbed_GPSproject
You are viewing an older revision! See the latest version
Homepage
API¶
| iSerial | |
Examples¶
#include "mbed.h"
#include "iSerial.h"
char s[] = "12345678901234567890123456789012345678901234567890";
int main() {
iSerial pc(USBTX,USBRX);
char* c = s;
while(1) {
pc.puts(s);
while(pc.readable()){
int ret = pc.getc();
if(ret)
*c++ = ret;
if(c >= s+sizeof(s)-1)
c = s;
}
wait(1);
}
}
<<code tittle="Comparing speed of ordinary Serial functions">
- include "mbed.h"
- include "iSerial.h"
char s[] = "12345678901234567890123456789012345678901234567890"; 50 bytes
int main() {
Timer t;
Serial pc(USBTX,USBRX); pc.baud(921600);
t.reset(); t.start(); for(int i=0; i<30; i++) { pc.printf(s); wait(0.001); } t.stop();
int t1 = t.read_us();
pc.puts("\n\n\n");
iSerial ipc(USBTX,USBRX,NULL,1000,100); try NOT to set the buffer over flowed iSerial ipc(USBTX,USBRX); set as default = 100, 100 ipc.baud(921600);
t.reset(); t.start(); for(int i=0; i<30; i++) { ipc.printf(s); wait(0.001); } t.stop();
int t2 = t.read_us();
wait(1);
ipc.printf("\n\n\nThe time %d, %d [us] was taken.\n", t1, t2);
wait(3); pc.puts("End."); } <</code>>