xmc4700/can_mo/mo/
mostat.rs

1#[doc = "Register `MOSTAT` reader"]
2pub type R = crate::R<MOSTAT_SPEC>;
3#[doc = "Receive Pending\n\nValue on reset: 0"]
4#[derive(Clone, Copy, Debug, PartialEq, Eq)]
5pub enum RXPND_A {
6    #[doc = "0: No CAN message has been received."]
7    VALUE1 = 0,
8    #[doc = "1: A CAN message has been received by the message object n, either directly or via gateway copy action."]
9    VALUE2 = 1,
10}
11impl From<RXPND_A> for bool {
12    #[inline(always)]
13    fn from(variant: RXPND_A) -> Self {
14        variant as u8 != 0
15    }
16}
17#[doc = "Field `RXPND` reader - Receive Pending"]
18pub type RXPND_R = crate::BitReader<RXPND_A>;
19impl RXPND_R {
20    #[doc = "Get enumerated values variant"]
21    #[inline(always)]
22    pub const fn variant(&self) -> RXPND_A {
23        match self.bits {
24            false => RXPND_A::VALUE1,
25            true => RXPND_A::VALUE2,
26        }
27    }
28    #[doc = "No CAN message has been received."]
29    #[inline(always)]
30    pub fn is_value1(&self) -> bool {
31        *self == RXPND_A::VALUE1
32    }
33    #[doc = "A CAN message has been received by the message object n, either directly or via gateway copy action."]
34    #[inline(always)]
35    pub fn is_value2(&self) -> bool {
36        *self == RXPND_A::VALUE2
37    }
38}
39#[doc = "Transmit Pending\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41pub enum TXPND_A {
42    #[doc = "0: No CAN message has been transmitted."]
43    VALUE1 = 0,
44    #[doc = "1: A CAN message from message object n has been transmitted successfully over the CAN bus."]
45    VALUE2 = 1,
46}
47impl From<TXPND_A> for bool {
48    #[inline(always)]
49    fn from(variant: TXPND_A) -> Self {
50        variant as u8 != 0
51    }
52}
53#[doc = "Field `TXPND` reader - Transmit Pending"]
54pub type TXPND_R = crate::BitReader<TXPND_A>;
55impl TXPND_R {
56    #[doc = "Get enumerated values variant"]
57    #[inline(always)]
58    pub const fn variant(&self) -> TXPND_A {
59        match self.bits {
60            false => TXPND_A::VALUE1,
61            true => TXPND_A::VALUE2,
62        }
63    }
64    #[doc = "No CAN message has been transmitted."]
65    #[inline(always)]
66    pub fn is_value1(&self) -> bool {
67        *self == TXPND_A::VALUE1
68    }
69    #[doc = "A CAN message from message object n has been transmitted successfully over the CAN bus."]
70    #[inline(always)]
71    pub fn is_value2(&self) -> bool {
72        *self == TXPND_A::VALUE2
73    }
74}
75#[doc = "Receive Updating\n\nValue on reset: 0"]
76#[derive(Clone, Copy, Debug, PartialEq, Eq)]
77pub enum RXUPD_A {
78    #[doc = "0: No receive update ongoing."]
79    VALUE1 = 0,
80    #[doc = "1: Message identifier, DLC, and data of the message object are currently updated."]
81    VALUE2 = 1,
82}
83impl From<RXUPD_A> for bool {
84    #[inline(always)]
85    fn from(variant: RXUPD_A) -> Self {
86        variant as u8 != 0
87    }
88}
89#[doc = "Field `RXUPD` reader - Receive Updating"]
90pub type RXUPD_R = crate::BitReader<RXUPD_A>;
91impl RXUPD_R {
92    #[doc = "Get enumerated values variant"]
93    #[inline(always)]
94    pub const fn variant(&self) -> RXUPD_A {
95        match self.bits {
96            false => RXUPD_A::VALUE1,
97            true => RXUPD_A::VALUE2,
98        }
99    }
100    #[doc = "No receive update ongoing."]
101    #[inline(always)]
102    pub fn is_value1(&self) -> bool {
103        *self == RXUPD_A::VALUE1
104    }
105    #[doc = "Message identifier, DLC, and data of the message object are currently updated."]
106    #[inline(always)]
107    pub fn is_value2(&self) -> bool {
108        *self == RXUPD_A::VALUE2
109    }
110}
111#[doc = "New Data\n\nValue on reset: 0"]
112#[derive(Clone, Copy, Debug, PartialEq, Eq)]
113pub enum NEWDAT_A {
114    #[doc = "0: No update of the message object n since last flag reset."]
115    VALUE1 = 0,
116    #[doc = "1: Message object n has been updated."]
117    VALUE2 = 1,
118}
119impl From<NEWDAT_A> for bool {
120    #[inline(always)]
121    fn from(variant: NEWDAT_A) -> Self {
122        variant as u8 != 0
123    }
124}
125#[doc = "Field `NEWDAT` reader - New Data"]
126pub type NEWDAT_R = crate::BitReader<NEWDAT_A>;
127impl NEWDAT_R {
128    #[doc = "Get enumerated values variant"]
129    #[inline(always)]
130    pub const fn variant(&self) -> NEWDAT_A {
131        match self.bits {
132            false => NEWDAT_A::VALUE1,
133            true => NEWDAT_A::VALUE2,
134        }
135    }
136    #[doc = "No update of the message object n since last flag reset."]
137    #[inline(always)]
138    pub fn is_value1(&self) -> bool {
139        *self == NEWDAT_A::VALUE1
140    }
141    #[doc = "Message object n has been updated."]
142    #[inline(always)]
143    pub fn is_value2(&self) -> bool {
144        *self == NEWDAT_A::VALUE2
145    }
146}
147#[doc = "Message Lost\n\nValue on reset: 0"]
148#[derive(Clone, Copy, Debug, PartialEq, Eq)]
149pub enum MSGLST_A {
150    #[doc = "0: No CAN message is lost."]
151    VALUE1 = 0,
152    #[doc = "1: A CAN message is lost because NEWDAT has become set again when it has already been set."]
153    VALUE2 = 1,
154}
155impl From<MSGLST_A> for bool {
156    #[inline(always)]
157    fn from(variant: MSGLST_A) -> Self {
158        variant as u8 != 0
159    }
160}
161#[doc = "Field `MSGLST` reader - Message Lost"]
162pub type MSGLST_R = crate::BitReader<MSGLST_A>;
163impl MSGLST_R {
164    #[doc = "Get enumerated values variant"]
165    #[inline(always)]
166    pub const fn variant(&self) -> MSGLST_A {
167        match self.bits {
168            false => MSGLST_A::VALUE1,
169            true => MSGLST_A::VALUE2,
170        }
171    }
172    #[doc = "No CAN message is lost."]
173    #[inline(always)]
174    pub fn is_value1(&self) -> bool {
175        *self == MSGLST_A::VALUE1
176    }
177    #[doc = "A CAN message is lost because NEWDAT has become set again when it has already been set."]
178    #[inline(always)]
179    pub fn is_value2(&self) -> bool {
180        *self == MSGLST_A::VALUE2
181    }
182}
183#[doc = "Message Valid\n\nValue on reset: 0"]
184#[derive(Clone, Copy, Debug, PartialEq, Eq)]
185pub enum MSGVAL_A {
186    #[doc = "0: Message object n is not valid."]
187    VALUE1 = 0,
188    #[doc = "1: Message object n is valid."]
189    VALUE2 = 1,
190}
191impl From<MSGVAL_A> for bool {
192    #[inline(always)]
193    fn from(variant: MSGVAL_A) -> Self {
194        variant as u8 != 0
195    }
196}
197#[doc = "Field `MSGVAL` reader - Message Valid"]
198pub type MSGVAL_R = crate::BitReader<MSGVAL_A>;
199impl MSGVAL_R {
200    #[doc = "Get enumerated values variant"]
201    #[inline(always)]
202    pub const fn variant(&self) -> MSGVAL_A {
203        match self.bits {
204            false => MSGVAL_A::VALUE1,
205            true => MSGVAL_A::VALUE2,
206        }
207    }
208    #[doc = "Message object n is not valid."]
209    #[inline(always)]
210    pub fn is_value1(&self) -> bool {
211        *self == MSGVAL_A::VALUE1
212    }
213    #[doc = "Message object n is valid."]
214    #[inline(always)]
215    pub fn is_value2(&self) -> bool {
216        *self == MSGVAL_A::VALUE2
217    }
218}
219#[doc = "Receive/Transmit Selected\n\nValue on reset: 0"]
220#[derive(Clone, Copy, Debug, PartialEq, Eq)]
221pub enum RTSEL_A {
222    #[doc = "0: Message object n is not selected for receive or transmit operation."]
223    VALUE1 = 0,
224    #[doc = "1: Message object n is selected for receive or transmit operation."]
225    VALUE2 = 1,
226}
227impl From<RTSEL_A> for bool {
228    #[inline(always)]
229    fn from(variant: RTSEL_A) -> Self {
230        variant as u8 != 0
231    }
232}
233#[doc = "Field `RTSEL` reader - Receive/Transmit Selected"]
234pub type RTSEL_R = crate::BitReader<RTSEL_A>;
235impl RTSEL_R {
236    #[doc = "Get enumerated values variant"]
237    #[inline(always)]
238    pub const fn variant(&self) -> RTSEL_A {
239        match self.bits {
240            false => RTSEL_A::VALUE1,
241            true => RTSEL_A::VALUE2,
242        }
243    }
244    #[doc = "Message object n is not selected for receive or transmit operation."]
245    #[inline(always)]
246    pub fn is_value1(&self) -> bool {
247        *self == RTSEL_A::VALUE1
248    }
249    #[doc = "Message object n is selected for receive or transmit operation."]
250    #[inline(always)]
251    pub fn is_value2(&self) -> bool {
252        *self == RTSEL_A::VALUE2
253    }
254}
255#[doc = "Receive Enable\n\nValue on reset: 0"]
256#[derive(Clone, Copy, Debug, PartialEq, Eq)]
257pub enum RXEN_A {
258    #[doc = "0: Message object n is not enabled for frame reception."]
259    VALUE1 = 0,
260    #[doc = "1: Message object n is enabled for frame reception."]
261    VALUE2 = 1,
262}
263impl From<RXEN_A> for bool {
264    #[inline(always)]
265    fn from(variant: RXEN_A) -> Self {
266        variant as u8 != 0
267    }
268}
269#[doc = "Field `RXEN` reader - Receive Enable"]
270pub type RXEN_R = crate::BitReader<RXEN_A>;
271impl RXEN_R {
272    #[doc = "Get enumerated values variant"]
273    #[inline(always)]
274    pub const fn variant(&self) -> RXEN_A {
275        match self.bits {
276            false => RXEN_A::VALUE1,
277            true => RXEN_A::VALUE2,
278        }
279    }
280    #[doc = "Message object n is not enabled for frame reception."]
281    #[inline(always)]
282    pub fn is_value1(&self) -> bool {
283        *self == RXEN_A::VALUE1
284    }
285    #[doc = "Message object n is enabled for frame reception."]
286    #[inline(always)]
287    pub fn is_value2(&self) -> bool {
288        *self == RXEN_A::VALUE2
289    }
290}
291#[doc = "Transmit Request\n\nValue on reset: 0"]
292#[derive(Clone, Copy, Debug, PartialEq, Eq)]
293pub enum TXRQ_A {
294    #[doc = "0: No transmission of message object n is requested."]
295    VALUE1 = 0,
296    #[doc = "1: Transmission of message object n on the CAN bus is requested."]
297    VALUE2 = 1,
298}
299impl From<TXRQ_A> for bool {
300    #[inline(always)]
301    fn from(variant: TXRQ_A) -> Self {
302        variant as u8 != 0
303    }
304}
305#[doc = "Field `TXRQ` reader - Transmit Request"]
306pub type TXRQ_R = crate::BitReader<TXRQ_A>;
307impl TXRQ_R {
308    #[doc = "Get enumerated values variant"]
309    #[inline(always)]
310    pub const fn variant(&self) -> TXRQ_A {
311        match self.bits {
312            false => TXRQ_A::VALUE1,
313            true => TXRQ_A::VALUE2,
314        }
315    }
316    #[doc = "No transmission of message object n is requested."]
317    #[inline(always)]
318    pub fn is_value1(&self) -> bool {
319        *self == TXRQ_A::VALUE1
320    }
321    #[doc = "Transmission of message object n on the CAN bus is requested."]
322    #[inline(always)]
323    pub fn is_value2(&self) -> bool {
324        *self == TXRQ_A::VALUE2
325    }
326}
327#[doc = "Transmit Enable 0\n\nValue on reset: 0"]
328#[derive(Clone, Copy, Debug, PartialEq, Eq)]
329pub enum TXEN0_A {
330    #[doc = "0: Message object n is not enabled for frame transmission."]
331    VALUE1 = 0,
332    #[doc = "1: Message object n is enabled for frame transmission."]
333    VALUE2 = 1,
334}
335impl From<TXEN0_A> for bool {
336    #[inline(always)]
337    fn from(variant: TXEN0_A) -> Self {
338        variant as u8 != 0
339    }
340}
341#[doc = "Field `TXEN0` reader - Transmit Enable 0"]
342pub type TXEN0_R = crate::BitReader<TXEN0_A>;
343impl TXEN0_R {
344    #[doc = "Get enumerated values variant"]
345    #[inline(always)]
346    pub const fn variant(&self) -> TXEN0_A {
347        match self.bits {
348            false => TXEN0_A::VALUE1,
349            true => TXEN0_A::VALUE2,
350        }
351    }
352    #[doc = "Message object n is not enabled for frame transmission."]
353    #[inline(always)]
354    pub fn is_value1(&self) -> bool {
355        *self == TXEN0_A::VALUE1
356    }
357    #[doc = "Message object n is enabled for frame transmission."]
358    #[inline(always)]
359    pub fn is_value2(&self) -> bool {
360        *self == TXEN0_A::VALUE2
361    }
362}
363#[doc = "Transmit Enable 1\n\nValue on reset: 0"]
364#[derive(Clone, Copy, Debug, PartialEq, Eq)]
365pub enum TXEN1_A {
366    #[doc = "0: Message object n is not enabled for frame transmission."]
367    VALUE1 = 0,
368    #[doc = "1: Message object n is enabled for frame transmission."]
369    VALUE2 = 1,
370}
371impl From<TXEN1_A> for bool {
372    #[inline(always)]
373    fn from(variant: TXEN1_A) -> Self {
374        variant as u8 != 0
375    }
376}
377#[doc = "Field `TXEN1` reader - Transmit Enable 1"]
378pub type TXEN1_R = crate::BitReader<TXEN1_A>;
379impl TXEN1_R {
380    #[doc = "Get enumerated values variant"]
381    #[inline(always)]
382    pub const fn variant(&self) -> TXEN1_A {
383        match self.bits {
384            false => TXEN1_A::VALUE1,
385            true => TXEN1_A::VALUE2,
386        }
387    }
388    #[doc = "Message object n is not enabled for frame transmission."]
389    #[inline(always)]
390    pub fn is_value1(&self) -> bool {
391        *self == TXEN1_A::VALUE1
392    }
393    #[doc = "Message object n is enabled for frame transmission."]
394    #[inline(always)]
395    pub fn is_value2(&self) -> bool {
396        *self == TXEN1_A::VALUE2
397    }
398}
399#[doc = "Message Direction\n\nValue on reset: 0"]
400#[derive(Clone, Copy, Debug, PartialEq, Eq)]
401pub enum DIR_A {
402    #[doc = "0: Receive Object selected: With TXRQ = 1, a Remote Frame with the identifier of message object n is scheduled for transmission. On reception of a Data Frame with matching identifier, the message is stored in message object n."]
403    VALUE1 = 0,
404    #[doc = "1: Transmit Object selected: If TXRQ = 1, message object n is scheduled for transmission of a Data Frame. On reception of a Remote Frame with matching identifier, bit TXRQ is set."]
405    VALUE2 = 1,
406}
407impl From<DIR_A> for bool {
408    #[inline(always)]
409    fn from(variant: DIR_A) -> Self {
410        variant as u8 != 0
411    }
412}
413#[doc = "Field `DIR` reader - Message Direction"]
414pub type DIR_R = crate::BitReader<DIR_A>;
415impl DIR_R {
416    #[doc = "Get enumerated values variant"]
417    #[inline(always)]
418    pub const fn variant(&self) -> DIR_A {
419        match self.bits {
420            false => DIR_A::VALUE1,
421            true => DIR_A::VALUE2,
422        }
423    }
424    #[doc = "Receive Object selected: With TXRQ = 1, a Remote Frame with the identifier of message object n is scheduled for transmission. On reception of a Data Frame with matching identifier, the message is stored in message object n."]
425    #[inline(always)]
426    pub fn is_value1(&self) -> bool {
427        *self == DIR_A::VALUE1
428    }
429    #[doc = "Transmit Object selected: If TXRQ = 1, message object n is scheduled for transmission of a Data Frame. On reception of a Remote Frame with matching identifier, bit TXRQ is set."]
430    #[inline(always)]
431    pub fn is_value2(&self) -> bool {
432        *self == DIR_A::VALUE2
433    }
434}
435#[doc = "Field `LIST` reader - List Allocation"]
436pub type LIST_R = crate::FieldReader;
437#[doc = "Field `PPREV` reader - Pointer to Previous Message Object"]
438pub type PPREV_R = crate::FieldReader;
439#[doc = "Field `PNEXT` reader - Pointer to Next Message Object"]
440pub type PNEXT_R = crate::FieldReader;
441impl R {
442    #[doc = "Bit 0 - Receive Pending"]
443    #[inline(always)]
444    pub fn rxpnd(&self) -> RXPND_R {
445        RXPND_R::new((self.bits & 1) != 0)
446    }
447    #[doc = "Bit 1 - Transmit Pending"]
448    #[inline(always)]
449    pub fn txpnd(&self) -> TXPND_R {
450        TXPND_R::new(((self.bits >> 1) & 1) != 0)
451    }
452    #[doc = "Bit 2 - Receive Updating"]
453    #[inline(always)]
454    pub fn rxupd(&self) -> RXUPD_R {
455        RXUPD_R::new(((self.bits >> 2) & 1) != 0)
456    }
457    #[doc = "Bit 3 - New Data"]
458    #[inline(always)]
459    pub fn newdat(&self) -> NEWDAT_R {
460        NEWDAT_R::new(((self.bits >> 3) & 1) != 0)
461    }
462    #[doc = "Bit 4 - Message Lost"]
463    #[inline(always)]
464    pub fn msglst(&self) -> MSGLST_R {
465        MSGLST_R::new(((self.bits >> 4) & 1) != 0)
466    }
467    #[doc = "Bit 5 - Message Valid"]
468    #[inline(always)]
469    pub fn msgval(&self) -> MSGVAL_R {
470        MSGVAL_R::new(((self.bits >> 5) & 1) != 0)
471    }
472    #[doc = "Bit 6 - Receive/Transmit Selected"]
473    #[inline(always)]
474    pub fn rtsel(&self) -> RTSEL_R {
475        RTSEL_R::new(((self.bits >> 6) & 1) != 0)
476    }
477    #[doc = "Bit 7 - Receive Enable"]
478    #[inline(always)]
479    pub fn rxen(&self) -> RXEN_R {
480        RXEN_R::new(((self.bits >> 7) & 1) != 0)
481    }
482    #[doc = "Bit 8 - Transmit Request"]
483    #[inline(always)]
484    pub fn txrq(&self) -> TXRQ_R {
485        TXRQ_R::new(((self.bits >> 8) & 1) != 0)
486    }
487    #[doc = "Bit 9 - Transmit Enable 0"]
488    #[inline(always)]
489    pub fn txen0(&self) -> TXEN0_R {
490        TXEN0_R::new(((self.bits >> 9) & 1) != 0)
491    }
492    #[doc = "Bit 10 - Transmit Enable 1"]
493    #[inline(always)]
494    pub fn txen1(&self) -> TXEN1_R {
495        TXEN1_R::new(((self.bits >> 10) & 1) != 0)
496    }
497    #[doc = "Bit 11 - Message Direction"]
498    #[inline(always)]
499    pub fn dir(&self) -> DIR_R {
500        DIR_R::new(((self.bits >> 11) & 1) != 0)
501    }
502    #[doc = "Bits 12:15 - List Allocation"]
503    #[inline(always)]
504    pub fn list(&self) -> LIST_R {
505        LIST_R::new(((self.bits >> 12) & 0x0f) as u8)
506    }
507    #[doc = "Bits 16:23 - Pointer to Previous Message Object"]
508    #[inline(always)]
509    pub fn pprev(&self) -> PPREV_R {
510        PPREV_R::new(((self.bits >> 16) & 0xff) as u8)
511    }
512    #[doc = "Bits 24:31 - Pointer to Next Message Object"]
513    #[inline(always)]
514    pub fn pnext(&self) -> PNEXT_R {
515        PNEXT_R::new(((self.bits >> 24) & 0xff) as u8)
516    }
517}
518#[doc = "Message Object Status Register\n\nYou can [`read`](crate::Reg::read) this register and get [`mostat::R`](R). See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
519pub struct MOSTAT_SPEC;
520impl crate::RegisterSpec for MOSTAT_SPEC {
521    type Ux = u32;
522}
523#[doc = "`read()` method returns [`mostat::R`](R) reader structure"]
524impl crate::Readable for MOSTAT_SPEC {}
525#[doc = "`reset()` method sets MOSTAT to value 0"]
526impl crate::Resettable for MOSTAT_SPEC {
527    const RESET_VALUE: u32 = 0;
528}