pub struct DualExtendedFilter { /* private fields */ }
Expand description

NOTE: The dual extended id acceptance filters can only match “the first 16 bits of the 29-bit ID”.

Warning: This is not a perfect filter. Standard ids that match the bit layout of this filter will also be accepted.

Implementations§

source§

impl DualExtendedFilter

source

pub const fn new(ids: [&[u8; 16]; 2]) -> DualExtendedFilter

Create a filter that matches the first 16 bits of two 29-bit extended ids.

§Examples

A filter that matches ids with 4 bits either set or reset in the higher part of the id. For example this id matches: 0x000f000f, 0x000f000a, 0x0000000a, 0x0000000b. But it does not match: 0x000a000a

const FILTER: twai::filter::DualExtendedFilter =
    twai::filter::DualExtendedFilter::new([b"xxxxxxxxx0000xxx", b"xxxxxxxxx1111xxx"]);
source

pub fn new_from_code_mask( ids_code: [u16; 2], ids_mask: [u16; 2] ) -> DualExtendedFilter

Create a new filter matching the first 16 bits of two 29-bit ids.

The masks indicate which bits of the code the filter should match against. Set bits in the mask indicate that the corresponding bit in the code should match.

Trait Implementations§

source§

impl Filter for DualExtendedFilter

source§

const FILTER_TYPE: FilterType = FilterType::Dual

The type of the filter.
source§

fn to_registers(&self) -> [u8; 8]

Get the register level representation of the filter.
source§

fn filter_type(&self) -> FilterType

Auto Trait Implementations§

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>,

§

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>,

§

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.