Release memory allocated in constructors
This commit is contained in:
parent
bbb893f51d
commit
3fc89c5835
|
|
@ -70,6 +70,14 @@ Adafruit_SPIDevice::Adafruit_SPIDevice(int8_t cspin, int8_t sckpin,
|
|||
_spi = NULL;
|
||||
}
|
||||
|
||||
// release memory allocated in constructors
|
||||
Adafruit_SPIDevice::~Adafruit_SPIDevice() {
|
||||
if (_spiSetting) {
|
||||
delete _spiSetting;
|
||||
_spiSetting = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief Initializes SPI bus and sets CS pin high
|
||||
* @return Always returns true because there's no way to test success of SPI
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ public:
|
|||
uint32_t freq = 1000000,
|
||||
BitOrder dataOrder = SPI_BITORDER_MSBFIRST,
|
||||
uint8_t dataMode = SPI_MODE0);
|
||||
~Adafruit_SPIDevice();
|
||||
|
||||
bool begin(void);
|
||||
bool read(uint8_t *buffer, size_t len, uint8_t sendvalue = 0xFF);
|
||||
|
|
|
|||
Loading…
Reference in New Issue