1#[doc = "Register `RES[%s]` reader"]
2pub type R = crate::R<RES_SPEC>;
3#[doc = "Register `RES[%s]` writer"]
4pub type W = crate::W<RES_SPEC>;
5#[doc = "Field `RESULT` reader - Result of Most Recent Conversion"]
6pub type RESULT_R = crate::FieldReader<u16>;
7#[doc = "Field `RESULT` writer - Result of Most Recent Conversion"]
8pub type RESULT_W<'a, REG> = crate::FieldWriter<'a, REG, 16, u16>;
9#[doc = "Field `DRC` reader - Data Reduction Counter"]
10pub type DRC_R = crate::FieldReader;
11#[doc = "Field `CHNR` reader - Channel Number"]
12pub type CHNR_R = crate::FieldReader;
13#[doc = "Field `EMUX` reader - External Multiplexer Setting"]
14pub type EMUX_R = crate::FieldReader;
15#[doc = "Converted Request Source\n\nValue on reset: 0"]
16#[derive(Clone, Copy, Debug, PartialEq, Eq)]
17#[repr(u8)]
18pub enum CRS_A {
19 #[doc = "0: Request source 0"]
20 VALUE1 = 0,
21 #[doc = "1: Request source 1"]
22 VALUE2 = 1,
23 #[doc = "2: Request source 2"]
24 VALUE3 = 2,
25}
26impl From<CRS_A> for u8 {
27 #[inline(always)]
28 fn from(variant: CRS_A) -> Self {
29 variant as _
30 }
31}
32impl crate::FieldSpec for CRS_A {
33 type Ux = u8;
34}
35impl crate::IsEnum for CRS_A {}
36#[doc = "Field `CRS` reader - Converted Request Source"]
37pub type CRS_R = crate::FieldReader<CRS_A>;
38impl CRS_R {
39 #[doc = "Get enumerated values variant"]
40 #[inline(always)]
41 pub const fn variant(&self) -> Option<CRS_A> {
42 match self.bits {
43 0 => Some(CRS_A::VALUE1),
44 1 => Some(CRS_A::VALUE2),
45 2 => Some(CRS_A::VALUE3),
46 _ => None,
47 }
48 }
49 #[doc = "Request source 0"]
50 #[inline(always)]
51 pub fn is_value1(&self) -> bool {
52 *self == CRS_A::VALUE1
53 }
54 #[doc = "Request source 1"]
55 #[inline(always)]
56 pub fn is_value2(&self) -> bool {
57 *self == CRS_A::VALUE2
58 }
59 #[doc = "Request source 2"]
60 #[inline(always)]
61 pub fn is_value3(&self) -> bool {
62 *self == CRS_A::VALUE3
63 }
64}
65#[doc = "Fast Compare Result\n\nValue on reset: 0"]
66#[derive(Clone, Copy, Debug, PartialEq, Eq)]
67pub enum FCR_A {
68 #[doc = "0: Signal level was below compare value"]
69 VALUE1 = 0,
70 #[doc = "1: Signal level was above compare value"]
71 VALUE2 = 1,
72}
73impl From<FCR_A> for bool {
74 #[inline(always)]
75 fn from(variant: FCR_A) -> Self {
76 variant as u8 != 0
77 }
78}
79#[doc = "Field `FCR` reader - Fast Compare Result"]
80pub type FCR_R = crate::BitReader<FCR_A>;
81impl FCR_R {
82 #[doc = "Get enumerated values variant"]
83 #[inline(always)]
84 pub const fn variant(&self) -> FCR_A {
85 match self.bits {
86 false => FCR_A::VALUE1,
87 true => FCR_A::VALUE2,
88 }
89 }
90 #[doc = "Signal level was below compare value"]
91 #[inline(always)]
92 pub fn is_value1(&self) -> bool {
93 *self == FCR_A::VALUE1
94 }
95 #[doc = "Signal level was above compare value"]
96 #[inline(always)]
97 pub fn is_value2(&self) -> bool {
98 *self == FCR_A::VALUE2
99 }
100}
101#[doc = "Valid Flag\n\nValue on reset: 0"]
102#[derive(Clone, Copy, Debug, PartialEq, Eq)]
103pub enum VF_A {
104 #[doc = "0: No new result available"]
105 VALUE1 = 0,
106 #[doc = "1: Bitfield RESULT has been updated with new result value and has not yet been read, or bit FCR has been updated"]
107 VALUE2 = 1,
108}
109impl From<VF_A> for bool {
110 #[inline(always)]
111 fn from(variant: VF_A) -> Self {
112 variant as u8 != 0
113 }
114}
115#[doc = "Field `VF` reader - Valid Flag"]
116pub type VF_R = crate::BitReader<VF_A>;
117impl VF_R {
118 #[doc = "Get enumerated values variant"]
119 #[inline(always)]
120 pub const fn variant(&self) -> VF_A {
121 match self.bits {
122 false => VF_A::VALUE1,
123 true => VF_A::VALUE2,
124 }
125 }
126 #[doc = "No new result available"]
127 #[inline(always)]
128 pub fn is_value1(&self) -> bool {
129 *self == VF_A::VALUE1
130 }
131 #[doc = "Bitfield RESULT has been updated with new result value and has not yet been read, or bit FCR has been updated"]
132 #[inline(always)]
133 pub fn is_value2(&self) -> bool {
134 *self == VF_A::VALUE2
135 }
136}
137impl R {
138 #[doc = "Bits 0:15 - Result of Most Recent Conversion"]
139 #[inline(always)]
140 pub fn result(&self) -> RESULT_R {
141 RESULT_R::new((self.bits & 0xffff) as u16)
142 }
143 #[doc = "Bits 16:19 - Data Reduction Counter"]
144 #[inline(always)]
145 pub fn drc(&self) -> DRC_R {
146 DRC_R::new(((self.bits >> 16) & 0x0f) as u8)
147 }
148 #[doc = "Bits 20:24 - Channel Number"]
149 #[inline(always)]
150 pub fn chnr(&self) -> CHNR_R {
151 CHNR_R::new(((self.bits >> 20) & 0x1f) as u8)
152 }
153 #[doc = "Bits 25:27 - External Multiplexer Setting"]
154 #[inline(always)]
155 pub fn emux(&self) -> EMUX_R {
156 EMUX_R::new(((self.bits >> 25) & 7) as u8)
157 }
158 #[doc = "Bits 28:29 - Converted Request Source"]
159 #[inline(always)]
160 pub fn crs(&self) -> CRS_R {
161 CRS_R::new(((self.bits >> 28) & 3) as u8)
162 }
163 #[doc = "Bit 30 - Fast Compare Result"]
164 #[inline(always)]
165 pub fn fcr(&self) -> FCR_R {
166 FCR_R::new(((self.bits >> 30) & 1) != 0)
167 }
168 #[doc = "Bit 31 - Valid Flag"]
169 #[inline(always)]
170 pub fn vf(&self) -> VF_R {
171 VF_R::new(((self.bits >> 31) & 1) != 0)
172 }
173}
174impl W {
175 #[doc = "Bits 0:15 - Result of Most Recent Conversion"]
176 #[inline(always)]
177 pub fn result(&mut self) -> RESULT_W<RES_SPEC> {
178 RESULT_W::new(self, 0)
179 }
180}
181#[doc = "Result Register\n\nYou can [`read`](crate::Reg::read) this register and get [`res::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`res::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\n<div class=\"warning\">One or more dependent resources other than the current register are immediately affected by a read operation.</div>"]
182pub struct RES_SPEC;
183impl crate::RegisterSpec for RES_SPEC {
184 type Ux = u32;
185}
186#[doc = "`read()` method returns [`res::R`](R) reader structure"]
187impl crate::Readable for RES_SPEC {}
188#[doc = "`write(|w| ..)` method takes [`res::W`](W) writer structure"]
189impl crate::Writable for RES_SPEC {
190 type Safety = crate::Unsafe;
191 const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
192 const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
193}
194#[doc = "`reset()` method sets RES[%s]
195to value 0"]
196impl crate::Resettable for RES_SPEC {
197 const RESET_VALUE: u32 = 0;
198}