pub struct Bmi088Source<SPI, ACC, GYR, D> { /* private fields */ }Expand description
Copper source task for the BMI088 IMU.
This task reads accelerometer and gyroscope data from the BMI088 and outputs
an ImuPayload with measurements in SI units (m/s² for acceleration,
rad/s for angular velocity, °C for temperature).
§Type Parameters
SPI: SPI bus type implementingembedded_hal::blocking::spi::Transfer<u8>ACC: Accelerometer chip-select GPIO implementingOutputPinGYR: Gyroscope chip-select GPIO implementingOutputPinD: Delay provider implementingDelayMs<u32>
Trait Implementations§
Source§impl<SPI, ACC, GYR, D> CuSrcTask for Bmi088Source<SPI, ACC, GYR, D>
impl<SPI, ACC, GYR, D> CuSrcTask for Bmi088Source<SPI, ACC, GYR, D>
type Output<'m> = CuStampedData<ImuPayload, CuMsgMetadata>
Source§fn new(
_config: Option<&ComponentConfig>,
resources: Self::Resources<'_>,
) -> CuResult<Self>where
Self: Sized,
fn new(
_config: Option<&ComponentConfig>,
resources: Self::Resources<'_>,
) -> CuResult<Self>where
Self: Sized,
Here you need to initialize everything your task will need for the duration of its lifetime.
The config allows you to access the configuration of the task.
Source§fn start(&mut self, _ctx: &CuContext) -> CuResult<()>
fn start(&mut self, _ctx: &CuContext) -> CuResult<()>
Start is called between the creation of the task and the first call to pre/process.
Source§fn process<'o>(
&mut self,
ctx: &CuContext,
output: &mut Self::Output<'o>,
) -> CuResult<()>
fn process<'o>( &mut self, ctx: &CuContext, output: &mut Self::Output<'o>, ) -> CuResult<()>
Process is the most critical execution of the task.
The goal will be to produce the output message as soon as possible.
Use preprocess to prepare the task to make this method as short as possible.
Source§fn preprocess(&mut self, _ctx: &CuContext) -> Result<(), CuError>
fn preprocess(&mut self, _ctx: &CuContext) -> Result<(), CuError>
This is a method called by the runtime before “process”. This is a kind of best effort,
as soon as possible call to give a chance for the task to do some work before to prepare
to make “process” as short as possible.
Source§fn postprocess(&mut self, _ctx: &CuContext) -> Result<(), CuError>
fn postprocess(&mut self, _ctx: &CuContext) -> Result<(), CuError>
This is a method called by the runtime after “process”. It is best effort a chance for
the task to update some state after process is out of the way.
It can be use for example to maintain statistics etc. that are not time-critical for the robot.
Source§impl<SPI, ACC, GYR, D> Freezable for Bmi088Source<SPI, ACC, GYR, D>
impl<SPI, ACC, GYR, D> Freezable for Bmi088Source<SPI, ACC, GYR, D>
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<SPI, ACC, GYR, D> TypePath for Bmi088Source<SPI, ACC, GYR, D>where
SPI: 'static,
ACC: 'static,
GYR: 'static,
D: 'static,
impl<SPI, ACC, GYR, D> TypePath for Bmi088Source<SPI, ACC, GYR, D>where
SPI: 'static,
ACC: 'static,
GYR: 'static,
D: 'static,
Auto Trait Implementations§
impl<SPI, ACC, GYR, D> Freeze for Bmi088Source<SPI, ACC, GYR, D>
impl<SPI, ACC, GYR, D> RefUnwindSafe for Bmi088Source<SPI, ACC, GYR, D>
impl<SPI, ACC, GYR, D> Send for Bmi088Source<SPI, ACC, GYR, D>
impl<SPI, ACC, GYR, D> Sync for Bmi088Source<SPI, ACC, GYR, D>
impl<SPI, ACC, GYR, D> Unpin for Bmi088Source<SPI, ACC, GYR, D>
impl<SPI, ACC, GYR, D> UnsafeUnpin for Bmi088Source<SPI, ACC, GYR, D>
impl<SPI, ACC, GYR, D> UnwindSafe for Bmi088Source<SPI, ACC, GYR, D>
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