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.
Fork of SoftSerial by
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
*
