[][src]Trait n2k::hal::can::Filter

pub trait Filter {
    fn accept_all() -> Self;
fn new_standard(id: u32) -> Self;
fn new_extended(id: u32) -> Self;
fn with_mask(&mut self, mask: u32) -> &mut Self;
fn allow_remote(&mut self) -> &mut Self;
fn remote_only(&mut self) -> &mut Self; }

CAN filter interface

Required methods

fn accept_all() -> Self

Creates a filter that accepts all frames.

fn new_standard(id: u32) -> Self

Creates a filter that accepts frames with the specified standard identifier.

fn new_extended(id: u32) -> Self

Creates a filter that accepts frames with the extended standard identifier.

fn with_mask(&mut self, mask: u32) -> &mut Self

Applies a mask to the filter.

A filter matches when: <ReceiveID> & Mask == FilterID & Mask

Example

FilterID: 0b100110111 Mask: 0b000001111

ReceiveID: 0b100110011 ----> Not accepted (3rd bit did not match)

ReceiveID: 0b000000111 -> accepted

fn allow_remote(&mut self) -> &mut Self

Makes the filter acccept both data and remote frames.

Clears the RTR bit in the filter mask. Only available for filters with RtrFilterBehavior::Configurable.

fn remote_only(&mut self) -> &mut Self

Makes the filter acccept remote frames only.

Sets the RTR bit in both the filter and the mask (if available). Only available for filters with RtrFilterBehavior::Configurable or RtrFilterBehavior::ConfigurableEitherDataOrRemote.

Loading content...

Implementors

Loading content...