Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/timers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ impl Timer {
unsafe fn spawn_inner<'a>(name: &str,
period_ticks: FreeRtosTickType,
auto_reload: bool,
callback: Box<Fn(Timer) + Send + 'a>,)
callback: Box<dyn Fn(Timer) + Send + 'a>,)
-> Result<Timer, FreeRtosError> {
let f = Box::new(callback);
let param_ptr = &*f as *const _ as *mut _;
Expand Down Expand Up @@ -105,7 +105,7 @@ impl Timer {
detached: true
};
if let Ok(callback_ptr) = timer.get_id() {
let b = Box::from_raw(callback_ptr as *mut Box<Fn(Timer)>);
let b = Box::from_raw(callback_ptr as *mut Box<dyn Fn(Timer)>);
b(timer);
Box::into_raw(b);
}
Expand Down Expand Up @@ -188,7 +188,7 @@ impl Drop for Timer {
unsafe {
if let Ok(callback_ptr) = self.get_id() {
// free the memory
Box::from_raw(callback_ptr as *mut Box<Fn(Timer)>);
Box::from_raw(callback_ptr as *mut Box<dyn Fn(Timer)>);
}

// todo: configurable timeout?
Expand Down