File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -33,10 +33,11 @@ pub enum PreScaler {
33
33
/// Count modes that are available.
34
34
///
35
35
/// All ClockSources currently supported require the Internal count mode
36
+ #[ derive( PartialEq ) ]
36
37
pub enum CountMode {
37
38
/// Use an internal clock source (which also includes LSE)
38
- Internal = 0b0 ,
39
- // External = 0b1 ,
39
+ Internal ,
40
+ // External,
40
41
}
41
42
42
43
/// All currently supported interrupt events
@@ -184,7 +185,7 @@ macro_rules! hal {
184
185
w. enc( )
185
186
. clear_bit( )
186
187
. countmode( )
187
- . bit( count_mode as u8 > 0 )
188
+ . bit( count_mode != CountMode :: Internal )
188
189
. presc( )
189
190
. bits( prescaler as u8 )
190
191
. cksel( )
@@ -255,19 +256,22 @@ macro_rules! hal {
255
256
}
256
257
257
258
/// Set the compare match field for this LPTIM
259
+ #[ inline]
258
260
pub fn set_compare_match( & mut self , value: u16 ) {
259
261
// This operation is sound as compare_value is a u16, and there are 16 writeable bits
260
262
// Additionally, the LPTIM peripheral will always be in the enabled state when this code is called
261
263
self . lptim. cmp. write( |w| unsafe { w. bits( value as u32 ) } ) ;
262
264
}
263
265
264
266
/// Get the current counter value for this LPTIM
267
+ #[ inline]
265
268
pub fn get_counter( & mut self ) -> u16 {
266
269
self . lptim. cnt. read( ) . bits( ) as u16
267
270
}
268
271
269
272
/// Get the value of the LPTIM_ARR register for this
270
273
/// LPTIM
274
+ #[ inline]
271
275
pub fn get_arr( & mut self ) -> u16 {
272
276
self . lptim. arr. read( ) . bits( ) as u16
273
277
}
You can’t perform that action at this time.
0 commit comments