Merge pull request #8090 from deepikabhavnani/spi_4969

Cleanup SPI constructor and destructor
pull/8245/head
Martin Kojtal 2018-10-05 11:17:56 +02:00 committed by GitHub
commit ea2dec01be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 7 deletions

View File

@ -41,9 +41,14 @@ SPI::SPI(PinName mosi, PinName miso, PinName sclk, PinName ssel) :
_write_fill(SPI_FILL_CHAR)
{
// No lock needed in the constructor
spi_init(&_spi, mosi, miso, sclk, ssel);
_acquire();
}
SPI::~SPI()
{
if (_owner == this) {
_owner = NULL;
}
}
void SPI::format(int bits, int mode)

View File

@ -87,6 +87,7 @@ public:
* @param ssel SPI chip select pin
*/
SPI(PinName mosi, PinName miso, PinName sclk, PinName ssel = NC);
virtual ~SPI();
/** Configure the data transmission format
*
@ -272,11 +273,6 @@ private:
#endif
public:
virtual ~SPI()
{
}
protected:
spi_t _spi;