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.
Diff: RS485/RS485.cpp
- Revision:
- 9:859bcb293e46
- Parent:
- 8:c3cffab85b0d
- Child:
- 10:0b7f23df690a
--- a/RS485/RS485.cpp Tue Jul 28 14:25:33 2020 +0000
+++ b/RS485/RS485.cpp Thu Jul 30 13:04:10 2020 +0000
@@ -6,11 +6,11 @@
typedef uint8_t boolean;
typedef void (*voidFuncPtr)(void);
Timer lapse;
- const byte STX = '\2';
+ const byte STX = '\4';
const byte ETX = '\3';
RS485::RS485(PinName tx, PinName rx, PinName dere)
- : BufferedSerial(tx, rx , 115200)
+ : BufferedSerial(tx, rx )
{
return;
}
@@ -51,9 +51,11 @@
{
putc(STX); // STX
for (byte i = 0; i < length; i++)
- sendComplemented (data[i]);
- putc(ETX); // ETX
- sendComplemented(crc8(data, length));
+ //sendComplemented (data[i]);
+ putc(data[i]);
+ //putc(ETX); // ETX
+ //sendComplemented(crc8(data, length));
+ putc(crc8(data, length));
} // end of sendMsg
// receive a message, maximum "length" bytes, timeout after "timeout" clock_mseconds
@@ -89,6 +91,7 @@
input_pos = 0;
first_nibble = true;
start_time = lapse.read_ms(); // reset timeout period
+ data[0] = STX;
break;
case ETX: // end of text