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); 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) {