File tree Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -67,10 +67,8 @@ uint32_t us_ticker_read() {
67
67
68
68
if (!us_ticker_inited ) us_ticker_init ();
69
69
70
- tim_it_update = 0 ; // Clear TIM_IT_UPDATE event flag
71
-
72
70
#if defined(TARGET_STM32L0 )
73
- volatile uint16_t cntH_old , cntH , cntL ;
71
+ uint16_t cntH_old , cntH , cntL ;
74
72
do {
75
73
// For some reason on L0xx series we need to read and clear the
76
74
// overflow flag which give extra time to propelry handle possible
@@ -83,25 +81,23 @@ uint32_t us_ticker_read() {
83
81
cntH_old += 1 ;
84
82
}
85
83
cntL = TIM_MST -> CNT ;
86
-
87
84
cntH = SlaveCounter ;
88
85
if (__HAL_TIM_GET_FLAG (& TimMasterHandle , TIM_FLAG_UPDATE ) == SET ) {
89
86
cntH += 1 ;
90
87
}
91
88
} while (cntH_old != cntH );
92
-
93
89
// Glue the upper and lower part together to get a 32 bit timer
94
- counter = (uint32_t )(cntH << 16 | cntL );
90
+ return (uint32_t )(cntH << 16 | cntL );
95
91
#else
92
+ tim_it_update = 0 ; // Clear TIM_IT_UPDATE event flag
96
93
counter = TIM_MST -> CNT + (uint32_t )(SlaveCounter << 16 ); // Calculate new time stamp
97
- #endif
98
-
99
94
if (tim_it_update == 1 ) {
100
95
return tim_it_counter ; // In case of TIM_IT_UPDATE return the time stamp that was calculated in timer_irq_handler()
101
96
}
102
97
else {
103
98
return counter ; // Otherwise return the time stamp calculated here
104
99
}
100
+ #endif
105
101
}
106
102
107
103
void us_ticker_set_interrupt (timestamp_t timestamp ) {
You can’t perform that action at this time.
0 commit comments