File tree Expand file tree Collapse file tree 17 files changed +232
-12
lines changed
cmsis/TARGET_STM/TARGET_STM32F4
TARGET_MTS_DRAGONFLY_F411RE
hal/TARGET_STM/TARGET_STM32F4 Expand file tree Collapse file tree 17 files changed +232
-12
lines changed Original file line number Diff line number Diff line change @@ -124,6 +124,21 @@ HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority) {
124
124
return HAL_OK ;
125
125
}
126
126
127
+ void HAL_SuspendTick (void )
128
+ {
129
+ TimMasterHandle .Instance = TIM_MST ;
130
+
131
+ // Disable HAL tick and us_ticker update interrupts (used for 32 bit counter)
132
+ __HAL_TIM_DISABLE_IT (& TimMasterHandle , TIM_IT_CC2 );
133
+ }
134
+
135
+ void HAL_ResumeTick (void )
136
+ {
137
+ TimMasterHandle .Instance = TIM_MST ;
138
+
139
+ // Enable HAL tick and us_ticker update interrupts (used for 32 bit counter)
140
+ __HAL_TIM_ENABLE_IT (& TimMasterHandle , TIM_IT_CC2 );
141
+ }
127
142
/**
128
143
* @}
129
144
*/
Original file line number Diff line number Diff line change @@ -109,6 +109,21 @@ HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority) {
109
109
return HAL_OK ;
110
110
}
111
111
112
+ void HAL_SuspendTick (void )
113
+ {
114
+ TimMasterHandle .Instance = TIM_MST ;
115
+
116
+ // Disable HAL tick and us_ticker update interrupts (used for 32 bit counter)
117
+ __HAL_TIM_DISABLE_IT (& TimMasterHandle , TIM_IT_CC2 );
118
+ }
119
+
120
+ void HAL_ResumeTick (void )
121
+ {
122
+ TimMasterHandle .Instance = TIM_MST ;
123
+
124
+ // Enable HAL tick and us_ticker update interrupts (used for 32 bit counter)
125
+ __HAL_TIM_ENABLE_IT (& TimMasterHandle , TIM_IT_CC2 );
126
+ }
112
127
/**
113
128
* @}
114
129
*/
Original file line number Diff line number Diff line change @@ -122,6 +122,21 @@ HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority) {
122
122
return HAL_OK ;
123
123
}
124
124
125
+ void HAL_SuspendTick (void )
126
+ {
127
+ TimMasterHandle .Instance = TIM_MST ;
128
+
129
+ // Disable HAL tick and us_ticker update interrupts (used for 32 bit counter)
130
+ __HAL_TIM_DISABLE_IT (& TimMasterHandle , TIM_IT_CC2 );
131
+ }
132
+
133
+ void HAL_ResumeTick (void )
134
+ {
135
+ TimMasterHandle .Instance = TIM_MST ;
136
+
137
+ // Enable HAL tick and us_ticker update interrupts (used for 32 bit counter)
138
+ __HAL_TIM_ENABLE_IT (& TimMasterHandle , TIM_IT_CC2 );
139
+ }
125
140
/**
126
141
* @}
127
142
*/
Original file line number Diff line number Diff line change 51
51
52
52
#define HAL_TICK_DELAY (1000) // 1 ms
53
53
54
+ void HAL_SuspendTick (void );
55
+
54
56
#ifdef __cplusplus
55
57
}
56
58
#endif
Original file line number Diff line number Diff line change @@ -110,6 +110,21 @@ HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority) {
110
110
return HAL_OK ;
111
111
}
112
112
113
+ void HAL_SuspendTick (void )
114
+ {
115
+ TimMasterHandle .Instance = TIM_MST ;
116
+
117
+ // Disable HAL tick and us_ticker update interrupts (used for 32 bit counter)
118
+ __HAL_TIM_DISABLE_IT (& TimMasterHandle , TIM_IT_CC2 );
119
+ }
120
+
121
+ void HAL_ResumeTick (void )
122
+ {
123
+ TimMasterHandle .Instance = TIM_MST ;
124
+
125
+ // Enable HAL tick and us_ticker update interrupts (used for 32 bit counter)
126
+ __HAL_TIM_ENABLE_IT (& TimMasterHandle , TIM_IT_CC2 );
127
+ }
113
128
/**
114
129
* @}
115
130
*/
Original file line number Diff line number Diff line change @@ -108,6 +108,21 @@ HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority) {
108
108
return HAL_OK ;
109
109
}
110
110
111
+ void HAL_SuspendTick (void )
112
+ {
113
+ TimMasterHandle .Instance = TIM_MST ;
114
+
115
+ // Disable HAL tick and us_ticker update interrupts (used for 32 bit counter)
116
+ __HAL_TIM_DISABLE_IT (& TimMasterHandle , TIM_IT_CC2 );
117
+ }
118
+
119
+ void HAL_ResumeTick (void )
120
+ {
121
+ TimMasterHandle .Instance = TIM_MST ;
122
+
123
+ // Enable HAL tick and us_ticker update interrupts (used for 32 bit counter)
124
+ __HAL_TIM_ENABLE_IT (& TimMasterHandle , TIM_IT_CC2 );
125
+ }
111
126
/**
112
127
* @}
113
128
*/
Original file line number Diff line number Diff line change @@ -108,6 +108,21 @@ HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority) {
108
108
return HAL_OK ;
109
109
}
110
110
111
+ void HAL_SuspendTick (void )
112
+ {
113
+ TimMasterHandle .Instance = TIM_MST ;
114
+
115
+ // Disable HAL tick and us_ticker update interrupts (used for 32 bit counter)
116
+ __HAL_TIM_DISABLE_IT (& TimMasterHandle , TIM_IT_CC2 );
117
+ }
118
+
119
+ void HAL_ResumeTick (void )
120
+ {
121
+ TimMasterHandle .Instance = TIM_MST ;
122
+
123
+ // Enable HAL tick and us_ticker update interrupts (used for 32 bit counter)
124
+ __HAL_TIM_ENABLE_IT (& TimMasterHandle , TIM_IT_CC2 );
125
+ }
111
126
/**
112
127
* @}
113
128
*/
Original file line number Diff line number Diff line change @@ -106,6 +106,21 @@ HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority) {
106
106
return HAL_OK ;
107
107
}
108
108
109
+ void HAL_SuspendTick (void )
110
+ {
111
+ TimMasterHandle .Instance = TIM_MST ;
112
+
113
+ // Disable HAL tick and us_ticker update interrupts (used for 32 bit counter)
114
+ __HAL_TIM_DISABLE_IT (& TimMasterHandle , TIM_IT_CC2 );
115
+ }
116
+
117
+ void HAL_ResumeTick (void )
118
+ {
119
+ TimMasterHandle .Instance = TIM_MST ;
120
+
121
+ // Enable HAL tick and us_ticker update interrupts (used for 32 bit counter)
122
+ __HAL_TIM_ENABLE_IT (& TimMasterHandle , TIM_IT_CC2 );
123
+ }
109
124
/**
110
125
* @}
111
126
*/
Original file line number Diff line number Diff line change @@ -108,6 +108,21 @@ HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority) {
108
108
return HAL_OK ;
109
109
}
110
110
111
+ void HAL_SuspendTick (void )
112
+ {
113
+ TimMasterHandle .Instance = TIM_MST ;
114
+
115
+ // Disable HAL tick and us_ticker update interrupts (used for 32 bit counter)
116
+ __HAL_TIM_DISABLE_IT (& TimMasterHandle , TIM_IT_CC2 );
117
+ }
118
+
119
+ void HAL_ResumeTick (void )
120
+ {
121
+ TimMasterHandle .Instance = TIM_MST ;
122
+
123
+ // Enable HAL tick and us_ticker update interrupts (used for 32 bit counter)
124
+ __HAL_TIM_ENABLE_IT (& TimMasterHandle , TIM_IT_CC2 );
125
+ }
111
126
/**
112
127
* @}
113
128
*/
Original file line number Diff line number Diff line change @@ -109,6 +109,21 @@ HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority) {
109
109
return HAL_OK ;
110
110
}
111
111
112
+ void HAL_SuspendTick (void )
113
+ {
114
+ TimMasterHandle .Instance = TIM_MST ;
115
+
116
+ // Disable HAL tick and us_ticker update interrupts (used for 32 bit counter)
117
+ __HAL_TIM_DISABLE_IT (& TimMasterHandle , TIM_IT_CC2 );
118
+ }
119
+
120
+ void HAL_ResumeTick (void )
121
+ {
122
+ TimMasterHandle .Instance = TIM_MST ;
123
+
124
+ // Enable HAL tick and us_ticker update interrupts (used for 32 bit counter)
125
+ __HAL_TIM_ENABLE_IT (& TimMasterHandle , TIM_IT_CC2 );
126
+ }
112
127
/**
113
128
* @}
114
129
*/
Original file line number Diff line number Diff line change @@ -108,6 +108,21 @@ HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority) {
108
108
return HAL_OK ;
109
109
}
110
110
111
+ void HAL_SuspendTick (void )
112
+ {
113
+ TimMasterHandle .Instance = TIM_MST ;
114
+
115
+ // Disable HAL tick and us_ticker update interrupts (used for 32 bit counter)
116
+ __HAL_TIM_DISABLE_IT (& TimMasterHandle , TIM_IT_CC2 );
117
+ }
118
+
119
+ void HAL_ResumeTick (void )
120
+ {
121
+ TimMasterHandle .Instance = TIM_MST ;
122
+
123
+ // Enable HAL tick and us_ticker update interrupts (used for 32 bit counter)
124
+ __HAL_TIM_ENABLE_IT (& TimMasterHandle , TIM_IT_CC2 );
125
+ }
111
126
/**
112
127
* @}
113
128
*/
Original file line number Diff line number Diff line change @@ -108,6 +108,21 @@ HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority) {
108
108
return HAL_OK ;
109
109
}
110
110
111
+ void HAL_SuspendTick (void )
112
+ {
113
+ TimMasterHandle .Instance = TIM_MST ;
114
+
115
+ // Disable HAL tick and us_ticker update interrupts (used for 32 bit counter)
116
+ __HAL_TIM_DISABLE_IT (& TimMasterHandle , TIM_IT_CC2 );
117
+ }
118
+
119
+ void HAL_ResumeTick (void )
120
+ {
121
+ TimMasterHandle .Instance = TIM_MST ;
122
+
123
+ // Enable HAL tick and us_ticker update interrupts (used for 32 bit counter)
124
+ __HAL_TIM_ENABLE_IT (& TimMasterHandle , TIM_IT_CC2 );
125
+ }
111
126
/**
112
127
* @}
113
128
*/
Original file line number Diff line number Diff line change @@ -122,6 +122,21 @@ HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority) {
122
122
return HAL_OK ;
123
123
}
124
124
125
+ void HAL_SuspendTick (void )
126
+ {
127
+ TimMasterHandle .Instance = TIM_MST ;
128
+
129
+ // Disable HAL tick and us_ticker update interrupts (used for 32 bit counter)
130
+ __HAL_TIM_DISABLE_IT (& TimMasterHandle , TIM_IT_CC2 );
131
+ }
132
+
133
+ void HAL_ResumeTick (void )
134
+ {
135
+ TimMasterHandle .Instance = TIM_MST ;
136
+
137
+ // Enable HAL tick and us_ticker update interrupts (used for 32 bit counter)
138
+ __HAL_TIM_ENABLE_IT (& TimMasterHandle , TIM_IT_CC2 );
139
+ }
125
140
/**
126
141
* @}
127
142
*/
Original file line number Diff line number Diff line change @@ -124,6 +124,21 @@ HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority) {
124
124
return HAL_OK ;
125
125
}
126
126
127
+ void HAL_SuspendTick (void )
128
+ {
129
+ TimMasterHandle .Instance = TIM_MST ;
130
+
131
+ // Disable HAL tick and us_ticker update interrupts (used for 32 bit counter)
132
+ __HAL_TIM_DISABLE_IT (& TimMasterHandle , TIM_IT_CC2 );
133
+ }
134
+
135
+ void HAL_ResumeTick (void )
136
+ {
137
+ TimMasterHandle .Instance = TIM_MST ;
138
+
139
+ // Enable HAL tick and us_ticker update interrupts (used for 32 bit counter)
140
+ __HAL_TIM_ENABLE_IT (& TimMasterHandle , TIM_IT_CC2 );
141
+ }
127
142
/**
128
143
* @}
129
144
*/
Original file line number Diff line number Diff line change @@ -110,6 +110,21 @@ HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority) {
110
110
return HAL_OK ;
111
111
}
112
112
113
+ void HAL_SuspendTick (void )
114
+ {
115
+ TimMasterHandle .Instance = TIM_MST ;
116
+
117
+ // Disable HAL tick and us_ticker update interrupts (used for 32 bit counter)
118
+ __HAL_TIM_DISABLE_IT (& TimMasterHandle , TIM_IT_CC2 );
119
+ }
120
+
121
+ void HAL_ResumeTick (void )
122
+ {
123
+ TimMasterHandle .Instance = TIM_MST ;
124
+
125
+ // Enable HAL tick and us_ticker update interrupts (used for 32 bit counter)
126
+ __HAL_TIM_ENABLE_IT (& TimMasterHandle , TIM_IT_CC2 );
127
+ }
113
128
/**
114
129
* @}
115
130
*/
Original file line number Diff line number Diff line change @@ -106,6 +106,21 @@ HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority) {
106
106
return HAL_OK ;
107
107
}
108
108
109
+ void HAL_SuspendTick (void )
110
+ {
111
+ TimMasterHandle .Instance = TIM_MST ;
112
+
113
+ // Disable HAL tick and us_ticker update interrupts (used for 32 bit counter)
114
+ __HAL_TIM_DISABLE_IT (& TimMasterHandle , TIM_IT_CC2 );
115
+ }
116
+
117
+ void HAL_ResumeTick (void )
118
+ {
119
+ TimMasterHandle .Instance = TIM_MST ;
120
+
121
+ // Enable HAL tick and us_ticker update interrupts (used for 32 bit counter)
122
+ __HAL_TIM_ENABLE_IT (& TimMasterHandle , TIM_IT_CC2 );
123
+ }
109
124
/**
110
125
* @}
111
126
*/
Original file line number Diff line number Diff line change 28
28
*******************************************************************************
29
29
*/
30
30
#include "sleep_api.h"
31
-
32
31
#if DEVICE_SLEEP
33
32
34
33
#include "cmsis.h"
35
34
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
35
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