diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/hal_patch/sleep.c b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/hal_patch/sleep.c index efb46699eef..7c178188a54 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/hal_patch/sleep.c +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/hal_patch/sleep.c @@ -23,7 +23,7 @@ // In this case, bits which are equal to 0 are the bits reserved in this register #define SCB_ICSR_RESERVED_BITS_MASK 0x9E43F03F -void sleep(void) +void hal_sleep(void) { // ensure debug is disconnected if semihost is enabled.... @@ -64,7 +64,7 @@ void sleep(void) } } -void deepsleep(void) +void hal_deepsleep(void) { sleep(); // NRF_POWER->SYSTEMOFF=1; diff --git a/hal/sleep_api.h b/hal/sleep_api.h index 25a7b2a6ed5..8747459cb95 100644 --- a/hal/sleep_api.h +++ b/hal/sleep_api.h @@ -41,7 +41,7 @@ extern "C" { * Flash re-programming and the USB serial port will remain active, but the mbed program will no longer be * able to access the LocalFileSystem */ -void sleep(void); +void hal_sleep(void); /** Send the microcontroller to deep sleep * @@ -56,7 +56,7 @@ void sleep(void); * Flash re-programming and the USB serial port will remain active, but the mbed program will no longer be * able to access the LocalFileSystem */ -void deepsleep(void); +void hal_deepsleep(void); #ifdef __cplusplus } diff --git a/mbed.h b/mbed.h index 0ee12dc76f7..0e71670a0d0 100644 --- a/mbed.h +++ b/mbed.h @@ -92,6 +92,7 @@ #include "drivers/InterruptIn.h" #include "platform/wait_api.h" #include "hal/sleep_api.h" +#include "platform/sleep.h" #include "platform/rtc_time.h" // mbed Non-hardware components diff --git a/platform/sleep.h b/platform/sleep.h new file mode 100644 index 00000000000..013bef1db1f --- /dev/null +++ b/platform/sleep.h @@ -0,0 +1,85 @@ + +/** \addtogroup platform */ +/** @{*/ +/* mbed Microcontroller Library + * Copyright (c) 2006-2017 ARM Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef MBED_SLEEP_H +#define MBED_SLEEP_H + +#include "sleep_api.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** Send the microcontroller to sleep + * + * @note This function can be a noop if not implemented by the platform. + * @note This function will only put device to sleep in release mode (small profile or when NDEBUG is defined). + * + * The processor is setup ready for sleep, and sent to sleep using __WFI(). In this mode, the + * system clock to the core is stopped until a reset or an interrupt occurs. This eliminates + * dynamic power used by the processor, memory systems and buses. The processor, peripheral and + * memory state are maintained, and the peripherals continue to work and can generate interrupts. + * + * The processor can be woken up by any internal peripheral interrupt or external pin interrupt. + * + * @note + * The mbed interface semihosting is disconnected as part of going to sleep, and can not be restored. + * Flash re-programming and the USB serial port will remain active, but the mbed program will no longer be + * able to access the LocalFileSystem + */ +__INLINE static void sleep(void) +{ +#ifdef NDEBUG +#if DEVICE_SLEEP + hal_sleep(); +#endif /* DEVICE_SLEEP */ +#endif /* NDEBUG */ +} + +/** Send the microcontroller to deep sleep + * + * @note This function can be a noop if not implemented by the platform. + * @note This function will only put device to sleep in release mode (small profile or when NDEBUG is defined). + * + * This processor is setup ready for deep sleep, and sent to sleep using __WFI(). This mode + * has the same sleep features as sleep plus it powers down peripherals and clocks. All state + * is still maintained. + * + * The processor can only be woken up by an external interrupt on a pin or a watchdog timer. + * + * @note + * The mbed interface semihosting is disconnected as part of going to sleep, and can not be restored. + * Flash re-programming and the USB serial port will remain active, but the mbed program will no longer be + * able to access the LocalFileSystem + */ +__INLINE static void deepsleep(void) +{ +#ifdef NDEBUG +#if DEVICE_SLEEP + hal_deepsleep(); +#endif /* DEVICE_SLEEP */ +#endif /* NDEBUG */ +} + +#ifdef __cplusplus +} +#endif + +#endif + +/** @}*/ diff --git a/targets/TARGET_ARM_SSG/TARGET_BEETLE/sleep.c b/targets/TARGET_ARM_SSG/TARGET_BEETLE/sleep.c index b2b007542c9..d6a64362b76 100644 --- a/targets/TARGET_ARM_SSG/TARGET_BEETLE/sleep.c +++ b/targets/TARGET_ARM_SSG/TARGET_BEETLE/sleep.c @@ -16,13 +16,13 @@ #include "sleep_api.h" #include "cmsis.h" - void sleep(void) + void hal_sleep(void) { SystemPowerSuspend(POWER_MODE_SLEEP); SystemPowerResume(POWER_MODE_SLEEP); } -void deepsleep(void) +void hal_deepsleep(void) { SystemPowerSuspend(POWER_MODE_DEEP_SLEEP); SystemPowerResume(POWER_MODE_DEEP_SLEEP); diff --git a/targets/TARGET_Atmel/TARGET_SAM_CortexM0P/sleep_api.c b/targets/TARGET_Atmel/TARGET_SAM_CortexM0P/sleep_api.c index bc26c0439f6..c6834311790 100644 --- a/targets/TARGET_Atmel/TARGET_SAM_CortexM0P/sleep_api.c +++ b/targets/TARGET_Atmel/TARGET_SAM_CortexM0P/sleep_api.c @@ -25,7 +25,7 @@ * @param[void] void * @return void */ -void sleep(void) +void hal_sleep(void) { #if (SAMD21) || (SAMR21) system_set_sleepmode(SYSTEM_SLEEPMODE_IDLE_2); @@ -43,7 +43,7 @@ void sleep(void) * @param[void] void * @return void */ -void deepsleep(void) +void hal_deepsleep(void) { system_set_sleepmode(SYSTEM_SLEEPMODE_STANDBY); system_sleep(); diff --git a/targets/TARGET_Atmel/TARGET_SAM_CortexM4/sleep_api.c b/targets/TARGET_Atmel/TARGET_SAM_CortexM4/sleep_api.c index 384269a9113..b21209f7437 100644 --- a/targets/TARGET_Atmel/TARGET_SAM_CortexM4/sleep_api.c +++ b/targets/TARGET_Atmel/TARGET_SAM_CortexM4/sleep_api.c @@ -24,7 +24,7 @@ * @param[void] void * @return void */ -void sleep(void) +void hal_sleep(void) { enum sleepmgr_mode sleep_mode; @@ -40,10 +40,10 @@ void sleep(void) * @param[void] void * @return void */ -void deepsleep(void) +void hal_deepsleep(void) { enum sleepmgr_mode sleep_mode; sleep_mode = SLEEPMGR_SLEEP_WFE; sleepmgr_sleep(sleep_mode); -} \ No newline at end of file +} diff --git a/targets/TARGET_Freescale/TARGET_K20XX/sleep.c b/targets/TARGET_Freescale/TARGET_K20XX/sleep.c index 4a7dced648b..fca8ff3c64c 100644 --- a/targets/TARGET_Freescale/TARGET_K20XX/sleep.c +++ b/targets/TARGET_Freescale/TARGET_K20XX/sleep.c @@ -17,7 +17,7 @@ #include "cmsis.h" //Normal wait mode -void sleep(void) +void hal_sleep(void) { SMC->PMPROT = SMC_PMPROT_AVLLS_MASK | SMC_PMPROT_ALLS_MASK | SMC_PMPROT_AVLP_MASK; @@ -27,7 +27,7 @@ void sleep(void) } //Very low-power stop mode -void deepsleep(void) +void hal_deepsleep(void) { //Check if ADC is enabled and HS mode is set, if yes disable it (lowers power consumption by 60uA) uint8_t ADC_HSC = 0; diff --git a/targets/TARGET_Freescale/TARGET_KLXX/sleep.c b/targets/TARGET_Freescale/TARGET_KLXX/sleep.c index c3ea772007a..a3bb82a1091 100644 --- a/targets/TARGET_Freescale/TARGET_KLXX/sleep.c +++ b/targets/TARGET_Freescale/TARGET_KLXX/sleep.c @@ -18,7 +18,7 @@ #include "PeripheralPins.h" //Normal wait mode -void sleep(void) +void hal_sleep(void) { SMC->PMPROT = SMC_PMPROT_AVLLS_MASK | SMC_PMPROT_ALLS_MASK | SMC_PMPROT_AVLP_MASK; @@ -28,7 +28,7 @@ void sleep(void) } //Very low-power stop mode -void deepsleep(void) +void hal_deepsleep(void) { //Check if ADC is enabled and HS mode is set, if yes disable it (lowers power consumption by 60uA) uint8_t ADC_HSC = 0; diff --git a/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/api/sleep.c b/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/api/sleep.c index d00bb7b371d..08f32b86917 100644 --- a/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/api/sleep.c +++ b/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/api/sleep.c @@ -18,14 +18,14 @@ #include "fsl_smc.h" #include "fsl_clock_config.h" -void sleep(void) +void hal_sleep(void) { SMC_SetPowerModeProtection(SMC, kSMC_AllowPowerModeAll); SMC_SetPowerModeWait(SMC); } -void deepsleep(void) +void hal_deepsleep(void) { #if (defined(FSL_FEATURE_SOC_MCG_COUNT) && FSL_FEATURE_SOC_MCG_COUNT) mcg_mode_t mode = CLOCK_GetMode(); diff --git a/targets/TARGET_Maxim/TARGET_MAX32600/sleep.c b/targets/TARGET_Maxim/TARGET_MAX32600/sleep.c index 4d26c535730..5d47900ff96 100644 --- a/targets/TARGET_Maxim/TARGET_MAX32600/sleep.c +++ b/targets/TARGET_Maxim/TARGET_MAX32600/sleep.c @@ -41,7 +41,7 @@ static mxc_uart_regs_t *stdio_uart = (mxc_uart_regs_t*)STDIO_UART; // Normal wait mode -void sleep(void) +void hal_sleep(void) { // Normal sleep mode for ARM core SCB->SCR = 0; @@ -70,7 +70,7 @@ static void clearAllGPIOWUD(void) } // Low-power stop mode -void deepsleep(void) +void hal_deepsleep(void) { __disable_irq(); diff --git a/targets/TARGET_Maxim/TARGET_MAX32610/sleep.c b/targets/TARGET_Maxim/TARGET_MAX32610/sleep.c index 4d26c535730..5d47900ff96 100644 --- a/targets/TARGET_Maxim/TARGET_MAX32610/sleep.c +++ b/targets/TARGET_Maxim/TARGET_MAX32610/sleep.c @@ -41,7 +41,7 @@ static mxc_uart_regs_t *stdio_uart = (mxc_uart_regs_t*)STDIO_UART; // Normal wait mode -void sleep(void) +void hal_sleep(void) { // Normal sleep mode for ARM core SCB->SCR = 0; @@ -70,7 +70,7 @@ static void clearAllGPIOWUD(void) } // Low-power stop mode -void deepsleep(void) +void hal_deepsleep(void) { __disable_irq(); diff --git a/targets/TARGET_Maxim/TARGET_MAX32620/sleep.c b/targets/TARGET_Maxim/TARGET_MAX32620/sleep.c index 81874b0f2a4..2d531e35f66 100644 --- a/targets/TARGET_Maxim/TARGET_MAX32620/sleep.c +++ b/targets/TARGET_Maxim/TARGET_MAX32620/sleep.c @@ -54,7 +54,7 @@ static mxc_uart_regs_t *stdio_uart = (mxc_uart_regs_t*)STDIO_UART; static int restore_usb; static usb_state_t usb_state; -void sleep(void) +void hal_sleep(void) { // Normal sleep mode for ARM core SCB->SCR = 0; @@ -109,7 +109,7 @@ static void usb_wakeup(void) } // Low-power stop mode -void deepsleep(void) +void hal_deepsleep(void) { unsigned int part_rev = MXC_PWRMAN->mask_id0 & MXC_F_PWRMAN_MASK_ID0_REVISION_ID; diff --git a/targets/TARGET_Maxim/TARGET_MAX32625/sleep.c b/targets/TARGET_Maxim/TARGET_MAX32625/sleep.c index 560a4409293..3984b4aca33 100644 --- a/targets/TARGET_Maxim/TARGET_MAX32625/sleep.c +++ b/targets/TARGET_Maxim/TARGET_MAX32625/sleep.c @@ -34,13 +34,13 @@ #include "sleep_api.h" #include "lp.h" -void sleep(void) +void hal_sleep(void) { LP_EnterLP2(); } // Low-power stop mode -void deepsleep(void) +void hal_deepsleep(void) { - sleep(); + hal_sleep(); } diff --git a/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sleep.c b/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sleep.c index be8d69d1e81..80c39f26e41 100644 --- a/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sleep.c +++ b/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sleep.c @@ -18,7 +18,7 @@ #include "mbed_interface.h" #include "toolchain.h" -MBED_WEAK void sleep(void) +void hal_sleep(void) { // ensure debug is disconnected if semihost is enabled.... NRF_POWER->TASKS_LOWPWR = 1; @@ -26,8 +26,8 @@ MBED_WEAK void sleep(void) __WFE(); } -MBED_WEAK void deepsleep(void) +void hal_deepsleep(void) { - sleep(); + hal_sleep(); // NRF_POWER->SYSTEMOFF=1; } diff --git a/targets/TARGET_NORDIC/TARGET_NRF5/sleep.c b/targets/TARGET_NORDIC/TARGET_NRF5/sleep.c index cb677400d1b..29020dc934a 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5/sleep.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5/sleep.c @@ -25,7 +25,7 @@ #define FPU_EXCEPTION_MASK 0x0000009F -void sleep(void) +void hal_sleep(void) { // ensure debug is disconnected if semihost is enabled.... @@ -73,8 +73,8 @@ void sleep(void) } } -void deepsleep(void) +void hal_deepsleep(void) { - sleep(); + hal_sleep(); // NRF_POWER->SYSTEMOFF=1; } diff --git a/targets/TARGET_NUVOTON/TARGET_M451/sleep.c b/targets/TARGET_NUVOTON/TARGET_M451/sleep.c index bd6f08fcd44..60117a9978b 100644 --- a/targets/TARGET_NUVOTON/TARGET_M451/sleep.c +++ b/targets/TARGET_NUVOTON/TARGET_M451/sleep.c @@ -38,7 +38,7 @@ int pwmout_allow_powerdown(void); /** * Enter Idle mode. */ -void sleep(void) +void hal_sleep(void) { struct sleep_s sleep_obj; sleep_obj.powerdown = 0; @@ -49,7 +49,7 @@ void sleep(void) /** * Enter Power-down mode while no peripheral is active; otherwise, enter Idle mode. */ -void deepsleep(void) +void hal_deepsleep(void) { struct sleep_s sleep_obj; sleep_obj.powerdown = 1; diff --git a/targets/TARGET_NUVOTON/TARGET_NUC472/sleep.c b/targets/TARGET_NUVOTON/TARGET_NUC472/sleep.c index 4a51b101846..62fe06cd730 100644 --- a/targets/TARGET_NUVOTON/TARGET_NUC472/sleep.c +++ b/targets/TARGET_NUVOTON/TARGET_NUC472/sleep.c @@ -38,7 +38,7 @@ int pwmout_allow_powerdown(void); /** * Enter Idle mode. */ -void sleep(void) +void hal_sleep(void) { struct sleep_s sleep_obj; sleep_obj.powerdown = 0; @@ -49,7 +49,7 @@ void sleep(void) /** * Enter Power-down mode while no peripheral is active; otherwise, enter Idle mode. */ -void deepsleep(void) +void hal_deepsleep(void) { struct sleep_s sleep_obj; sleep_obj.powerdown = 1; diff --git a/targets/TARGET_NXP/TARGET_LPC11U6X/sleep.c b/targets/TARGET_NXP/TARGET_LPC11U6X/sleep.c index ede20f99dc2..b6d40228125 100644 --- a/targets/TARGET_NXP/TARGET_LPC11U6X/sleep.c +++ b/targets/TARGET_NXP/TARGET_LPC11U6X/sleep.c @@ -19,7 +19,7 @@ #if DEVICE_SLEEP -void sleep(void) { +void hal_sleep(void) { #if (DEVICE_SEMIHOST == 1) // ensure debug is disconnected @@ -37,7 +37,7 @@ void sleep(void) { } -void deepsleep(void) { +void hal_deepsleep(void) { #if (DEVICE_SEMIHOST == 1) // ensure debug is disconnected diff --git a/targets/TARGET_NXP/TARGET_LPC11UXX/sleep.c b/targets/TARGET_NXP/TARGET_LPC11UXX/sleep.c index b7b979326b0..261e1408713 100644 --- a/targets/TARGET_NXP/TARGET_LPC11UXX/sleep.c +++ b/targets/TARGET_NXP/TARGET_LPC11UXX/sleep.c @@ -17,7 +17,7 @@ #include "cmsis.h" #include "mbed_interface.h" -void sleep(void) { +void hal_sleep(void) { // ensure debug is disconnected #if DEVICE_SEMIHOST mbed_interface_disconnect(); @@ -59,7 +59,7 @@ void sleep(void) { * We treat a deepsleep() as a normal sleep(). */ -void deepsleep(void) { +void hal_deepsleep(void) { // ensure debug is disconnected #if DEVICE_SEMIHOST mbed_interface_disconnect(); diff --git a/targets/TARGET_NXP/TARGET_LPC11XX_11CXX/sleep.c b/targets/TARGET_NXP/TARGET_LPC11XX_11CXX/sleep.c index 8507cc5a75f..0eee902fd28 100644 --- a/targets/TARGET_NXP/TARGET_LPC11XX_11CXX/sleep.c +++ b/targets/TARGET_NXP/TARGET_LPC11XX_11CXX/sleep.c @@ -17,7 +17,7 @@ #include "cmsis.h" #include "mbed_interface.h" -void sleep(void) { +void hal_sleep(void) { // PCON[DPDEN] set to sleep LPC_PMU->PCON = 0x0; @@ -29,7 +29,7 @@ void sleep(void) { __WFI(); } -void deepsleep(void) { +void hal_deepsleep(void) { // PCON[DPDEN] set to deepsleep LPC_PMU->PCON = 0; diff --git a/targets/TARGET_NXP/TARGET_LPC13XX/sleep.c b/targets/TARGET_NXP/TARGET_LPC13XX/sleep.c index 1515891d1ea..50e242ff1c0 100644 --- a/targets/TARGET_NXP/TARGET_LPC13XX/sleep.c +++ b/targets/TARGET_NXP/TARGET_LPC13XX/sleep.c @@ -17,7 +17,7 @@ #include "cmsis.h" #include "mbed_interface.h" -void sleep(void) { +void hal_sleep(void) { // PCON[PD] set to sleep LPC_PMU->PCON = 0x0; @@ -28,7 +28,7 @@ void sleep(void) { __WFI(); } -void deepsleep(void) { +void hal_deepsleep(void) { // PCON[PD] set to deepsleep LPC_PMU->PCON = 0x1; diff --git a/targets/TARGET_NXP/TARGET_LPC176X/sleep.c b/targets/TARGET_NXP/TARGET_LPC176X/sleep.c index e8b734324d8..c9f6ad41459 100644 --- a/targets/TARGET_NXP/TARGET_LPC176X/sleep.c +++ b/targets/TARGET_NXP/TARGET_LPC176X/sleep.c @@ -17,7 +17,7 @@ #include "cmsis.h" #include "mbed_interface.h" -void sleep(void) { +void hal_sleep(void) { #if (DEVICE_SEMIHOST == 1) // ensure debug is disconnected @@ -60,7 +60,7 @@ void sleep(void) { * We treat a deepsleep() as a normal sleep(). */ -void deepsleep(void) { +void hal_deepsleep(void) { #if (DEVICE_SEMIHOST == 1) // ensure debug is disconnected @@ -68,5 +68,5 @@ void deepsleep(void) { #endif // PCON[PD] set to deepsleep - sleep(); + hal_sleep(); } diff --git a/targets/TARGET_NXP/TARGET_LPC408X/sleep.c b/targets/TARGET_NXP/TARGET_LPC408X/sleep.c index ac482186900..298573b9ad9 100644 --- a/targets/TARGET_NXP/TARGET_LPC408X/sleep.c +++ b/targets/TARGET_NXP/TARGET_LPC408X/sleep.c @@ -17,7 +17,7 @@ #include "cmsis.h" #include "mbed_interface.h" -void sleep(void) { +void hal_sleep(void) { LPC_SC->PCON = 0x0; // SRC[SLEEPDEEP] set to 0 = sleep @@ -52,6 +52,6 @@ void sleep(void) { * * We treat a deepsleep() as a normal sleep(). */ -void deepsleep(void) { - sleep(); +void hal_deepsleep(void) { + hal_sleep(); } diff --git a/targets/TARGET_NXP/TARGET_LPC43XX/sleep.c b/targets/TARGET_NXP/TARGET_LPC43XX/sleep.c index dd6949f75d1..deafdb50db6 100644 --- a/targets/TARGET_NXP/TARGET_LPC43XX/sleep.c +++ b/targets/TARGET_NXP/TARGET_LPC43XX/sleep.c @@ -19,7 +19,7 @@ #include "cmsis.h" #include "mbed_interface.h" -void sleep(void) { +void hal_sleep(void) { // SRC[SLEEPDEEP] set to 0 = sleep SCB->SCR &= ~SCB_SCR_SLEEPDEEP_Msk; @@ -31,6 +31,6 @@ void sleep(void) { /* * ToDo: Implement deepsleep() */ -void deepsleep(void) { - sleep(); +void hal_deepsleep(void) { + hal_sleep(); } diff --git a/targets/TARGET_NXP/TARGET_LPC81X/sleep.c b/targets/TARGET_NXP/TARGET_LPC81X/sleep.c index 4d2232a86d9..e0c1aa52088 100644 --- a/targets/TARGET_NXP/TARGET_LPC81X/sleep.c +++ b/targets/TARGET_NXP/TARGET_LPC81X/sleep.c @@ -20,7 +20,7 @@ //#define DEEPSLEEP #define POWERDOWN -void sleep(void) { +void hal_sleep(void) { //Normal sleep mode for PCON: LPC_PMU->PCON &= ~0x03; @@ -36,7 +36,7 @@ void sleep(void) { //Deepsleep/powerdown modes assume the device is configured to use its internal RC oscillator directly #ifdef DEEPSLEEP -void deepsleep(void) { +void hal_deepsleep(void) { //Deep sleep in PCON LPC_PMU->PCON &= ~0x03; LPC_PMU->PCON |= 0x01; @@ -59,7 +59,7 @@ void deepsleep(void) { #endif #ifdef POWERDOWN -void deepsleep(void) { +void hal_deepsleep(void) { //Powerdown in PCON LPC_PMU->PCON &= ~0x03; LPC_PMU->PCON |= 0x02; diff --git a/targets/TARGET_NXP/TARGET_LPC82X/sleep.c b/targets/TARGET_NXP/TARGET_LPC82X/sleep.c index 64115a2055d..9f6deb51f8f 100644 --- a/targets/TARGET_NXP/TARGET_LPC82X/sleep.c +++ b/targets/TARGET_NXP/TARGET_LPC82X/sleep.c @@ -20,7 +20,7 @@ //#define DEEPSLEEP #define POWERDOWN -void sleep(void) +void hal_sleep(void) { //Normal sleep mode for PCON: LPC_PMU->PCON &= ~0x03; @@ -34,7 +34,7 @@ void sleep(void) // Deepsleep/powerdown modes assume the device is configured to use its internal RC oscillator directly -void deepsleep(void) +void hal_deepsleep(void) { //Deep sleep in PCON LPC_PMU->PCON &= ~0x03; diff --git a/targets/TARGET_STM/sleep.c b/targets/TARGET_STM/sleep.c index 540b6b4e2f0..acb4b1999af 100644 --- a/targets/TARGET_STM/sleep.c +++ b/targets/TARGET_STM/sleep.c @@ -35,7 +35,7 @@ #include "cmsis.h" -void sleep(void) +void hal_sleep(void) { // Stop HAL systick HAL_SuspendTick(); @@ -45,7 +45,7 @@ void sleep(void) HAL_ResumeTick(); } -void deepsleep(void) +void hal_deepsleep(void) { // Stop HAL systick HAL_SuspendTick(); diff --git a/targets/TARGET_Silicon_Labs/TARGET_EFM32/sleep.c b/targets/TARGET_Silicon_Labs/TARGET_EFM32/sleep.c index 12721ead25e..951ec134476 100644 --- a/targets/TARGET_Silicon_Labs/TARGET_EFM32/sleep.c +++ b/targets/TARGET_Silicon_Labs/TARGET_EFM32/sleep.c @@ -35,7 +35,7 @@ uint32_t sleep_block_counter[NUM_SLEEP_MODES] = {0}; * Sleep mode. * Enter the lowest possible sleep mode that is not blocked by ongoing activity. */ -void sleep(void) +void hal_sleep(void) { if (sleep_block_counter[0] > 0) { /* Blocked everything below EM0, so just return */ @@ -64,7 +64,7 @@ void sleep(void) * consumption as low as 1.1 μA with RTC enabled. Power-on Reset, Brown-out * Detection and full RAM and CPU retention is also included. */ -void deepsleep(void) +void hal_deepsleep(void) { EMU_EnterEM2(true); } diff --git a/targets/TARGET_WIZNET/TARGET_W7500x/sleep.c b/targets/TARGET_WIZNET/TARGET_W7500x/sleep.c index 30a8716736c..acd0030bcef 100644 --- a/targets/TARGET_WIZNET/TARGET_W7500x/sleep.c +++ b/targets/TARGET_WIZNET/TARGET_W7500x/sleep.c @@ -31,12 +31,12 @@ #include "cmsis.h" #include "mbed_interface.h" -void sleep(void) +void hal_sleep(void) { // To Do } -void deepsleep(void) +void hal_deepsleep(void) { // To Do } diff --git a/targets/TARGET_ublox/TARGET_HI2110/sleep.c b/targets/TARGET_ublox/TARGET_HI2110/sleep.c index 9a5eb809506..e919d49bd6c 100644 --- a/targets/TARGET_ublox/TARGET_HI2110/sleep.c +++ b/targets/TARGET_ublox/TARGET_HI2110/sleep.c @@ -40,14 +40,14 @@ * MBED API CALLS * ----------------------------------------------------------------*/ -void sleep(void) +void hal_sleep(void) { __DSB(); __WFI(); __ISB(); } -void deepsleep() +void hal_deepsleep() { - sleep(); + hal_sleep(); }