File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed
Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,6 @@ use stm32f4xx_hal::rcc::Clocks;
66/// This uses TIM2 internally.
77pub struct MonoTimer < T , const FREQ : u32 > ( T ) ;
88
9-
109impl < const FREQ : u32 > MonoTimer < pac:: TIM2 , FREQ > {
1110 /// Initialize the timer instance.
1211 pub fn new ( timer : pac:: TIM2 , clocks : & Clocks ) -> Self {
@@ -25,7 +24,7 @@ impl<const FREQ: u32> MonoTimer<pac::TIM2, FREQ> {
2524 rcc. apb1rstr . modify ( |_, w| w. tim2rst ( ) . clear_bit ( ) ) ;
2625 }
2726
28- let prescaler = ( clocks. pclk1 ( ) . 0 /FREQ ) - 1 ;
27+ let prescaler = ( clocks. pclk1 ( ) . 0 / FREQ ) - 1 ;
2928 // Set up prescaler
3029 timer. psc . write ( |w| w. psc ( ) . bits ( prescaler as u16 ) ) ;
3130
@@ -42,11 +41,11 @@ impl<const FREQ: u32> MonoTimer<pac::TIM2, FREQ> {
4241impl < const FREQ : u32 > Monotonic for MonoTimer < pac:: TIM2 , FREQ > {
4342 type Instant = fugit:: TimerInstantU32 < FREQ > ;
4443 type Duration = fugit:: TimerDurationU32 < FREQ > ;
45-
44+
4645 unsafe fn reset ( & mut self ) {
4746 self . 0 . dier . modify ( |_, w| w. cc1ie ( ) . set_bit ( ) ) ;
4847 }
49-
48+
5049 #[ inline( always) ]
5150 fn now ( & mut self ) -> Self :: Instant {
5251 Self :: Instant :: from_ticks ( self . 0 . cnt . read ( ) . cnt ( ) . bits ( ) )
You can’t perform that action at this time.
0 commit comments