Skip to content

Commit e851941

Browse files
committed
STM32 sleep.c remove compilation warning
1 parent 7fc73e4 commit e851941

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

targets/TARGET_STM/sleep.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,27 +27,31 @@
2727
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2828
*******************************************************************************
2929
*/
30-
#include "sleep_api.h"
31-
#include "rtc_api_hal.h"
32-
3330
#if DEVICE_SLEEP
3431

3532
#include "cmsis.h"
33+
#include "us_ticker_api.h"
34+
#include "sleep_api.h"
35+
#include "rtc_api_hal.h"
36+
#include "hal_tick.h"
3637

38+
extern void HAL_SuspendTick(void);
39+
extern void HAL_ResumeTick(void);
3740

3841
void hal_sleep(void)
3942
{
40-
// Stop HAL systick
43+
// Stop HAL tick to avoid to exit sleep in 1ms
4144
HAL_SuspendTick();
4245
// Request to enter SLEEP mode
4346
HAL_PWR_EnterSLEEPMode(PWR_MAINREGULATOR_ON, PWR_SLEEPENTRY_WFI);
44-
// Restart HAL systick
47+
48+
// Restart HAL tick
4549
HAL_ResumeTick();
4650
}
4751

4852
void hal_deepsleep(void)
4953
{
50-
// Stop HAL systick
54+
// Stop HAL tick
5155
HAL_SuspendTick();
5256

5357
// Request to enter STOP mode with regulator in low power mode
@@ -74,7 +78,7 @@ void hal_deepsleep(void)
7478
HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
7579
#endif /* TARGET_STM32L4 */
7680

77-
// Restart HAL systick
81+
// Restart HAL tick
7882
HAL_ResumeTick();
7983

8084
// After wake-up from STOP reconfigure the PLL

0 commit comments

Comments
 (0)