File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -138,7 +138,7 @@ macro_rules! hal {
138
138
/// has to be used _after_ enabling of lptim
139
139
#[ inline( always) ]
140
140
fn set_arr( & mut self , arr_value: u16 ) {
141
- // clear autoreload register OK interrupf flag
141
+ // clear autoreload register OK interrupt flag
142
142
self . lptim. icr. write( |w| w. arrokcf( ) . set_bit( ) ) ;
143
143
144
144
// Write autoreload value
@@ -273,9 +273,15 @@ macro_rules! hal {
273
273
/// Set the compare match field for this LowPowerTimer
274
274
#[ inline]
275
275
pub fn set_compare_match( & mut self , value: u16 ) {
276
+ // clear compare register update ok flag
277
+ self . lptim. icr. write( |w| w. cmpokcf( ) . set_bit( ) ) ;
278
+
276
279
// This operation is sound as compare_value is a u16, and there are 16 writeable bits
277
280
// Additionally, the LPTIM peripheral will always be in the enabled state when this code is called
278
281
self . lptim. cmp. write( |w| unsafe { w. bits( value as u32 ) } ) ;
282
+
283
+ // wait for compare register update ok interrupt to be signalled (RM0394 Rev 4, sec. 30.7.1, Bit 4)
284
+ while self . lptim. isr. read( ) . cmpok( ) . bit_is_clear( ) { }
279
285
}
280
286
281
287
/// Get the current counter value for this LowPowerTimer
You can’t perform that action at this time.
0 commit comments