From 8f6a222ad4acaf73849ee16c271a3e84d391c7a1 Mon Sep 17 00:00:00 2001 From: Mahadevan Mahesh Date: Mon, 25 Jul 2016 13:38:44 -0500 Subject: [PATCH 1/2] Call serial_free when Serial object is destroyed Signed-off-by: Mahadevan Mahesh --- hal/api/SerialBase.h | 3 +-- hal/common/SerialBase.cpp | 4 ++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/hal/api/SerialBase.h b/hal/api/SerialBase.h index 1d7ae7c34dd..c5096422082 100644 --- a/hal/api/SerialBase.h +++ b/hal/api/SerialBase.h @@ -216,8 +216,7 @@ class SerialBase { protected: SerialBase(PinName tx, PinName rx); - virtual ~SerialBase() { - } + virtual ~SerialBase(); int _base_getc(); int _base_putc(int c); diff --git a/hal/common/SerialBase.cpp b/hal/common/SerialBase.cpp index 891c4509751..7975946c844 100644 --- a/hal/common/SerialBase.cpp +++ b/hal/common/SerialBase.cpp @@ -33,6 +33,10 @@ SerialBase::SerialBase(PinName tx, PinName rx) : serial_irq_handler(&_serial, SerialBase::_irq_handler, (uint32_t)this); } +SerialBase::~SerialBase() { + serial_free(&_serial); +} + void SerialBase::baud(int baudrate) { lock(); serial_baud(&_serial, baudrate); From c3c58d565e8b233b07c9c33359963be431542623 Mon Sep 17 00:00:00 2001 From: Mahadevan Mahesh Date: Tue, 26 Jul 2016 14:09:42 -0500 Subject: [PATCH 2/2] Add dummy implementations of serial_free Signed-off-by: Mahadevan Mahesh --- hal/targets/hal/TARGET_Maxim/TARGET_MAX32600/serial_api.c | 5 +++++ hal/targets/hal/TARGET_Maxim/TARGET_MAX32610/serial_api.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/hal/targets/hal/TARGET_Maxim/TARGET_MAX32600/serial_api.c b/hal/targets/hal/TARGET_Maxim/TARGET_MAX32600/serial_api.c index da2b10bc4d9..f4f37717930 100644 --- a/hal/targets/hal/TARGET_Maxim/TARGET_MAX32600/serial_api.c +++ b/hal/targets/hal/TARGET_Maxim/TARGET_MAX32600/serial_api.c @@ -96,6 +96,11 @@ void serial_init(serial_t *obj, PinName tx, PinName rx) } } +void serial_free(serial_t *obj) +{ + +} + //****************************************************************************** void serial_baud(serial_t *obj, int baudrate) { diff --git a/hal/targets/hal/TARGET_Maxim/TARGET_MAX32610/serial_api.c b/hal/targets/hal/TARGET_Maxim/TARGET_MAX32610/serial_api.c index da2b10bc4d9..f4f37717930 100644 --- a/hal/targets/hal/TARGET_Maxim/TARGET_MAX32610/serial_api.c +++ b/hal/targets/hal/TARGET_Maxim/TARGET_MAX32610/serial_api.c @@ -96,6 +96,11 @@ void serial_init(serial_t *obj, PinName tx, PinName rx) } } +void serial_free(serial_t *obj) +{ + +} + //****************************************************************************** void serial_baud(serial_t *obj, int baudrate) {