pub struct DualStandardFilter { /* private fields */ }Expand description
A filter that matches against two standard 11-bit standard IDs.
The first filter part can match a packet’s id, RTR bit, and the first byte of the payload. The second filter part can match a packet’s id and RTR bit.
Warning: This is not a perfect filter. Extended IDs that match the bit layout of this filter will also be accepted.
Implementations§
Source§impl DualStandardFilter
impl DualStandardFilter
Sourcepub const fn new(
first_id: &BitFilter<11>,
first_rtr: &BitFilter<1>,
first_payload: &BitFilter<8>,
second_id: &BitFilter<11>,
second_rtr: &BitFilter<1>,
) -> Self
pub const fn new( first_id: &BitFilter<11>, first_rtr: &BitFilter<1>, first_payload: &BitFilter<8>, second_id: &BitFilter<11>, second_rtr: &BitFilter<1>, ) -> Self
Create a filter that matches against two standard 11-bit standard IDs.
The first filter part can match a packet’s id, RTR bit, and the first byte of the payload. The second filter part can match a packet’s id and RTR bit.
§Examples
A filter that matches any standard id that ends with a 00 or a 11, with any RTR, and with any payload on the first filter.
const FILTER: twai::filter::DualStandardFilter = twai::filter::DualStandardFilter::new(
b"xxxxxxxxx00",
b"x",
b"xxxxxxxx",
b"xxxxxxxxx11",
b"x",
);Sourcepub fn new_from_code_mask(
first_id_code: StandardId,
first_id_mask: StandardId,
first_rtr_code: bool,
first_rtr_mask: bool,
first_payload_code: u8,
first_payload_mask: u8,
second_id_code: StandardId,
second_id_mask: StandardId,
second_rtr_code: bool,
second_rtr_mask: bool,
) -> Self
pub fn new_from_code_mask( first_id_code: StandardId, first_id_mask: StandardId, first_rtr_code: bool, first_rtr_mask: bool, first_payload_code: u8, first_payload_mask: u8, second_id_code: StandardId, second_id_mask: StandardId, second_rtr_code: bool, second_rtr_mask: bool, ) -> Self
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 DualStandardFilter
Available on crate feature unstable only.
impl Filter for DualStandardFilter
unstable only.