Skip to content

Commit

Permalink
Add function to get Queue from raw handle.
Browse files Browse the repository at this point in the history
  • Loading branch information
reitermarkus authored and niondir committed Sep 16, 2022
1 parent 815e9bb commit 7d5bcef
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions freertos-rust/src/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ impl<T: Sized + Copy> Queue<T> {
})
}

#[inline]
pub unsafe fn from_raw_handle(handle: FreeRtosQueueHandle) -> Self {
Self {
queue: handle,
item_type: PhantomData,
}
}

/// Send an item to the end of the queue. Wait for the queue to have empty space for it.
pub fn send<D: DurationTicks>(&self, item: T, max_wait: D) -> Result<(), FreeRtosError> {
unsafe {
Expand Down

0 comments on commit 7d5bcef

Please sign in to comment.