1#[doc = "Register `MR` reader"]
2pub type R = crate::R<MrSpec>;
3#[doc = "Register `MR` writer"]
4pub type W = crate::W<MrSpec>;
5#[doc = "Parity Type\n\nValue on reset: 0"]
6#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7#[repr(u8)]
8pub enum Par {
9 #[doc = "0: Even Parity"]
10 Even = 0,
11 #[doc = "1: Odd Parity"]
12 Odd = 1,
13 #[doc = "2: Space: parity forced to 0"]
14 Space = 2,
15 #[doc = "3: Mark: parity forced to 1"]
16 Mark = 3,
17 #[doc = "4: No Parity"]
18 No = 4,
19}
20impl From<Par> for u8 {
21 #[inline(always)]
22 fn from(variant: Par) -> Self {
23 variant as _
24 }
25}
26impl crate::FieldSpec for Par {
27 type Ux = u8;
28}
29impl crate::IsEnum for Par {}
30#[doc = "Field `PAR` reader - Parity Type"]
31pub type ParR = crate::FieldReader<Par>;
32impl ParR {
33 #[doc = "Get enumerated values variant"]
34 #[inline(always)]
35 pub const fn variant(&self) -> Option<Par> {
36 match self.bits {
37 0 => Some(Par::Even),
38 1 => Some(Par::Odd),
39 2 => Some(Par::Space),
40 3 => Some(Par::Mark),
41 4 => Some(Par::No),
42 _ => None,
43 }
44 }
45 #[doc = "Even Parity"]
46 #[inline(always)]
47 pub fn is_even(&self) -> bool {
48 *self == Par::Even
49 }
50 #[doc = "Odd Parity"]
51 #[inline(always)]
52 pub fn is_odd(&self) -> bool {
53 *self == Par::Odd
54 }
55 #[doc = "Space: parity forced to 0"]
56 #[inline(always)]
57 pub fn is_space(&self) -> bool {
58 *self == Par::Space
59 }
60 #[doc = "Mark: parity forced to 1"]
61 #[inline(always)]
62 pub fn is_mark(&self) -> bool {
63 *self == Par::Mark
64 }
65 #[doc = "No Parity"]
66 #[inline(always)]
67 pub fn is_no(&self) -> bool {
68 *self == Par::No
69 }
70}
71#[doc = "Field `PAR` writer - Parity Type"]
72pub type ParW<'a, REG> = crate::FieldWriter<'a, REG, 3, Par>;
73impl<'a, REG> ParW<'a, REG>
74where
75 REG: crate::Writable + crate::RegisterSpec,
76 REG::Ux: From<u8>,
77{
78 #[doc = "Even Parity"]
79 #[inline(always)]
80 pub fn even(self) -> &'a mut crate::W<REG> {
81 self.variant(Par::Even)
82 }
83 #[doc = "Odd Parity"]
84 #[inline(always)]
85 pub fn odd(self) -> &'a mut crate::W<REG> {
86 self.variant(Par::Odd)
87 }
88 #[doc = "Space: parity forced to 0"]
89 #[inline(always)]
90 pub fn space(self) -> &'a mut crate::W<REG> {
91 self.variant(Par::Space)
92 }
93 #[doc = "Mark: parity forced to 1"]
94 #[inline(always)]
95 pub fn mark(self) -> &'a mut crate::W<REG> {
96 self.variant(Par::Mark)
97 }
98 #[doc = "No Parity"]
99 #[inline(always)]
100 pub fn no(self) -> &'a mut crate::W<REG> {
101 self.variant(Par::No)
102 }
103}
104#[doc = "Channel Mode\n\nValue on reset: 0"]
105#[derive(Clone, Copy, Debug, PartialEq, Eq)]
106#[repr(u8)]
107pub enum Chmode {
108 #[doc = "0: Normal Mode"]
109 Normal = 0,
110 #[doc = "1: Automatic Echo"]
111 Automatic = 1,
112 #[doc = "2: Local Loopback"]
113 LocalLoopback = 2,
114 #[doc = "3: Remote Loopback"]
115 RemoteLoopback = 3,
116}
117impl From<Chmode> for u8 {
118 #[inline(always)]
119 fn from(variant: Chmode) -> Self {
120 variant as _
121 }
122}
123impl crate::FieldSpec for Chmode {
124 type Ux = u8;
125}
126impl crate::IsEnum for Chmode {}
127#[doc = "Field `CHMODE` reader - Channel Mode"]
128pub type ChmodeR = crate::FieldReader<Chmode>;
129impl ChmodeR {
130 #[doc = "Get enumerated values variant"]
131 #[inline(always)]
132 pub const fn variant(&self) -> Chmode {
133 match self.bits {
134 0 => Chmode::Normal,
135 1 => Chmode::Automatic,
136 2 => Chmode::LocalLoopback,
137 3 => Chmode::RemoteLoopback,
138 _ => unreachable!(),
139 }
140 }
141 #[doc = "Normal Mode"]
142 #[inline(always)]
143 pub fn is_normal(&self) -> bool {
144 *self == Chmode::Normal
145 }
146 #[doc = "Automatic Echo"]
147 #[inline(always)]
148 pub fn is_automatic(&self) -> bool {
149 *self == Chmode::Automatic
150 }
151 #[doc = "Local Loopback"]
152 #[inline(always)]
153 pub fn is_local_loopback(&self) -> bool {
154 *self == Chmode::LocalLoopback
155 }
156 #[doc = "Remote Loopback"]
157 #[inline(always)]
158 pub fn is_remote_loopback(&self) -> bool {
159 *self == Chmode::RemoteLoopback
160 }
161}
162#[doc = "Field `CHMODE` writer - Channel Mode"]
163pub type ChmodeW<'a, REG> = crate::FieldWriter<'a, REG, 2, Chmode, crate::Safe>;
164impl<'a, REG> ChmodeW<'a, REG>
165where
166 REG: crate::Writable + crate::RegisterSpec,
167 REG::Ux: From<u8>,
168{
169 #[doc = "Normal Mode"]
170 #[inline(always)]
171 pub fn normal(self) -> &'a mut crate::W<REG> {
172 self.variant(Chmode::Normal)
173 }
174 #[doc = "Automatic Echo"]
175 #[inline(always)]
176 pub fn automatic(self) -> &'a mut crate::W<REG> {
177 self.variant(Chmode::Automatic)
178 }
179 #[doc = "Local Loopback"]
180 #[inline(always)]
181 pub fn local_loopback(self) -> &'a mut crate::W<REG> {
182 self.variant(Chmode::LocalLoopback)
183 }
184 #[doc = "Remote Loopback"]
185 #[inline(always)]
186 pub fn remote_loopback(self) -> &'a mut crate::W<REG> {
187 self.variant(Chmode::RemoteLoopback)
188 }
189}
190impl R {
191 #[doc = "Bits 9:11 - Parity Type"]
192 #[inline(always)]
193 pub fn par(&self) -> ParR {
194 ParR::new(((self.bits >> 9) & 7) as u8)
195 }
196 #[doc = "Bits 14:15 - Channel Mode"]
197 #[inline(always)]
198 pub fn chmode(&self) -> ChmodeR {
199 ChmodeR::new(((self.bits >> 14) & 3) as u8)
200 }
201}
202impl W {
203 #[doc = "Bits 9:11 - Parity Type"]
204 #[inline(always)]
205 #[must_use]
206 pub fn par(&mut self) -> ParW<MrSpec> {
207 ParW::new(self, 9)
208 }
209 #[doc = "Bits 14:15 - Channel Mode"]
210 #[inline(always)]
211 #[must_use]
212 pub fn chmode(&mut self) -> ChmodeW<MrSpec> {
213 ChmodeW::new(self, 14)
214 }
215}
216#[doc = "Mode Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`mr::R`](R). You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`mr::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
217pub struct MrSpec;
218impl crate::RegisterSpec for MrSpec {
219 type Ux = u32;
220}
221#[doc = "`read()` method returns [`mr::R`](R) reader structure"]
222impl crate::Readable for MrSpec {}
223#[doc = "`write(|w| ..)` method takes [`mr::W`](W) writer structure"]
224impl crate::Writable for MrSpec {
225 type Safety = crate::Unsafe;
226 const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
227 const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
228}
229#[doc = "`reset()` method sets MR to value 0"]
230impl crate::Resettable for MrSpec {
231 const RESET_VALUE: u32 = 0;
232}