xmc4700/can_mo/mo/
moar.rs1#[doc = "Register `MOAR` reader"]
2pub type R = crate::R<MOAR_SPEC>;
3#[doc = "Register `MOAR` writer"]
4pub type W = crate::W<MOAR_SPEC>;
5#[doc = "Field `ID` reader - CAN Identifier of Message Object n"]
6pub type ID_R = crate::FieldReader<u32>;
7#[doc = "Field `ID` writer - CAN Identifier of Message Object n"]
8pub type ID_W<'a, REG> = crate::FieldWriter<'a, REG, 29, u32>;
9#[doc = "Identifier Extension Bit of Message Object n\n\nValue on reset: 0"]
10#[derive(Clone, Copy, Debug, PartialEq, Eq)]
11pub enum IDE_A {
12 #[doc = "0: Message object n handles standard frames with 11-bit identifier."]
13 VALUE1 = 0,
14 #[doc = "1: Message object n handles extended frames with 29-bit identifier."]
15 VALUE2 = 1,
16}
17impl From<IDE_A> for bool {
18 #[inline(always)]
19 fn from(variant: IDE_A) -> Self {
20 variant as u8 != 0
21 }
22}
23#[doc = "Field `IDE` reader - Identifier Extension Bit of Message Object n"]
24pub type IDE_R = crate::BitReader<IDE_A>;
25impl IDE_R {
26 #[doc = "Get enumerated values variant"]
27 #[inline(always)]
28 pub const fn variant(&self) -> IDE_A {
29 match self.bits {
30 false => IDE_A::VALUE1,
31 true => IDE_A::VALUE2,
32 }
33 }
34 #[doc = "Message object n handles standard frames with 11-bit identifier."]
35 #[inline(always)]
36 pub fn is_value1(&self) -> bool {
37 *self == IDE_A::VALUE1
38 }
39 #[doc = "Message object n handles extended frames with 29-bit identifier."]
40 #[inline(always)]
41 pub fn is_value2(&self) -> bool {
42 *self == IDE_A::VALUE2
43 }
44}
45#[doc = "Field `IDE` writer - Identifier Extension Bit of Message Object n"]
46pub type IDE_W<'a, REG> = crate::BitWriter<'a, REG, IDE_A>;
47impl<'a, REG> IDE_W<'a, REG>
48where
49 REG: crate::Writable + crate::RegisterSpec,
50{
51 #[doc = "Message object n handles standard frames with 11-bit identifier."]
52 #[inline(always)]
53 pub fn value1(self) -> &'a mut crate::W<REG> {
54 self.variant(IDE_A::VALUE1)
55 }
56 #[doc = "Message object n handles extended frames with 29-bit identifier."]
57 #[inline(always)]
58 pub fn value2(self) -> &'a mut crate::W<REG> {
59 self.variant(IDE_A::VALUE2)
60 }
61}
62#[doc = "Priority Class\n\nValue on reset: 0"]
63#[derive(Clone, Copy, Debug, PartialEq, Eq)]
64#[repr(u8)]
65pub enum PRI_A {
66 #[doc = "1: Transmit acceptance filtering is based on the list order. This means that message object n is considered for transmission only if there is no other message object with valid transmit request (MSGVAL & TXEN0 & TXEN1 = 1) somewhere before this object in the list."]
67 VALUE2 = 1,
68 #[doc = "2: Transmit acceptance filtering is based on the CAN identifier. This means, message object n is considered for transmission only if there is no other message object with higher priority identifier + IDE + DIR (with respect to CAN arbitration rules) somewhere in the list (see )."]
69 VALUE3 = 2,
70 #[doc = "3: Transmit acceptance filtering is based on the list order (as PRI = 01B)."]
71 VALUE4 = 3,
72}
73impl From<PRI_A> for u8 {
74 #[inline(always)]
75 fn from(variant: PRI_A) -> Self {
76 variant as _
77 }
78}
79impl crate::FieldSpec for PRI_A {
80 type Ux = u8;
81}
82impl crate::IsEnum for PRI_A {}
83#[doc = "Field `PRI` reader - Priority Class"]
84pub type PRI_R = crate::FieldReader<PRI_A>;
85impl PRI_R {
86 #[doc = "Get enumerated values variant"]
87 #[inline(always)]
88 pub const fn variant(&self) -> Option<PRI_A> {
89 match self.bits {
90 1 => Some(PRI_A::VALUE2),
91 2 => Some(PRI_A::VALUE3),
92 3 => Some(PRI_A::VALUE4),
93 _ => None,
94 }
95 }
96 #[doc = "Transmit acceptance filtering is based on the list order. This means that message object n is considered for transmission only if there is no other message object with valid transmit request (MSGVAL & TXEN0 & TXEN1 = 1) somewhere before this object in the list."]
97 #[inline(always)]
98 pub fn is_value2(&self) -> bool {
99 *self == PRI_A::VALUE2
100 }
101 #[doc = "Transmit acceptance filtering is based on the CAN identifier. This means, message object n is considered for transmission only if there is no other message object with higher priority identifier + IDE + DIR (with respect to CAN arbitration rules) somewhere in the list (see )."]
102 #[inline(always)]
103 pub fn is_value3(&self) -> bool {
104 *self == PRI_A::VALUE3
105 }
106 #[doc = "Transmit acceptance filtering is based on the list order (as PRI = 01B)."]
107 #[inline(always)]
108 pub fn is_value4(&self) -> bool {
109 *self == PRI_A::VALUE4
110 }
111}
112#[doc = "Field `PRI` writer - Priority Class"]
113pub type PRI_W<'a, REG> = crate::FieldWriter<'a, REG, 2, PRI_A>;
114impl<'a, REG> PRI_W<'a, REG>
115where
116 REG: crate::Writable + crate::RegisterSpec,
117 REG::Ux: From<u8>,
118{
119 #[doc = "Transmit acceptance filtering is based on the list order. This means that message object n is considered for transmission only if there is no other message object with valid transmit request (MSGVAL & TXEN0 & TXEN1 = 1) somewhere before this object in the list."]
120 #[inline(always)]
121 pub fn value2(self) -> &'a mut crate::W<REG> {
122 self.variant(PRI_A::VALUE2)
123 }
124 #[doc = "Transmit acceptance filtering is based on the CAN identifier. This means, message object n is considered for transmission only if there is no other message object with higher priority identifier + IDE + DIR (with respect to CAN arbitration rules) somewhere in the list (see )."]
125 #[inline(always)]
126 pub fn value3(self) -> &'a mut crate::W<REG> {
127 self.variant(PRI_A::VALUE3)
128 }
129 #[doc = "Transmit acceptance filtering is based on the list order (as PRI = 01B)."]
130 #[inline(always)]
131 pub fn value4(self) -> &'a mut crate::W<REG> {
132 self.variant(PRI_A::VALUE4)
133 }
134}
135impl R {
136 #[doc = "Bits 0:28 - CAN Identifier of Message Object n"]
137 #[inline(always)]
138 pub fn id(&self) -> ID_R {
139 ID_R::new(self.bits & 0x1fff_ffff)
140 }
141 #[doc = "Bit 29 - Identifier Extension Bit of Message Object n"]
142 #[inline(always)]
143 pub fn ide(&self) -> IDE_R {
144 IDE_R::new(((self.bits >> 29) & 1) != 0)
145 }
146 #[doc = "Bits 30:31 - Priority Class"]
147 #[inline(always)]
148 pub fn pri(&self) -> PRI_R {
149 PRI_R::new(((self.bits >> 30) & 3) as u8)
150 }
151}
152impl W {
153 #[doc = "Bits 0:28 - CAN Identifier of Message Object n"]
154 #[inline(always)]
155 pub fn id(&mut self) -> ID_W<MOAR_SPEC> {
156 ID_W::new(self, 0)
157 }
158 #[doc = "Bit 29 - Identifier Extension Bit of Message Object n"]
159 #[inline(always)]
160 pub fn ide(&mut self) -> IDE_W<MOAR_SPEC> {
161 IDE_W::new(self, 29)
162 }
163 #[doc = "Bits 30:31 - Priority Class"]
164 #[inline(always)]
165 pub fn pri(&mut self) -> PRI_W<MOAR_SPEC> {
166 PRI_W::new(self, 30)
167 }
168}
169#[doc = "Message Object Arbitration Register\n\nYou can [`read`](crate::Reg::read) this register and get [`moar::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`moar::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
170pub struct MOAR_SPEC;
171impl crate::RegisterSpec for MOAR_SPEC {
172 type Ux = u32;
173}
174#[doc = "`read()` method returns [`moar::R`](R) reader structure"]
175impl crate::Readable for MOAR_SPEC {}
176#[doc = "`write(|w| ..)` method takes [`moar::W`](W) writer structure"]
177impl crate::Writable for MOAR_SPEC {
178 type Safety = crate::Unsafe;
179 const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
180 const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
181}
182#[doc = "`reset()` method sets MOAR to value 0"]
183impl crate::Resettable for MOAR_SPEC {
184 const RESET_VALUE: u32 = 0;
185}