bbqueue icon indicating copy to clipboard operation
bbqueue copied to clipboard

Better examples/docs

Open jamesmunns opened this issue 4 years ago • 5 comments

We should have more complete examples for common use cases, including (at least):

  • How to use with RTFM
  • How to use in bare metal

CC #54 / @justacec

jamesmunns avatar Apr 12 '20 12:04 jamesmunns

In particular, we should show:

  1. How to declare a BBBuffer at static scope
  2. How to store the Consumer/Producer in RTFM's Resources, or something like cmim's Move container
  3. How to store a GrantR/GrantW in an Option<GrantX<'static, U32>> with RTFM's Resources or something like cmim's Move container

jamesmunns avatar Apr 12 '20 12:04 jamesmunns

As a side question; would also be nice to see some examples/docs on how to use this for not just basic bytes, but storing stuff like structs

maraisr avatar May 09 '20 12:05 maraisr

As a newish Rust programmer, the current example's line static BB: BBBuffer<U6> = BBBuffer( ConstBBBuffer::new() ); was a bit confusing due to the implicit use of generic-array.

ianrrees avatar Nov 12 '20 01:11 ianrrees

@ianrrees I also found the same thing

ost-ing avatar Jan 26 '21 16:01 ost-ing

As a note @maraisr, I don't plan to have BBQueue support non-byte (e.g. arrays of u8s) data. It does not currently manage things like alignment, so it wouldn't work as a general purpose struct storage item. You could use it with something like serde or postcard if you need to send things across the wire.

In the future, I will be removing the Generic Array usage, you can take a peek at the next generation docs if you want to see what that will look like!

This "next gen" branch will be merged when min_const_generics lands in the next release or two.

jamesmunns avatar Jan 26 '21 16:01 jamesmunns