File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change 27
27
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
28
*******************************************************************************
29
29
*/
30
- #include "sleep_api.h"
31
- #include "rtc_api_hal.h"
32
-
33
30
#if DEVICE_SLEEP
34
31
35
32
#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"
36
37
38
+ extern void HAL_SuspendTick (void );
39
+ extern void HAL_ResumeTick (void );
37
40
38
41
void hal_sleep (void )
39
42
{
40
- // Stop HAL systick
43
+ // Stop HAL tick to avoid to exit sleep in 1ms
41
44
HAL_SuspendTick ();
42
45
// Request to enter SLEEP mode
43
46
HAL_PWR_EnterSLEEPMode (PWR_MAINREGULATOR_ON , PWR_SLEEPENTRY_WFI );
44
- // Restart HAL systick
47
+
48
+ // Restart HAL tick
45
49
HAL_ResumeTick ();
46
50
}
47
51
48
52
void hal_deepsleep (void )
49
53
{
50
- // Stop HAL systick
54
+ // Stop HAL tick
51
55
HAL_SuspendTick ();
52
56
53
57
// Request to enter STOP mode with regulator in low power mode
@@ -74,7 +78,7 @@ void hal_deepsleep(void)
74
78
HAL_PWR_EnterSTOPMode (PWR_LOWPOWERREGULATOR_ON , PWR_STOPENTRY_WFI );
75
79
#endif /* TARGET_STM32L4 */
76
80
77
- // Restart HAL systick
81
+ // Restart HAL tick
78
82
HAL_ResumeTick ();
79
83
80
84
// After wake-up from STOP reconfigure the PLL
You can’t perform that action at this time.
0 commit comments