Skip to content

Commit a14c520

Browse files
committed
PR comments
1 parent a73e28e commit a14c520

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/can.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,15 +130,19 @@ impl embedded_hal_can::Frame for CanFrame {
130130
impl embedded_hal_can::Filter for CanFilter {
131131
type Id = CanId;
132132

133+
/// Construct a filter which filters messages for a specific identified
133134
fn from_id(id: Self::Id) -> Self {
134135
CanFilter::new(CanFilterData::IdFilter(id))
135136
}
136137

138+
/// Construct an "empty" filter which will accept all messages
137139
fn accept_all() -> Self {
138140
CanFilter::new(CanFilterData::AcceptAll)
139141
}
140142

141143
// TODO: Constructing filters like this is fairly limiting because ideally we would have the full "filter state" available, so for non-extended filters this could be 2 masks and filters or 4 ids for id lists
144+
145+
/// Constuct a mask filter. This method accepts two parameters, the mask which designates which bits are actually matched againts and the filter, with the actual bits to match.
142146
fn from_mask(mask: u32, filter: u32) -> Self {
143147
assert!(
144148
mask < MAX_EXTENDED_ID,
@@ -417,6 +421,7 @@ impl Receiver for CanFifo {
417421
Err(nb::Error::WouldBlock)
418422
}
419423

424+
/// Sets a filter in the next open filter register.
420425
fn set_filter(&mut self, filter: Self::Filter) {
421426
cortex_m::interrupt::free(|_cs| {
422427
let can = unsafe { &*stm32::CAN::ptr() };

0 commit comments

Comments
 (0)