Skip to content

Conversation

@PixelDust22
Copy link

@PixelDust22 PixelDust22 commented Nov 11, 2020

Certain functions in ESP-IDR (for example uart_driver_install ) asks for an uninitialized Queue pointer. This creates an additional method in Queue to creates an uninitialized queue so that they could be initialized by something else.

@rudib
Copy link
Member

rudib commented Nov 13, 2020

What else could then initialize this queue since the field member holding the pointer to the queue is private?

If this is really needed (and this goes for other FreeRTOS.rs wrappers as well), I'd much prefer to have a constructor API that mimics those from Rust's stdlib:

pub unsafe fn from_raw(ptr: FreeRtosQueueHandle) -> Result<Self, FreeRtosError> {
  // .,..
}

Optionally, this method could also do a sanity check by calling a peek or count method on the queue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants