@@ -44,6 +44,7 @@ volatile uint32_t tim_it_counter = 0; // Time stamp to be updated by timer_irq_h
44
44
45
45
void set_compare (uint16_t count )
46
46
{
47
+ TimMasterHandle .Instance = TIM_MST ;
47
48
// Set new output compare value
48
49
__HAL_TIM_SetCompare (& TimMasterHandle , TIM_CHANNEL_1 , count );
49
50
// Enable IT
@@ -64,6 +65,8 @@ uint32_t us_ticker_read()
64
65
{
65
66
uint32_t counter ;
66
67
68
+ TimMasterHandle .Instance = TIM_MST ;
69
+
67
70
if (!us_ticker_inited ) us_ticker_init ();
68
71
69
72
tim_it_update = 0 ; // Clear TIM_IT_UPDATE event flag
@@ -106,6 +109,7 @@ uint32_t us_ticker_read()
106
109
void us_ticker_set_interrupt (timestamp_t timestamp )
107
110
{
108
111
int delta = (int )((uint32_t )timestamp - us_ticker_read ());
112
+
109
113
uint16_t cval = TIM_MST -> CNT ;
110
114
111
115
if (delta <= 0 ) { // This event was in the past
@@ -125,11 +129,13 @@ void us_ticker_set_interrupt(timestamp_t timestamp)
125
129
126
130
void us_ticker_disable_interrupt (void )
127
131
{
132
+ TimMasterHandle .Instance = TIM_MST ;
128
133
__HAL_TIM_DISABLE_IT (& TimMasterHandle , TIM_IT_CC1 );
129
134
}
130
135
131
136
void us_ticker_clear_interrupt (void )
132
137
{
138
+ TimMasterHandle .Instance = TIM_MST ;
133
139
if (__HAL_TIM_GET_FLAG (& TimMasterHandle , TIM_FLAG_CC1 ) == SET ) {
134
140
__HAL_TIM_CLEAR_FLAG (& TimMasterHandle , TIM_FLAG_CC1 );
135
141
}
0 commit comments