saml10e16a/oscctrl/
dfllulpdither.rs1#[doc = "Reader of register DFLLULPDITHER"]
2pub type R = crate::R<u8, super::DFLLULPDITHER>;
3#[doc = "Writer for register DFLLULPDITHER"]
4pub type W = crate::W<u8, super::DFLLULPDITHER>;
5#[doc = "Register DFLLULPDITHER `reset()`'s with value 0"]
6impl crate::ResetValue for super::DFLLULPDITHER {
7 type Type = u8;
8 #[inline(always)]
9 fn reset_value() -> Self::Type {
10 0
11 }
12}
13#[doc = "Possible values of the field `STEP`"]
14#[derive(Clone, Copy, Debug, PartialEq)]
15pub enum STEP_A {
16 #[doc = "Dither Step = 1"]
17 STEP1,
18 #[doc = "Dither Step = 2"]
19 STEP2,
20 #[doc = "Dither Step = 4"]
21 STEP4,
22 #[doc = "Dither Step = 8"]
23 STEP8,
24}
25impl crate::ToBits<u8> for STEP_A {
26 #[inline(always)]
27 fn _bits(&self) -> u8 {
28 match *self {
29 STEP_A::STEP1 => 0,
30 STEP_A::STEP2 => 1,
31 STEP_A::STEP4 => 2,
32 STEP_A::STEP8 => 3,
33 }
34 }
35}
36#[doc = "Reader of field `STEP`"]
37pub type STEP_R = crate::R<u8, STEP_A>;
38impl STEP_R {
39 #[doc = r"Get enumerated values variant"]
40 #[inline(always)]
41 pub fn variant(&self) -> crate::Variant<u8, STEP_A> {
42 use crate::Variant::*;
43 match self.bits {
44 0 => Val(STEP_A::STEP1),
45 1 => Val(STEP_A::STEP2),
46 2 => Val(STEP_A::STEP4),
47 3 => Val(STEP_A::STEP8),
48 i => Res(i),
49 }
50 }
51 #[doc = "Checks if the value of the field is `STEP1`"]
52 #[inline(always)]
53 pub fn is_step1(&self) -> bool {
54 *self == STEP_A::STEP1
55 }
56 #[doc = "Checks if the value of the field is `STEP2`"]
57 #[inline(always)]
58 pub fn is_step2(&self) -> bool {
59 *self == STEP_A::STEP2
60 }
61 #[doc = "Checks if the value of the field is `STEP4`"]
62 #[inline(always)]
63 pub fn is_step4(&self) -> bool {
64 *self == STEP_A::STEP4
65 }
66 #[doc = "Checks if the value of the field is `STEP8`"]
67 #[inline(always)]
68 pub fn is_step8(&self) -> bool {
69 *self == STEP_A::STEP8
70 }
71}
72#[doc = "Write proxy for field `STEP`"]
73pub struct STEP_W<'a> {
74 w: &'a mut W,
75}
76impl<'a> STEP_W<'a> {
77 #[doc = r"Writes `variant` to the field"]
78 #[inline(always)]
79 pub fn variant(self, variant: STEP_A) -> &'a mut W {
80 use crate::ToBits;
81 unsafe { self.bits(variant._bits()) }
82 }
83 #[doc = "Dither Step = 1"]
84 #[inline(always)]
85 pub fn step1(self) -> &'a mut W {
86 self.variant(STEP_A::STEP1)
87 }
88 #[doc = "Dither Step = 2"]
89 #[inline(always)]
90 pub fn step2(self) -> &'a mut W {
91 self.variant(STEP_A::STEP2)
92 }
93 #[doc = "Dither Step = 4"]
94 #[inline(always)]
95 pub fn step4(self) -> &'a mut W {
96 self.variant(STEP_A::STEP4)
97 }
98 #[doc = "Dither Step = 8"]
99 #[inline(always)]
100 pub fn step8(self) -> &'a mut W {
101 self.variant(STEP_A::STEP8)
102 }
103 #[doc = r"Writes raw bits to the field"]
104 #[inline(always)]
105 pub unsafe fn bits(self, value: u8) -> &'a mut W {
106 self.w.bits = (self.w.bits & !0x07) | ((value as u8) & 0x07);
107 self.w
108 }
109}
110#[doc = "Possible values of the field `PER`"]
111#[derive(Clone, Copy, Debug, PartialEq)]
112pub enum PER_A {
113 #[doc = "Dither Over 1 Reference Clock Period"]
114 PER1,
115 #[doc = "Dither Over 2 Reference Clock Period"]
116 PER2,
117 #[doc = "Dither Over 4 Reference Clock Period"]
118 PER4,
119 #[doc = "Dither Over 8 Reference Clock Period"]
120 PER8,
121 #[doc = "Dither Over 16 Reference Clock Period"]
122 PER16,
123 #[doc = "Dither Over 32 Reference Clock Period"]
124 PER32,
125}
126impl crate::ToBits<u8> for PER_A {
127 #[inline(always)]
128 fn _bits(&self) -> u8 {
129 match *self {
130 PER_A::PER1 => 0,
131 PER_A::PER2 => 1,
132 PER_A::PER4 => 2,
133 PER_A::PER8 => 3,
134 PER_A::PER16 => 4,
135 PER_A::PER32 => 5,
136 }
137 }
138}
139#[doc = "Reader of field `PER`"]
140pub type PER_R = crate::R<u8, PER_A>;
141impl PER_R {
142 #[doc = r"Get enumerated values variant"]
143 #[inline(always)]
144 pub fn variant(&self) -> crate::Variant<u8, PER_A> {
145 use crate::Variant::*;
146 match self.bits {
147 0 => Val(PER_A::PER1),
148 1 => Val(PER_A::PER2),
149 2 => Val(PER_A::PER4),
150 3 => Val(PER_A::PER8),
151 4 => Val(PER_A::PER16),
152 5 => Val(PER_A::PER32),
153 i => Res(i),
154 }
155 }
156 #[doc = "Checks if the value of the field is `PER1`"]
157 #[inline(always)]
158 pub fn is_per1(&self) -> bool {
159 *self == PER_A::PER1
160 }
161 #[doc = "Checks if the value of the field is `PER2`"]
162 #[inline(always)]
163 pub fn is_per2(&self) -> bool {
164 *self == PER_A::PER2
165 }
166 #[doc = "Checks if the value of the field is `PER4`"]
167 #[inline(always)]
168 pub fn is_per4(&self) -> bool {
169 *self == PER_A::PER4
170 }
171 #[doc = "Checks if the value of the field is `PER8`"]
172 #[inline(always)]
173 pub fn is_per8(&self) -> bool {
174 *self == PER_A::PER8
175 }
176 #[doc = "Checks if the value of the field is `PER16`"]
177 #[inline(always)]
178 pub fn is_per16(&self) -> bool {
179 *self == PER_A::PER16
180 }
181 #[doc = "Checks if the value of the field is `PER32`"]
182 #[inline(always)]
183 pub fn is_per32(&self) -> bool {
184 *self == PER_A::PER32
185 }
186}
187#[doc = "Write proxy for field `PER`"]
188pub struct PER_W<'a> {
189 w: &'a mut W,
190}
191impl<'a> PER_W<'a> {
192 #[doc = r"Writes `variant` to the field"]
193 #[inline(always)]
194 pub fn variant(self, variant: PER_A) -> &'a mut W {
195 use crate::ToBits;
196 unsafe { self.bits(variant._bits()) }
197 }
198 #[doc = "Dither Over 1 Reference Clock Period"]
199 #[inline(always)]
200 pub fn per1(self) -> &'a mut W {
201 self.variant(PER_A::PER1)
202 }
203 #[doc = "Dither Over 2 Reference Clock Period"]
204 #[inline(always)]
205 pub fn per2(self) -> &'a mut W {
206 self.variant(PER_A::PER2)
207 }
208 #[doc = "Dither Over 4 Reference Clock Period"]
209 #[inline(always)]
210 pub fn per4(self) -> &'a mut W {
211 self.variant(PER_A::PER4)
212 }
213 #[doc = "Dither Over 8 Reference Clock Period"]
214 #[inline(always)]
215 pub fn per8(self) -> &'a mut W {
216 self.variant(PER_A::PER8)
217 }
218 #[doc = "Dither Over 16 Reference Clock Period"]
219 #[inline(always)]
220 pub fn per16(self) -> &'a mut W {
221 self.variant(PER_A::PER16)
222 }
223 #[doc = "Dither Over 32 Reference Clock Period"]
224 #[inline(always)]
225 pub fn per32(self) -> &'a mut W {
226 self.variant(PER_A::PER32)
227 }
228 #[doc = r"Writes raw bits to the field"]
229 #[inline(always)]
230 pub unsafe fn bits(self, value: u8) -> &'a mut W {
231 self.w.bits = (self.w.bits & !(0x07 << 4)) | (((value as u8) & 0x07) << 4);
232 self.w
233 }
234}
235impl R {
236 #[doc = "Bits 0:2 - Dither Step"]
237 #[inline(always)]
238 pub fn step(&self) -> STEP_R {
239 STEP_R::new((self.bits & 0x07) as u8)
240 }
241 #[doc = "Bits 4:6 - Dither Period"]
242 #[inline(always)]
243 pub fn per(&self) -> PER_R {
244 PER_R::new(((self.bits >> 4) & 0x07) as u8)
245 }
246}
247impl W {
248 #[doc = "Bits 0:2 - Dither Step"]
249 #[inline(always)]
250 pub fn step(&mut self) -> STEP_W {
251 STEP_W { w: self }
252 }
253 #[doc = "Bits 4:6 - Dither Period"]
254 #[inline(always)]
255 pub fn per(&mut self) -> PER_W {
256 PER_W { w: self }
257 }
258}