Software serial, for when you are out of serial pins
Dependents: BufferedSoftSerial neurGAI_Seeed_BLUETOOTH LPC-SD-35 ESP-WROOM-02_test ... more
Revision 9:4e4617c4a441, committed 2014-07-05
- Comitter:
- Sissors
- Date:
- Sat Jul 05 08:07:49 2014 +0000
- Parent:
- 8:332b66de89d3
- Child:
- 10:236fce2e5b8c
- Commit message:
- Added destructor
Changed in this revision
| SoftSerial.cpp | Show annotated file Show diff for this revision Revisions of this file |
| SoftSerial.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/SoftSerial.cpp Sun Apr 27 19:48:40 2014 +0000
+++ b/SoftSerial.cpp Sat Jul 05 08:07:49 2014 +0000
@@ -21,6 +21,13 @@
format();
}
+SoftSerial::~SoftSerial() {
+ if (tx_en)
+ delete(tx);
+ if (rx_en)
+ delete(rx);
+}
+
void SoftSerial::baud(int baudrate) {
bit_period = 1000000 / baudrate;
}
--- a/SoftSerial.h Sun Apr 27 19:48:40 2014 +0000
+++ b/SoftSerial.h Sat Jul 05 08:07:49 2014 +0000
@@ -17,6 +17,7 @@
* @param name Name of the connection
*/
SoftSerial(PinName TX, PinName RX, const char* name = NULL);
+ virtual ~SoftSerial();
/** Set the baud rate of the serial port
*
Erik -