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.
Revision 1:3644b10bce2f, committed 2016-06-09
- Comitter:
- devanlai
- Date:
- Thu Jun 09 05:30:21 2016 +0000
- Parent:
- 0:f2565808eea5
- Child:
- 2:1327e61cc56b
- Commit message:
- Fixed bug in USB serial output buffer
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
| slcan.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Sat Jun 04 04:40:58 2016 +0000
+++ b/main.cpp Thu Jun 09 05:30:21 2016 +0000
@@ -8,13 +8,13 @@
CAN can1(D9, D10);
-/*
USBSerial virtualUART(VID, PID, VERSION, false);
USBSLCAN slcan(virtualUART, can1);
-*/
+/*
Serial hwUART(USBTX, USBRX);
SerialSLCAN slcan(hwUART, can1);
+*/
Timer timer;
DigitalOut led(LED1);
@@ -25,15 +25,15 @@
//can1.frequency(500000);
//can1.mode(CAN::Silent);
- //virtualUART.connect(false);
- hwUART.baud(115200);
+ virtualUART.connect(false);
+ //hwUART.baud(115200);
led = 0;
led2 = 1;
while(1) {
bool active = false;
- active = slcan.update();
- /*
+ //active = slcan.update();
+
if (virtualUART.configured()) {
led2 = 0;
active = slcan.update();
@@ -41,7 +41,7 @@
led2 = 1;
virtualUART.connect(false);
}
- */
+
if (active) {
timer.reset();
--- a/slcan.cpp Sat Jun 04 04:40:58 2016 +0000
+++ b/slcan.cpp Thu Jun 09 05:30:21 2016 +0000
@@ -306,7 +306,6 @@
} else {
// Null-terminate the buffered command
inputCommandBuffer[inputCommandLen] = '\0';
- stream.puts(inputCommandBuffer);
inputCommandLen = 0;
active = true;
}
@@ -345,7 +344,7 @@
bool USBSLCAN::processCANMessages() {
bool active = false;
- size_t bytesAvailable = sizeof(outputPacketBuffer - outputPacketLen);
+ size_t bytesAvailable = sizeof(outputPacketBuffer) - outputPacketLen;
char* packetTail = &outputPacketBuffer[outputPacketLen];
if (messageQueued) {