Call HAL free functions from C++ destructors

Add missing calls to HAL free to the following drivers
- AnalogIn
- QSPI
- SerialBase
pull/13318/head
Kyle Kearney 2020-07-13 12:56:35 -07:00
parent 3a8989a247
commit 9e4be5e494
3 changed files with 10 additions and 1 deletions

View File

@ -151,7 +151,9 @@ public:
virtual ~AnalogIn()
{
// Do nothing
lock();
analogin_free(&_adc);
unlock();
}
protected:

View File

@ -117,6 +117,9 @@ public:
virtual ~QSPI()
{
lock();
qspi_free(&_qspi);
unlock();
}
/** Configure the data transmission format

View File

@ -287,6 +287,10 @@ SerialBase::~SerialBase()
for (int irq = 0; irq < IrqCnt; irq++) {
attach(nullptr, (IrqType)irq);
}
if (_rx_enabled || _tx_enabled) {
serial_free(&_serial);
}
}
#if DEVICE_SERIAL_FC