Fernando Cosentino
/
uTerminal_Example
Test program to demonstrate usage of uTerminal library
Diff: main.cpp
- Revision:
- 1:a2c302339cda
- Parent:
- 0:e9d152d29a2e
diff -r e9d152d29a2e -r a2c302339cda main.cpp --- a/main.cpp Mon Feb 18 17:01:05 2019 +0000 +++ b/main.cpp Mon Feb 18 18:24:49 2019 +0000 @@ -1,4 +1,5 @@ /** + * @file main.cpp * uTerminal_Example is a simple example demonstrating how to * use the uTerminal library. * @@ -8,7 +9,27 @@ #include "mbed.h" #include "uTerminal.h" -uTerminal terminal(P0_19, P0_18); // TX, RX pins for board n-DAP +//================================================================ +// INSTANCING THE TERMINAL: + +/* +// Create a Serial object yourself +Serial pc(P0_19, P0_18); // TX, RX pins for board n-DAP +uTerminal terminal(&pc); // argument is the address of a Serial object +*/ + +// or... +// This will automatically create an internal Serial object +//uTerminal terminal(P0_19, P0_18); // TX, RX pins for board n-DAP + +// or... +// Create a USBSerial object yourself (works with blocking and non-blocking) +//USBSerial pc; // blocking +USBSerial pc(0x1f00, 0x2012, 0x0001, false); // non-blocking +uTerminal terminal(&pc); // argument is the address of a USBSerial object + +//================================================================ + char sbuf[1024]; // useb by sprintf @@ -17,6 +38,7 @@ * If Auto-mode is used, this is called whenever a message arrives. * Otherwise, called whenever termina.Process() is polled. */ + void msg_received() { int i; @@ -38,6 +60,7 @@ } } + /** * Main loop */