You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// A CAN identifier, which can be either 11 or 27 (extended) bits. u16 and u32 respectively are used here despite the fact that the upper bits are unused.
15
17
#[derive(Debug,Copy,Clone,Eq,PartialEq)]
16
18
pubenumCanId{
17
19
BaseId(u16),
18
20
ExtendedId(u32),
19
21
}
20
22
23
+
/// A CAN frame consisting of a destination ID and up to 8 bytes of data.
24
+
///
25
+
/// Currently, we always allocate a fixed size array for each frame regardless of actual size, but this could be improved in the future using const-generics.
21
26
#[derive(Debug,Clone,Eq,PartialEq)]
22
27
pubstructCanFrame{
23
28
pubid:CanId,
24
29
pubdata:Vec<u8,U8>,
25
30
}
26
31
32
+
/// Represents the operating mode of a CAN filter, which can either contain a list of identifiers, or a mask to match on.
27
33
pubenumFilterMode{
28
34
Mask,
29
35
List,
30
36
}
31
37
38
+
/// A fully specified CAN filter with its associated list of of IDs or mask.
32
39
#[derive(Copy,Clone,Debug,Eq,PartialEq)]
33
40
pubenumCanFilterData{
34
41
IdFilter(CanId),
@@ -51,16 +58,19 @@ pub struct Can {
51
58
_tx: gpioa::PA12<AF9>,
52
59
}
53
60
61
+
/// A CAN FIFO which is used to receive and buffer messages from the CAN network that match on of the assigned filters.
54
62
pubstructCanFifo{
55
63
idx:usize,
56
64
}
57
65
66
+
/// A CAN transmitter which is used to send messages to the CAN network.
58
67
pubstructCanTransmitter{
59
68
_can: stm32::CAN,
60
69
_rx: gpioa::PA11<AF9>,
61
70
_tx: gpioa::PA12<AF9>,
62
71
}
63
72
73
+
/// CAN Interrupt events
64
74
pubenumEvent{
65
75
Fifo0Fmp,
66
76
Fifo1Fmp,
@@ -145,10 +155,12 @@ impl embedded_hal_can::Filter for CanFilter {
145
155
}
146
156
147
157
implCanFilter{
158
+
/// Create a new filter with no assigned index. To actually active the filter call `Receiver::set_filter`, which will assign an index.
148
159
pubfnnew(data:CanFilterData) -> CanFilter{
149
160
CanFilter{ data,index:None}
150
161
}
151
162
163
+
/// Create a new filter with a specified filter index.
0 commit comments