mbed library sources. Supersedes mbed-src.
Dependents: Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more
Diff: targets/TARGET_Silicon_Labs/TARGET_EFM32/spi_api.c
- Revision:
- 180:96ed750bd169
- Parent:
- 179:b0033dcd6934
- Child:
- 184:08ed48f1de7f
diff -r b0033dcd6934 -r 96ed750bd169 targets/TARGET_Silicon_Labs/TARGET_EFM32/spi_api.c --- a/targets/TARGET_Silicon_Labs/TARGET_EFM32/spi_api.c Thu Dec 07 14:01:42 2017 +0000 +++ b/targets/TARGET_Silicon_Labs/TARGET_EFM32/spi_api.c Wed Jan 17 15:23:54 2018 +0000 @@ -26,6 +26,7 @@ #if DEVICE_SPI #include "mbed_assert.h" +#include "mbed_sleep.h" #include "PeripheralPins.h" #include "pinmap.h" #include "pinmap_function.h" @@ -39,12 +40,9 @@ #include "em_cmu.h" #include "em_dma.h" #include "sleep_api.h" -#include "sleepmodes.h" static uint16_t fill_word = SPI_FILL_WORD; -#define SPI_LEAST_ACTIVE_SLEEPMODE EM1 - static inline CMU_Clock_TypeDef spi_get_clock_tree(spi_t *obj) { switch ((int)obj->spi.spi) { @@ -1188,7 +1186,7 @@ spi_enable_event(obj, event, true); // Set the sleep mode - blockSleepMode(SPI_LEAST_ACTIVE_SLEEPMODE); + sleep_manager_lock_deep_sleep(); /* And kick off the transfer */ spi_master_transfer_dma(obj, tx, rx, tx_length, rx_length, (void*)handler, hint); @@ -1244,7 +1242,7 @@ /* Wait transmit to complete, before user code is indicated*/ while(!(obj->spi.spi->STATUS & USART_STATUS_TXC)); - unblockSleepMode(SPI_LEAST_ACTIVE_SLEEPMODE); + sleep_manager_unlock_deep_sleep(); /* return to CPP land to say we're finished */ return SPI_EVENT_COMPLETE; } else { @@ -1262,7 +1260,7 @@ /* disable interrupts */ spi_enable_interrupt(obj, (uint32_t)NULL, false); - unblockSleepMode(SPI_LEAST_ACTIVE_SLEEPMODE); + sleep_manager_unlock_deep_sleep(); /* Return the event back to userland */ return event; } @@ -1370,7 +1368,7 @@ /* Wait for transmit to complete, before user code is indicated */ while(!(obj->spi.spi->STATUS & USART_STATUS_TXC)); - unblockSleepMode(SPI_LEAST_ACTIVE_SLEEPMODE); + sleep_manager_unlock_deep_sleep(); /* return to CPP land to say we're finished */ return SPI_EVENT_COMPLETE; @@ -1391,7 +1389,7 @@ /* Wait for transmit to complete, before user code is indicated */ while(!(obj->spi.spi->STATUS & USART_STATUS_TXC)); - unblockSleepMode(SPI_LEAST_ACTIVE_SLEEPMODE); + sleep_manager_unlock_deep_sleep(); /* Return the event back to userland */ return event; @@ -1433,7 +1431,7 @@ } // Release sleep mode block - unblockSleepMode(SPI_LEAST_ACTIVE_SLEEPMODE); + sleep_manager_unlock_deep_sleep(); } #endif