File tree Expand file tree Collapse file tree 3 files changed +35
-12
lines changed
cmsis/TARGET_STM/TARGET_STM32F7
hal/TARGET_STM/TARGET_STM32F7 Expand file tree Collapse file tree 3 files changed +35
-12
lines changed Original file line number Diff line number Diff line change @@ -126,6 +126,21 @@ HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority) {
126
126
return HAL_OK ;
127
127
}
128
128
129
+ __INLINE void HAL_SuspendTick (void )
130
+ {
131
+ TimMasterHandle .Instance = TIM_MST ;
132
+
133
+ // Disable HAL tick and us_ticker update interrupts (used for 32 bit counter)
134
+ __HAL_TIM_DISABLE_IT (& TimMasterHandle , TIM_IT_CC2 );
135
+ }
136
+
137
+ __INLINE void HAL_ResumeTick (void )
138
+ {
139
+ TimMasterHandle .Instance = TIM_MST ;
140
+
141
+ // Enable HAL tick and us_ticker update interrupts (used for 32 bit counter)
142
+ __HAL_TIM_ENABLE_IT (& TimMasterHandle , TIM_IT_CC2 );
143
+ }
129
144
/**
130
145
* @}
131
146
*/
Original file line number Diff line number Diff line change @@ -126,6 +126,21 @@ HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority) {
126
126
return HAL_OK ;
127
127
}
128
128
129
+ __INLINE void HAL_SuspendTick (void )
130
+ {
131
+ TimMasterHandle .Instance = TIM_MST ;
132
+
133
+ // Disable HAL tick and us_ticker update interrupts (used for 32 bit counter)
134
+ __HAL_TIM_DISABLE_IT (& TimMasterHandle , TIM_IT_CC2 );
135
+ }
136
+
137
+ __INLINE void HAL_ResumeTick (void )
138
+ {
139
+ TimMasterHandle .Instance = TIM_MST ;
140
+
141
+ // Enable HAL tick and us_ticker update interrupts (used for 32 bit counter)
142
+ __HAL_TIM_ENABLE_IT (& TimMasterHandle , TIM_IT_CC2 );
143
+ }
129
144
/**
130
145
* @}
131
146
*/
Original file line number Diff line number Diff line change 33
33
34
34
#include "cmsis.h"
35
35
36
- static TIM_HandleTypeDef TimMasterHandle ;
37
-
38
- void sleep (void )
39
- {
40
- TimMasterHandle .Instance = TIM5 ;
41
-
42
- // Disable HAL tick interrupt
43
- __HAL_TIM_DISABLE_IT (& TimMasterHandle , TIM_IT_CC2 );
44
-
36
+ void sleep (void ) {
37
+ // Stop HAL systick
38
+ HAL_SuspendTick ();
45
39
// Request to enter SLEEP mode
46
40
HAL_PWR_EnterSLEEPMode (PWR_MAINREGULATOR_ON , PWR_SLEEPENTRY_WFI );
47
-
48
- // Enable HAL tick interrupt
49
- __HAL_TIM_ENABLE_IT (& TimMasterHandle , TIM_IT_CC2 );
41
+ // Restart HAL systick
42
+ HAL_ResumeTick ();
50
43
}
51
44
52
45
void deepsleep (void )
You can’t perform that action at this time.
0 commit comments