Skip to main content

WriteCanData

Struct WriteCanData 

Source
pub struct WriteCanData<'a> { /* private fields */ }
Expand description

Writer for appending data to a CAN-FD frame.

Implementations§

Source§

impl<'a> WriteCanData<'a>

Source

pub fn new(frame: &'a mut CanFdFrame) -> Self

Creates a new writer from a frame.

Source

pub fn from_parts(data: &'a mut [u8; 64], size: &'a mut u8) -> Self

Creates a writer from raw pointers (for compatibility).

Source

pub fn size(&self) -> u8

Returns the current size of written data.

Source

pub fn remaining(&self) -> usize

Returns the remaining capacity.

Source

pub fn write_u8(&mut self, value: u8)

Writes a single byte.

Source

pub fn write_i8(&mut self, value: i8)

Writes a signed byte.

Source

pub fn write_i16(&mut self, value: i16)

Writes a little-endian i16.

Source

pub fn write_i32(&mut self, value: i32)

Writes a little-endian i32.

Source

pub fn write_f32(&mut self, value: f32)

Writes a little-endian f32.

Source

pub fn write_bytes(&mut self, bytes: &[u8])

Writes raw bytes.

Source

pub fn write_varuint(&mut self, value: u32)

Writes a variable-length unsigned integer (varuint).

Source

pub fn write_int(&mut self, value: i32, res: Resolution)

Writes an integer value with the specified resolution.

Source

pub fn write_mapped(&mut self, value: f32, scaling: &Scaling, res: Resolution)

Writes a scaled value with the specified resolution and scaling.

Source

pub fn write_position(&mut self, value: f32, res: Resolution)

Writes a position value (revolutions).

Source

pub fn write_velocity(&mut self, value: f32, res: Resolution)

Writes a velocity value (revolutions/second).

Source

pub fn write_accel(&mut self, value: f32, res: Resolution)

Writes an acceleration value (revolutions/second^2).

Source

pub fn write_torque(&mut self, value: f32, res: Resolution)

Writes a torque value (Nm).

Source

pub fn write_pwm(&mut self, value: f32, res: Resolution)

Writes a PWM/normalized value (0-1).

Source

pub fn write_voltage(&mut self, value: f32, res: Resolution)

Writes a voltage value (V).

Source

pub fn write_temperature(&mut self, value: f32, res: Resolution)

Writes a temperature value (C).

Source

pub fn write_time(&mut self, value: f32, res: Resolution)

Writes a time value (seconds).

Source

pub fn write_current(&mut self, value: f32, res: Resolution)

Writes a current value (A).

Trait Implementations§

Source§

impl<'a> Debug for WriteCanData<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> !UnwindSafe for WriteCanData<'a>

§

impl<'a> Freeze for WriteCanData<'a>

§

impl<'a> RefUnwindSafe for WriteCanData<'a>

§

impl<'a> Send for WriteCanData<'a>

§

impl<'a> Sync for WriteCanData<'a>

§

impl<'a> Unpin for WriteCanData<'a>

§

impl<'a> UnsafeUnpin for WriteCanData<'a>

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.