mbed
Fork of mbed-dev by
Diff: drivers/SPI.cpp
- Revision:
- 175:b96e65c34a4d
- Parent:
- 171:19eb464bc2be
- Child:
- 181:96ed750bd169
--- a/drivers/SPI.cpp Fri Sep 15 14:59:18 2017 +0100 +++ b/drivers/SPI.cpp Mon Oct 02 15:33:19 2017 +0100 @@ -16,6 +16,10 @@ #include "drivers/SPI.h" #include "platform/mbed_critical.h" +#if DEVICE_SPI_ASYNCH +#include "platform/mbed_sleep.h" +#endif + #if DEVICE_SPI namespace mbed { @@ -136,6 +140,7 @@ void SPI::abort_transfer() { spi_abort_asynch(&_spi); + sleep_manager_unlock_deep_sleep(); #if TRANSACTION_QUEUE_SIZE_SPI dequeue_transaction(); #endif @@ -195,6 +200,7 @@ void SPI::start_transfer(const void *tx_buffer, int tx_length, void *rx_buffer, int rx_length, unsigned char bit_width, const event_callback_t& callback, int event) { + sleep_manager_lock_deep_sleep(); _acquire(); _callback = callback; _irq.callback(&SPI::irq_handler_asynch); @@ -224,6 +230,7 @@ { int event = spi_irq_handler_asynch(&_spi); if (_callback && (event & SPI_EVENT_ALL)) { + sleep_manager_unlock_deep_sleep(); _callback.call(event & SPI_EVENT_ALL); } #if TRANSACTION_QUEUE_SIZE_SPI