pub struct CrsfBridge<S, E>{ /* private fields */ }Expand description
Crossfire bridge for Copper-rs.
Trait Implementations§
Source§impl<S, E> CuBridge for CrsfBridge<S, E>
impl<S, E> CuBridge for CrsfBridge<S, E>
Source§type Tx = TxChannels
type Tx = TxChannels
Outgoing channels (Copper -> external world).
Source§type Rx = RxChannels
type Rx = RxChannels
Incoming channels (external world -> Copper).
Source§fn new(
config: Option<&ComponentConfig>,
tx_channels: &[BridgeChannelConfig<<Self::Tx as BridgeChannelSet>::Id>],
rx_channels: &[BridgeChannelConfig<<Self::Rx as BridgeChannelSet>::Id>],
resources: Self::Resources<'_>,
) -> CuResult<Self>where
Self: Sized,
fn new(
config: Option<&ComponentConfig>,
tx_channels: &[BridgeChannelConfig<<Self::Tx as BridgeChannelSet>::Id>],
rx_channels: &[BridgeChannelConfig<<Self::Rx as BridgeChannelSet>::Id>],
resources: Self::Resources<'_>,
) -> CuResult<Self>where
Self: Sized,
Constructs a new bridge. Read more
Source§fn send<'a, Payload>(
&mut self,
_clock: &RobotClock,
channel: &'static BridgeChannel<<Self::Tx as BridgeChannelSet>::Id, Payload>,
msg: &CuMsg<Payload>,
) -> CuResult<()>where
Payload: CuMsgPayload + 'a,
fn send<'a, Payload>(
&mut self,
_clock: &RobotClock,
channel: &'static BridgeChannel<<Self::Tx as BridgeChannelSet>::Id, Payload>,
msg: &CuMsg<Payload>,
) -> CuResult<()>where
Payload: CuMsgPayload + 'a,
Sends a message on the selected outbound channel.
Source§fn receive<'a, Payload>(
&mut self,
clock: &RobotClock,
channel: &'static BridgeChannel<<Self::Rx as BridgeChannelSet>::Id, Payload>,
msg: &mut CuMsg<Payload>,
) -> CuResult<()>where
Payload: CuMsgPayload + 'a,
fn receive<'a, Payload>(
&mut self,
clock: &RobotClock,
channel: &'static BridgeChannel<<Self::Rx as BridgeChannelSet>::Id, Payload>,
msg: &mut CuMsg<Payload>,
) -> CuResult<()>where
Payload: CuMsgPayload + 'a,
Receives a message from the selected inbound channel. Read more
Source§fn start(&mut self, _clock: &RobotClock) -> Result<(), CuError>
fn start(&mut self, _clock: &RobotClock) -> Result<(), CuError>
Called before the first send/receive cycle.
Source§fn preprocess(&mut self, _clock: &RobotClock) -> Result<(), CuError>
fn preprocess(&mut self, _clock: &RobotClock) -> Result<(), CuError>
Gives the bridge a chance to prepare buffers before I/O.
Source§fn postprocess(&mut self, _clock: &RobotClock) -> Result<(), CuError>
fn postprocess(&mut self, _clock: &RobotClock) -> Result<(), CuError>
Called once the send/receive pair completed.
Source§impl<S, E> Freezable for CrsfBridge<S, E>
impl<S, E> Freezable for CrsfBridge<S, E>
Source§fn freeze<E>(&self, encoder: &mut E) -> Result<(), EncodeError>where
E: Encoder,
fn freeze<E>(&self, encoder: &mut E) -> Result<(), EncodeError>where
E: Encoder,
This method is called by the framework when it wants to save the task state.
The default implementation is to encode nothing (stateless).
If you have a state, you need to implement this method.
Source§fn thaw<D>(&mut self, _decoder: &mut D) -> Result<(), DecodeError>where
D: Decoder,
fn thaw<D>(&mut self, _decoder: &mut D) -> Result<(), DecodeError>where
D: Decoder,
This method is called by the framework when it wants to restore the task to a specific state.
Here it is similar to Decode but the framework will give you a new instance of the task (the new method will be called)
Source§impl<S, E> TypePath for CrsfBridge<S, E>
impl<S, E> TypePath for CrsfBridge<S, E>
Auto Trait Implementations§
impl<S, E> Freeze for CrsfBridge<S, E>where
S: Freeze,
impl<S, E> RefUnwindSafe for CrsfBridge<S, E>where
S: RefUnwindSafe,
impl<S, E> Send for CrsfBridge<S, E>
impl<S, E> Sync for CrsfBridge<S, E>
impl<S, E> Unpin for CrsfBridge<S, E>where
S: Unpin,
impl<S, E> UnsafeUnpin for CrsfBridge<S, E>where
S: UnsafeUnpin,
impl<S, E> UnwindSafe for CrsfBridge<S, E>where
S: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more