Struct EsbBuffer

Source
pub struct EsbBuffer<const OUT: usize, const IN: usize> {
    pub app_to_radio_buf: Texas<OUT, MaiNotSpsc>,
    pub radio_to_app_buf: Texas<IN, MaiNotSpsc>,
    pub timer_flag: AtomicBool,
}
Expand description

This is the backing structure for the ESB interface

It is intended to live at 'static scope, and provides storage for the EsbApp and EsbIrq interfaces

§Creating at static scope

Currently due to lacking const generics, the UX for this isn’t great. You’ll probably want something like this:

§NOTE

Although the members of this struct are public, due to const generic limitations, they are not intended to be used directly, outside of static creation.

This could cause unintended, though not undefined, behavior.

TL;DR: It’s not unsafe, but it’s also not going to work correctly.

// This creates an ESB storage structure with room for
// 512 bytes of outgoing packets (including headers),
// and 256 bytes of incoming packets (including
// headers).
static BUFFER: EsbBuffer<U512, U256> = EsbBuffer {
    app_to_radio_buf: BBBuffer( ConstBBBuffer::new() ),
    radio_to_app_buf: BBBuffer( ConstBBBuffer::new() ),
    timer_flag: AtomicBool::new(false),
};

Fields§

§app_to_radio_buf: Texas<OUT, MaiNotSpsc>§radio_to_app_buf: Texas<IN, MaiNotSpsc>§timer_flag: AtomicBool

Implementations§

Source§

impl<const OUT: usize, const IN: usize> EsbBuffer<OUT, IN>

Source

pub fn try_split<T: EsbTimer>( &'static self, timer: T, radio: Radio, addresses: Addresses, config: Config, ) -> Result<(EsbApp<OUT, IN>, EsbIrq<OUT, IN, T, Disabled>, IrqTimer<T>), Error>

Attempt to split the static buffer into handles for Interrupt and App context

This function will only succeed once. If the underlying buffers have also been split directly, this function will also fail.

Upon splitting, the Radio will be initialized and set to IdleTx.

Auto Trait Implementations§

§

impl<const OUT: usize, const IN: usize> !Freeze for EsbBuffer<OUT, IN>

§

impl<const OUT: usize, const IN: usize> !RefUnwindSafe for EsbBuffer<OUT, IN>

§

impl<const OUT: usize, const IN: usize> Send for EsbBuffer<OUT, IN>

§

impl<const OUT: usize, const IN: usize> Sync for EsbBuffer<OUT, IN>

§

impl<const OUT: usize, const IN: usize> Unpin for EsbBuffer<OUT, IN>

§

impl<const OUT: usize, const IN: usize> UnwindSafe for EsbBuffer<OUT, IN>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.