Modserial
Fork of MODSERIAL by
Diff: example1.cpp
- Revision:
- 27:9c93ce7cb9d8
- Parent:
- 18:21ef26402365
- Child:
- 28:76793a84f9e5
--- a/example1.cpp Mon Jun 10 19:06:21 2013 +0000 +++ b/example1.cpp Thu Jul 11 13:34:53 2013 +0000 @@ -10,7 +10,7 @@ DigitalOut led1(LED1); DigitalOut led2(LED2); -DigitalOut led3(LED3); +DigitalOut led3(LED2); DigitalOut led4(LED4); MODSERIAL pc(USBTX, USBRX); @@ -57,7 +57,7 @@ pc.baud(PC_BAUD); // Use a deliberatly slow baud to fill up the TX buffer - uart.baud(1200); + uart.baud(300); uart.attach(&txCallback, MODSERIAL::TxIrq); uart.attach(&rxCallback, MODSERIAL::RxIrq); @@ -68,18 +68,19 @@ led1 = 1; // Show start of sending with LED1. - for (int loop = 0; loop < 512; loop++) { + for (int loop = 0; loop < 2; loop++) { uart.printf("%c", c); c++; if (c > 'Z') c = 'A'; } - + pc.printf("%c", '!'); led1 = 0; // Show the end of sending by switching off LED1. // End program. Flash LED4. Notice how LED 2 and 3 continue // to flash for a short period while the interrupt system // continues to send the characters left in the TX buffer. - + wait(2); + pc.printf("\n\n\r%02X", UART2->C2); while(1) { led4 = !led4; wait(0.25);