1#[doc = "Register `IMR` reader"]
2pub type R = crate::R<ImrSpec>;
3#[doc = "Register `IMR` writer"]
4pub type W = crate::W<ImrSpec>;
5#[doc = "Field `HOME_ENABLE` reader - HOME_ENABLE"]
6pub type HomeEnableR = crate::BitReader;
7#[doc = "Field `INDEX_PRESET` reader - INDEX_PRESET"]
8pub type IndexPresetR = crate::BitReader;
9#[doc = "Field `PHB` reader - PHB"]
10pub type PhbR = crate::BitReader;
11#[doc = "Field `PHA` reader - PHA"]
12pub type PhaR = crate::BitReader;
13#[doc = "Field `FHOM_ENA` reader - filter operation on HOME/ENABLE input"]
14pub type FhomEnaR = crate::BitReader;
15#[doc = "Field `FHOM_ENA` writer - filter operation on HOME/ENABLE input"]
16pub type FhomEnaW<'a, REG> = crate::BitWriter<'a, REG>;
17#[doc = "Field `FIND_PRE` reader - filter operation on INDEX/PRESET input"]
18pub type FindPreR = crate::BitReader;
19#[doc = "Field `FIND_PRE` writer - filter operation on INDEX/PRESET input"]
20pub type FindPreW<'a, REG> = crate::BitWriter<'a, REG>;
21#[doc = "Field `FPHB` reader - filter operation on PHASEB input"]
22pub type FphbR = crate::BitReader;
23#[doc = "Field `FPHB` writer - filter operation on PHASEB input"]
24pub type FphbW<'a, REG> = crate::BitWriter<'a, REG>;
25#[doc = "Field `FPHA` reader - filter operation on PHASEA input"]
26pub type FphaR = crate::BitReader;
27#[doc = "Field `FPHA` writer - filter operation on PHASEA input"]
28pub type FphaW<'a, REG> = crate::BitWriter<'a, REG>;
29#[doc = "Position Compare 0 Flag Output\n\nValue on reset: 0"]
30#[cfg_attr(feature = "defmt", derive(defmt::Format))]
31#[derive(Clone, Copy, Debug, PartialEq, Eq)]
32pub enum Cmpf0 {
33 #[doc = "0: When the position counter is less than value of COMP0 register"]
34 Cmpf00 = 0,
35 #[doc = "1: When the position counter is greater or equal than value of COMP0 register"]
36 Cmpf01 = 1,
37}
38impl From<Cmpf0> for bool {
39 #[inline(always)]
40 fn from(variant: Cmpf0) -> Self {
41 variant as u8 != 0
42 }
43}
44#[doc = "Field `CMPF0` reader - Position Compare 0 Flag Output"]
45pub type Cmpf0R = crate::BitReader<Cmpf0>;
46impl Cmpf0R {
47 #[doc = "Get enumerated values variant"]
48 #[inline(always)]
49 pub const fn variant(&self) -> Cmpf0 {
50 match self.bits {
51 false => Cmpf0::Cmpf00,
52 true => Cmpf0::Cmpf01,
53 }
54 }
55 #[doc = "When the position counter is less than value of COMP0 register"]
56 #[inline(always)]
57 pub fn is_cmpf00(&self) -> bool {
58 *self == Cmpf0::Cmpf00
59 }
60 #[doc = "When the position counter is greater or equal than value of COMP0 register"]
61 #[inline(always)]
62 pub fn is_cmpf01(&self) -> bool {
63 *self == Cmpf0::Cmpf01
64 }
65}
66#[doc = "Position Compare1 Flag Output\n\nValue on reset: 0"]
67#[cfg_attr(feature = "defmt", derive(defmt::Format))]
68#[derive(Clone, Copy, Debug, PartialEq, Eq)]
69pub enum Cmp1f {
70 #[doc = "0: When the position counter is less than value of COMP1 register"]
71 Cmp1f0 = 0,
72 #[doc = "1: When the position counter is greater or equal than value of COMP1 register"]
73 Cmp1f1 = 1,
74}
75impl From<Cmp1f> for bool {
76 #[inline(always)]
77 fn from(variant: Cmp1f) -> Self {
78 variant as u8 != 0
79 }
80}
81#[doc = "Field `CMP1F` reader - Position Compare1 Flag Output"]
82pub type Cmp1fR = crate::BitReader<Cmp1f>;
83impl Cmp1fR {
84 #[doc = "Get enumerated values variant"]
85 #[inline(always)]
86 pub const fn variant(&self) -> Cmp1f {
87 match self.bits {
88 false => Cmp1f::Cmp1f0,
89 true => Cmp1f::Cmp1f1,
90 }
91 }
92 #[doc = "When the position counter is less than value of COMP1 register"]
93 #[inline(always)]
94 pub fn is_cmp1f0(&self) -> bool {
95 *self == Cmp1f::Cmp1f0
96 }
97 #[doc = "When the position counter is greater or equal than value of COMP1 register"]
98 #[inline(always)]
99 pub fn is_cmp1f1(&self) -> bool {
100 *self == Cmp1f::Cmp1f1
101 }
102}
103#[doc = "Position Compare2 Flag Output\n\nValue on reset: 0"]
104#[cfg_attr(feature = "defmt", derive(defmt::Format))]
105#[derive(Clone, Copy, Debug, PartialEq, Eq)]
106pub enum Cmp2f {
107 #[doc = "0: When the position counter is less than value of COMP2 register"]
108 Cmp2f0 = 0,
109 #[doc = "1: When the position counter is greater or equal than value of COMP2 register"]
110 Cmp2f1 = 1,
111}
112impl From<Cmp2f> for bool {
113 #[inline(always)]
114 fn from(variant: Cmp2f) -> Self {
115 variant as u8 != 0
116 }
117}
118#[doc = "Field `CMP2F` reader - Position Compare2 Flag Output"]
119pub type Cmp2fR = crate::BitReader<Cmp2f>;
120impl Cmp2fR {
121 #[doc = "Get enumerated values variant"]
122 #[inline(always)]
123 pub const fn variant(&self) -> Cmp2f {
124 match self.bits {
125 false => Cmp2f::Cmp2f0,
126 true => Cmp2f::Cmp2f1,
127 }
128 }
129 #[doc = "When the position counter is less than value of COMP2 register"]
130 #[inline(always)]
131 pub fn is_cmp2f0(&self) -> bool {
132 *self == Cmp2f::Cmp2f0
133 }
134 #[doc = "When the position counter is greater or equal than value of COMP2 register"]
135 #[inline(always)]
136 pub fn is_cmp2f1(&self) -> bool {
137 *self == Cmp2f::Cmp2f1
138 }
139}
140#[doc = "Position Compare3 Flag Output\n\nValue on reset: 0"]
141#[cfg_attr(feature = "defmt", derive(defmt::Format))]
142#[derive(Clone, Copy, Debug, PartialEq, Eq)]
143pub enum Cmp3f {
144 #[doc = "0: When the position counter value is less than value of COMP3 register"]
145 Cmp3f0 = 0,
146 #[doc = "1: When the position counter is greater or equal than value of COMP3 register"]
147 Cmp3f1 = 1,
148}
149impl From<Cmp3f> for bool {
150 #[inline(always)]
151 fn from(variant: Cmp3f) -> Self {
152 variant as u8 != 0
153 }
154}
155#[doc = "Field `CMP3F` reader - Position Compare3 Flag Output"]
156pub type Cmp3fR = crate::BitReader<Cmp3f>;
157impl Cmp3fR {
158 #[doc = "Get enumerated values variant"]
159 #[inline(always)]
160 pub const fn variant(&self) -> Cmp3f {
161 match self.bits {
162 false => Cmp3f::Cmp3f0,
163 true => Cmp3f::Cmp3f1,
164 }
165 }
166 #[doc = "When the position counter value is less than value of COMP3 register"]
167 #[inline(always)]
168 pub fn is_cmp3f0(&self) -> bool {
169 *self == Cmp3f::Cmp3f0
170 }
171 #[doc = "When the position counter is greater or equal than value of COMP3 register"]
172 #[inline(always)]
173 pub fn is_cmp3f1(&self) -> bool {
174 *self == Cmp3f::Cmp3f1
175 }
176}
177#[doc = "Field `DIRH` reader - Count Direction Flag Hold"]
178pub type DirhR = crate::BitReader;
179#[doc = "Count Direction Flag Output\n\nValue on reset: 0"]
180#[cfg_attr(feature = "defmt", derive(defmt::Format))]
181#[derive(Clone, Copy, Debug, PartialEq, Eq)]
182pub enum Dir {
183 #[doc = "0: Current count was in the down direction"]
184 Dir0 = 0,
185 #[doc = "1: Current count was in the up direction"]
186 Dir1 = 1,
187}
188impl From<Dir> for bool {
189 #[inline(always)]
190 fn from(variant: Dir) -> Self {
191 variant as u8 != 0
192 }
193}
194#[doc = "Field `DIR` reader - Count Direction Flag Output"]
195pub type DirR = crate::BitReader<Dir>;
196impl DirR {
197 #[doc = "Get enumerated values variant"]
198 #[inline(always)]
199 pub const fn variant(&self) -> Dir {
200 match self.bits {
201 false => Dir::Dir0,
202 true => Dir::Dir1,
203 }
204 }
205 #[doc = "Current count was in the down direction"]
206 #[inline(always)]
207 pub fn is_dir0(&self) -> bool {
208 *self == Dir::Dir0
209 }
210 #[doc = "Current count was in the up direction"]
211 #[inline(always)]
212 pub fn is_dir1(&self) -> bool {
213 *self == Dir::Dir1
214 }
215}
216impl R {
217 #[doc = "Bit 0 - HOME_ENABLE"]
218 #[inline(always)]
219 pub fn home_enable(&self) -> HomeEnableR {
220 HomeEnableR::new((self.bits & 1) != 0)
221 }
222 #[doc = "Bit 1 - INDEX_PRESET"]
223 #[inline(always)]
224 pub fn index_preset(&self) -> IndexPresetR {
225 IndexPresetR::new(((self.bits >> 1) & 1) != 0)
226 }
227 #[doc = "Bit 2 - PHB"]
228 #[inline(always)]
229 pub fn phb(&self) -> PhbR {
230 PhbR::new(((self.bits >> 2) & 1) != 0)
231 }
232 #[doc = "Bit 3 - PHA"]
233 #[inline(always)]
234 pub fn pha(&self) -> PhaR {
235 PhaR::new(((self.bits >> 3) & 1) != 0)
236 }
237 #[doc = "Bit 4 - filter operation on HOME/ENABLE input"]
238 #[inline(always)]
239 pub fn fhom_ena(&self) -> FhomEnaR {
240 FhomEnaR::new(((self.bits >> 4) & 1) != 0)
241 }
242 #[doc = "Bit 5 - filter operation on INDEX/PRESET input"]
243 #[inline(always)]
244 pub fn find_pre(&self) -> FindPreR {
245 FindPreR::new(((self.bits >> 5) & 1) != 0)
246 }
247 #[doc = "Bit 6 - filter operation on PHASEB input"]
248 #[inline(always)]
249 pub fn fphb(&self) -> FphbR {
250 FphbR::new(((self.bits >> 6) & 1) != 0)
251 }
252 #[doc = "Bit 7 - filter operation on PHASEA input"]
253 #[inline(always)]
254 pub fn fpha(&self) -> FphaR {
255 FphaR::new(((self.bits >> 7) & 1) != 0)
256 }
257 #[doc = "Bit 8 - Position Compare 0 Flag Output"]
258 #[inline(always)]
259 pub fn cmpf0(&self) -> Cmpf0R {
260 Cmpf0R::new(((self.bits >> 8) & 1) != 0)
261 }
262 #[doc = "Bit 9 - Position Compare1 Flag Output"]
263 #[inline(always)]
264 pub fn cmp1f(&self) -> Cmp1fR {
265 Cmp1fR::new(((self.bits >> 9) & 1) != 0)
266 }
267 #[doc = "Bit 10 - Position Compare2 Flag Output"]
268 #[inline(always)]
269 pub fn cmp2f(&self) -> Cmp2fR {
270 Cmp2fR::new(((self.bits >> 10) & 1) != 0)
271 }
272 #[doc = "Bit 11 - Position Compare3 Flag Output"]
273 #[inline(always)]
274 pub fn cmp3f(&self) -> Cmp3fR {
275 Cmp3fR::new(((self.bits >> 11) & 1) != 0)
276 }
277 #[doc = "Bit 14 - Count Direction Flag Hold"]
278 #[inline(always)]
279 pub fn dirh(&self) -> DirhR {
280 DirhR::new(((self.bits >> 14) & 1) != 0)
281 }
282 #[doc = "Bit 15 - Count Direction Flag Output"]
283 #[inline(always)]
284 pub fn dir(&self) -> DirR {
285 DirR::new(((self.bits >> 15) & 1) != 0)
286 }
287}
288#[cfg(feature = "debug")]
289impl core::fmt::Debug for R {
290 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
291 f.debug_struct("IMR")
292 .field("home_enable", &self.home_enable())
293 .field("index_preset", &self.index_preset())
294 .field("phb", &self.phb())
295 .field("pha", &self.pha())
296 .field("fhom_ena", &self.fhom_ena())
297 .field("find_pre", &self.find_pre())
298 .field("fphb", &self.fphb())
299 .field("fpha", &self.fpha())
300 .field("cmpf0", &self.cmpf0())
301 .field("cmp1f", &self.cmp1f())
302 .field("cmp2f", &self.cmp2f())
303 .field("cmp3f", &self.cmp3f())
304 .field("dirh", &self.dirh())
305 .field("dir", &self.dir())
306 .finish()
307 }
308}
309impl W {
310 #[doc = "Bit 4 - filter operation on HOME/ENABLE input"]
311 #[inline(always)]
312 pub fn fhom_ena(&mut self) -> FhomEnaW<'_, ImrSpec> {
313 FhomEnaW::new(self, 4)
314 }
315 #[doc = "Bit 5 - filter operation on INDEX/PRESET input"]
316 #[inline(always)]
317 pub fn find_pre(&mut self) -> FindPreW<'_, ImrSpec> {
318 FindPreW::new(self, 5)
319 }
320 #[doc = "Bit 6 - filter operation on PHASEB input"]
321 #[inline(always)]
322 pub fn fphb(&mut self) -> FphbW<'_, ImrSpec> {
323 FphbW::new(self, 6)
324 }
325 #[doc = "Bit 7 - filter operation on PHASEA input"]
326 #[inline(always)]
327 pub fn fpha(&mut self) -> FphaW<'_, ImrSpec> {
328 FphaW::new(self, 7)
329 }
330}
331#[doc = "Input Monitor Register\n\nYou can [`read`](crate::Reg::read) this register and get [`imr::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`imr::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
332pub struct ImrSpec;
333impl crate::RegisterSpec for ImrSpec {
334 type Ux = u16;
335}
336#[doc = "`read()` method returns [`imr::R`](R) reader structure"]
337impl crate::Readable for ImrSpec {}
338#[doc = "`write(|w| ..)` method takes [`imr::W`](W) writer structure"]
339impl crate::Writable for ImrSpec {
340 type Safety = crate::Unsafe;
341}
342#[doc = "`reset()` method sets IMR to value 0"]
343impl crate::Resettable for ImrSpec {}