From 9dd4c26c7cb82b5a1622de18cc29c65ebd57b6d7 Mon Sep 17 00:00:00 2001 From: Alexey Gerasev Date: Sun, 2 Jun 2024 08:50:39 +0700 Subject: [PATCH] Fix converting HPTW value to address (#70) --- freertos-rust/src/isr.rs | 7 +++++-- freertos-rust/src/task.rs | 2 +- freertos-rust/src/timers.rs | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/freertos-rust/src/isr.rs b/freertos-rust/src/isr.rs index 0bf3cbf..4a35268 100644 --- a/freertos-rust/src/isr.rs +++ b/freertos-rust/src/isr.rs @@ -17,8 +17,11 @@ impl InterruptContext { } } - pub fn get_task_field_mut(&self) -> FreeRtosBaseTypeMutPtr { - self.x_higher_priority_task_woken as *mut _ + pub fn get_task_field_mut(&mut self) -> FreeRtosBaseTypeMutPtr { + &mut self.x_higher_priority_task_woken as *mut _ + } + pub fn higher_priority_task_woken(&self) -> FreeRtosBaseType { + self.x_higher_priority_task_woken } } diff --git a/freertos-rust/src/task.rs b/freertos-rust/src/task.rs index 665218a..2adc075 100644 --- a/freertos-rust/src/task.rs +++ b/freertos-rust/src/task.rs @@ -241,7 +241,7 @@ impl Task { /// Notify this task from an interrupt. pub fn notify_from_isr( &self, - context: &InterruptContext, + context: &mut InterruptContext, notification: TaskNotification, ) -> Result<(), FreeRtosError> { unsafe { diff --git a/freertos-rust/src/timers.rs b/freertos-rust/src/timers.rs index e7d583f..fd0e7ae 100644 --- a/freertos-rust/src/timers.rs +++ b/freertos-rust/src/timers.rs @@ -157,7 +157,7 @@ impl Timer { } /// Start the timer from an interrupt. - pub fn start_from_isr(&self, context: &InterruptContext) -> Result<(), FreeRtosError> { + pub fn start_from_isr(&self, context: &mut InterruptContext) -> Result<(), FreeRtosError> { unsafe { if freertos_rs_timer_start_from_isr(self.handle, context.get_task_field_mut()) == 0 { Ok(())