@@ -134,23 +134,6 @@ macro_rules! hal {
134
134
self . lptim. cr. modify( |_, w| w. cntstrt( ) . set_bit( ) ) ;
135
135
}
136
136
137
- /// Set auto reload register
138
- /// has to be used _after_ enabling of lptim
139
- #[ inline( always) ]
140
- fn set_arr( & mut self , arr_value: u16 ) {
141
- // clear autoreload register OK interrupt flag
142
- self . lptim. icr. write( |w| w. arrokcf( ) . set_bit( ) ) ;
143
-
144
- // Write autoreload value
145
- // This operation is sound as arr_value is a u16, and there are 16 writeable bits
146
- self . lptim
147
- . arr
148
- . write( |w| unsafe { w. bits( arr_value as u32 ) } ) ;
149
-
150
- // wait for autoreload write ok interrupt to be signalled (RM0394 Rev 4, sec. 30.7.1, Bit 4)
151
- while self . lptim. isr. read( ) . arrok( ) . bit_is_clear( ) { }
152
- }
153
-
154
137
/// Consume the LPTIM and produce a LowPowerTimer that encapsulates
155
138
/// said LPTIM.
156
139
///
@@ -219,7 +202,7 @@ macro_rules! hal {
219
202
instance. enable( ) ;
220
203
221
204
instance. start_continuous_mode( ) ;
222
- instance. set_arr ( arr_value) ;
205
+ instance. set_autoreload ( arr_value) ;
223
206
instance. set_compare_match( compare_value) ;
224
207
instance
225
208
}
@@ -284,6 +267,23 @@ macro_rules! hal {
284
267
while self . lptim. isr. read( ) . cmpok( ) . bit_is_clear( ) { }
285
268
}
286
269
270
+ /// Set auto reload register
271
+ /// has to be used _after_ enabling of lptim
272
+ #[ inline( always) ]
273
+ pub fn set_autoreload( & mut self , arr_value: u16 ) {
274
+ // clear autoreload register OK interrupt flag
275
+ self . lptim. icr. write( |w| w. arrokcf( ) . set_bit( ) ) ;
276
+
277
+ // Write autoreload value
278
+ // This operation is sound as arr_value is a u16, and there are 16 writeable bits
279
+ self . lptim
280
+ . arr
281
+ . write( |w| unsafe { w. bits( arr_value as u32 ) } ) ;
282
+
283
+ // wait for autoreload write ok interrupt to be signalled (RM0394 Rev 4, sec. 30.7.1, Bit 4)
284
+ while self . lptim. isr. read( ) . arrok( ) . bit_is_clear( ) { }
285
+ }
286
+
287
287
/// Get the current counter value for this LowPowerTimer
288
288
#[ inline]
289
289
pub fn get_counter( & self ) -> u16 {
0 commit comments