File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,11 @@ pub trait HrTimer {
46
46
/// NOTE: This will affect the maximum duty usable for `HrCompareRegister::set_duty`
47
47
fn set_period ( & mut self , period : u16 ) ;
48
48
49
+ /// Get the current counter value
50
+ ///
51
+ /// NOTE: The least significant bits may not be significant depending on prescaler
52
+ fn get_counter_value ( & self ) -> u16 ;
53
+
49
54
/// Start timer
50
55
fn start ( & mut self , _hr_control : & mut HrPwmCtrl ) ;
51
56
@@ -143,6 +148,11 @@ macro_rules! hrtim_timer {
143
148
tim. perr( ) . write( |w| unsafe { w. per( ) . bits( period as u16 ) } ) ;
144
149
}
145
150
151
+ fn get_counter_value( & self ) -> u16 {
152
+ let tim = unsafe { & * $TIMX:: ptr( ) } ;
153
+ tim. cntr( ) . read( ) . cnt( ) . bits( )
154
+ }
155
+
146
156
/// Start timer
147
157
fn start( & mut self , _hr_control: & mut HrPwmCtrl ) {
148
158
// Start timer
You can’t perform that action at this time.
0 commit comments