File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -4,13 +4,15 @@ use crate::{
44use std:: sync:: { Arc , Mutex } ;
55
66
7+
8+ pub trait TimerCallback {
9+ fn call ( time_since_last_callback_ns : i64 ) ;
10+ }
11+
712#[ derive( Debug ) ]
813pub struct Timer {
914 rcl_timer : Arc < Mutex < rcl_timer_t > > ,
10- }
11-
12- unsafe extern "C" fn timer_callback ( _: * mut rcl_timer_t , time_since_last_callback_ns : i64 ) {
13- println ! ( "timer_callback, time_since_last_callback_ns {0}" , time_since_last_callback_ns) ;
15+ // callback: Option<T>,
1416}
1517
1618impl Timer {
@@ -22,7 +24,7 @@ impl Timer {
2224 let allocator = rcutils_get_default_allocator ( ) ;
2325 let mut rcl_clock = clock. rcl_clock . lock ( ) . unwrap ( ) ;
2426 let mut rcl_context = context. handle . rcl_context . lock ( ) . unwrap ( ) ;
25- let callback: rcl_timer_callback_t = Some ( timer_callback ) ;
27+ let callback: rcl_timer_callback_t = None ;
2628 // Function will return Err(_) only if there isn't enough memory to allocate a clock
2729 // object.
2830 rcl_timer_init (
@@ -36,7 +38,8 @@ impl Timer {
3638 } ;
3739 to_rclrs_result ( timer_init_result) . map ( |_| {
3840 Timer {
39- rcl_timer : Arc :: new ( Mutex :: new ( rcl_timer) )
41+ rcl_timer : Arc :: new ( Mutex :: new ( rcl_timer) ) ,
42+ // callback: None
4043 }
4144 } )
4245 }
You can’t perform that action at this time.
0 commit comments