Skip to content

Commit 7ba3728

Browse files
Donatien Garniermprse
authored andcommitted
Fixed illegal inline member initialization in SPI.h
1 parent 30209ee commit 7ba3728

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

drivers/SPI.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ namespace mbed {
2727

2828
SPI::spi_peripheral_s SPI::_peripherals[SPI_COUNT];
2929

30+
SPI::spi_peripheral_s::spi_peripheral_s() : owner(NULL) {
31+
32+
}
33+
3034
SPI::SPI(PinName mosi, PinName miso, PinName sclk, PinName ssel) :
3135
_peripheral(NULL),
3236
#if DEVICE_SPI_ASYNCH && 0
@@ -81,7 +85,7 @@ struct SPI::spi_peripheral_s *SPI::_lookup(SPIName name, bool or_last) {
8185
core_util_critical_section_enter();
8286
for (uint32_t idx = 0; idx < SPI_COUNT; idx++) {
8387
if ((_peripherals[idx].name == name) ||
84-
((_peripherals[idx].name == 0) && or_last)) {
88+
((_peripherals[idx].name == 0) && or_last)) {
8589
result = &_peripherals[idx];
8690
break;
8791
}
@@ -263,7 +267,7 @@ void SPI::start_transfer(const void *tx_buffer, int tx_length, void *rx_buffer,
263267
lock_deep_sleep();
264268
_acquire();
265269
_callback = callback;
266-
270+
267271
spi_transfer_async(&_peripheral->spi, tx_buffer, tx_length, rx_buffer, rx_length, &_write_fill,
268272
&SPI::irq_handler_asynch, this, _usage);
269273
}
@@ -308,7 +312,7 @@ void SPI::dequeue_transaction()
308312
void SPI::irq_handler_asynch(spi_t *obj, void *vctx, spi_async_event_t *event)
309313
{
310314
SPI *self = (SPI *)vctx;
311-
315+
312316
self->unlock_deep_sleep();
313317
self->_callback.call(SPI_EVENT_ALL);
314318
#if TRANSACTION_QUEUE_SIZE_SPI

drivers/SPI.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,14 +294,16 @@ class SPI : private NonCopyable<SPI> {
294294
#if !defined(DOXYGEN_ONLY)
295295
protected:
296296
struct spi_peripheral_s {
297+
spi_peripheral_s();
298+
297299
/* Internal SPI name identifying the resources. */
298300
SPIName name;
299301
/* Internal SPI object handling the resources' state. */
300302
spi_t spi;
301303
/* Used by lock and unlock for thread safety */
302304
SingletonPtr<PlatformMutex> mutex;
303305
/* Current user of the SPI */
304-
SPI *owner = NULL;
306+
SPI *owner;
305307

306308
#if DEVICE_SPI_ASYNCH && TRANSACTION_QUEUE_SIZE_SPI
307309
/* Queue of pending transfers */

0 commit comments

Comments
 (0)