Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call serial_free when Serial object is destroyed #2243

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions hal/api/SerialBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,7 @@ class SerialBase {

protected:
SerialBase(PinName tx, PinName rx);
virtual ~SerialBase() {
}
virtual ~SerialBase();

int _base_getc();
int _base_putc(int c);
Expand Down
4 changes: 4 additions & 0 deletions hal/common/SerialBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 5 additions & 0 deletions hal/targets/hal/TARGET_Maxim/TARGET_MAX32600/serial_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
5 changes: 5 additions & 0 deletions hal/targets/hal/TARGET_Maxim/TARGET_MAX32610/serial_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down