Skip to content

Commit

Permalink
Fix task_handle type mismatch on task spawn (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
agerasev committed Mar 22, 2023
1 parent 21bf3be commit 657a844
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
1 change: 0 additions & 1 deletion freertos-rust/src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ pub type FreeRtosTickType = u32;
pub type FreeRtosBaseTypeMutPtr = *mut FreeRtosBaseType;

pub type FreeRtosTaskHandle = *const CVoid;
pub type FreeRtosMutTaskHandle = *mut CVoid;
pub type FreeRtosQueueHandle = *const CVoid;
pub type FreeRtosSemaphoreHandle = *const CVoid;
pub type FreeRtosTaskFunction = *const CVoid;
Expand Down
2 changes: 1 addition & 1 deletion freertos-rust/src/shim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ extern "C" {
name_len: u8,
stack_size: u16,
priority: FreeRtosUBaseType,
task_handle: FreeRtosMutTaskHandle,
task_handle: *mut FreeRtosTaskHandle,
) -> FreeRtosUBaseType;
pub fn freertos_rs_delete_task(task: FreeRtosTaskHandle);
pub fn freertos_rs_suspend_task(task: FreeRtosTaskHandle);
Expand Down
6 changes: 2 additions & 4 deletions freertos-rust/src/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ impl Task {
let (success, task_handle) = {
let name = name.as_bytes();
let name_len = name.len();
let mut task_handle = mem::zeroed::<CVoid>();
let mut task_handle = core::ptr::null();

let ret = freertos_rs_spawn_task(
thread_start,
Expand Down Expand Up @@ -174,9 +174,7 @@ impl Task {
panic!("Not allowed to quit the task!");
}

Ok(Task {
task_handle: task_handle as usize as *const _,
})
Ok(Task { task_handle })
}

fn spawn<F>(
Expand Down

0 comments on commit 657a844

Please sign in to comment.