ByteStructI16

Struct ByteStructI16 

Source
pub struct ByteStructI16<Interface: ?Sized, const COUNT: usize> { /* private fields */ }
Expand description

A Struct to map a number of 16bit integers to a number of consecutive registers

NOTE: Currently read only for now

Using the COUNT as part of the type should make it easier to mange the memory but I haven’t got it down yet. So you can currently only read for up to 10 integers.

Implementations§

Source§

impl<I, const COUNT: usize> ByteStructI16<I, COUNT>
where I: Interface + ?Sized,

Source

pub fn new( register_address: u8, big_endian: bool, ) -> Result<ByteStructI16<I, COUNT>, BitByteStructError<I::Error>>

Source

pub fn read( &self, bus: &mut dyn Interface<Error = I::Error>, ) -> Result<[i16; COUNT], BitByteStructError<I::Error>>

Read the values

WARNING this will go horribly wrong if COUNT > 10

Auto Trait Implementations§

§

impl<Interface, const COUNT: usize> Freeze for ByteStructI16<Interface, COUNT>
where Interface: ?Sized,

§

impl<Interface, const COUNT: usize> RefUnwindSafe for ByteStructI16<Interface, COUNT>
where Interface: RefUnwindSafe + ?Sized,

§

impl<Interface, const COUNT: usize> Send for ByteStructI16<Interface, COUNT>
where Interface: Send + ?Sized,

§

impl<Interface, const COUNT: usize> Sync for ByteStructI16<Interface, COUNT>
where Interface: Sync + ?Sized,

§

impl<Interface, const COUNT: usize> Unpin for ByteStructI16<Interface, COUNT>
where Interface: Unpin + ?Sized,

§

impl<Interface, const COUNT: usize> UnwindSafe for ByteStructI16<Interface, COUNT>
where Interface: UnwindSafe + ?Sized,

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.