1#[doc = r" Value read from the register"]
2pub struct R {
3 bits: u8,
4}
5#[doc = r" Value to write to the register"]
6pub struct W {
7 bits: u8,
8}
9impl super::F {
10 #[doc = r" Modifies the contents of the register"]
11 #[inline]
12 pub fn modify<F>(&self, f: F)
13 where
14 for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W,
15 {
16 let bits = self.register.get();
17 let r = R { bits: bits };
18 let mut w = W { bits: bits };
19 f(&r, &mut w);
20 self.register.set(w.bits);
21 }
22 #[doc = r" Reads the contents of the register"]
23 #[inline]
24 pub fn read(&self) -> R {
25 R {
26 bits: self.register.get(),
27 }
28 }
29 #[doc = r" Writes to the register"]
30 #[inline]
31 pub fn write<F>(&self, f: F)
32 where
33 F: FnOnce(&mut W) -> &mut W,
34 {
35 let mut w = W::reset_value();
36 f(&mut w);
37 self.register.set(w.bits);
38 }
39 #[doc = r" Writes the reset value to the register"]
40 #[inline]
41 pub fn reset(&self) {
42 self.write(|w| w)
43 }
44}
45#[doc = r" Value of the field"]
46pub struct ICRR {
47 bits: u8,
48}
49impl ICRR {
50 #[doc = r" Value of the field as raw bits"]
51 #[inline]
52 pub fn bits(&self) -> u8 {
53 self.bits
54 }
55}
56#[doc = "Possible values of the field `MULT`"]
57#[derive(Clone, Copy, Debug, PartialEq)]
58pub enum MULTR {
59 #[doc = "mul = 1"]
60 _00,
61 #[doc = "mul = 2"]
62 _01,
63 #[doc = "mul = 4"]
64 _10,
65 #[doc = r" Reserved"]
66 _Reserved(u8),
67}
68impl MULTR {
69 #[doc = r" Value of the field as raw bits"]
70 #[inline]
71 pub fn bits(&self) -> u8 {
72 match *self {
73 MULTR::_00 => 0,
74 MULTR::_01 => 1,
75 MULTR::_10 => 2,
76 MULTR::_Reserved(bits) => bits,
77 }
78 }
79 #[allow(missing_docs)]
80 #[doc(hidden)]
81 #[inline]
82 pub fn _from(value: u8) -> MULTR {
83 match value {
84 0 => MULTR::_00,
85 1 => MULTR::_01,
86 2 => MULTR::_10,
87 i => MULTR::_Reserved(i),
88 }
89 }
90 #[doc = "Checks if the value of the field is `_00`"]
91 #[inline]
92 pub fn is_00(&self) -> bool {
93 *self == MULTR::_00
94 }
95 #[doc = "Checks if the value of the field is `_01`"]
96 #[inline]
97 pub fn is_01(&self) -> bool {
98 *self == MULTR::_01
99 }
100 #[doc = "Checks if the value of the field is `_10`"]
101 #[inline]
102 pub fn is_10(&self) -> bool {
103 *self == MULTR::_10
104 }
105}
106#[doc = r" Proxy"]
107pub struct _ICRW<'a> {
108 w: &'a mut W,
109}
110impl<'a> _ICRW<'a> {
111 #[doc = r" Writes raw bits to the field"]
112 #[inline]
113 pub unsafe fn bits(self, value: u8) -> &'a mut W {
114 const MASK: u8 = 63;
115 const OFFSET: u8 = 0;
116 self.w.bits &= !((MASK as u8) << OFFSET);
117 self.w.bits |= ((value & MASK) as u8) << OFFSET;
118 self.w
119 }
120}
121#[doc = "Values that can be written to the field `MULT`"]
122pub enum MULTW {
123 #[doc = "mul = 1"]
124 _00,
125 #[doc = "mul = 2"]
126 _01,
127 #[doc = "mul = 4"]
128 _10,
129}
130impl MULTW {
131 #[allow(missing_docs)]
132 #[doc(hidden)]
133 #[inline]
134 pub fn _bits(&self) -> u8 {
135 match *self {
136 MULTW::_00 => 0,
137 MULTW::_01 => 1,
138 MULTW::_10 => 2,
139 }
140 }
141}
142#[doc = r" Proxy"]
143pub struct _MULTW<'a> {
144 w: &'a mut W,
145}
146impl<'a> _MULTW<'a> {
147 #[doc = r" Writes `variant` to the field"]
148 #[inline]
149 pub fn variant(self, variant: MULTW) -> &'a mut W {
150 unsafe { self.bits(variant._bits()) }
151 }
152 #[doc = "mul = 1"]
153 #[inline]
154 pub fn _00(self) -> &'a mut W {
155 self.variant(MULTW::_00)
156 }
157 #[doc = "mul = 2"]
158 #[inline]
159 pub fn _01(self) -> &'a mut W {
160 self.variant(MULTW::_01)
161 }
162 #[doc = "mul = 4"]
163 #[inline]
164 pub fn _10(self) -> &'a mut W {
165 self.variant(MULTW::_10)
166 }
167 #[doc = r" Writes raw bits to the field"]
168 #[inline]
169 pub unsafe fn bits(self, value: u8) -> &'a mut W {
170 const MASK: u8 = 3;
171 const OFFSET: u8 = 6;
172 self.w.bits &= !((MASK as u8) << OFFSET);
173 self.w.bits |= ((value & MASK) as u8) << OFFSET;
174 self.w
175 }
176}
177impl R {
178 #[doc = r" Value of the register as raw bits"]
179 #[inline]
180 pub fn bits(&self) -> u8 {
181 self.bits
182 }
183 #[doc = "Bits 0:5 - ClockRate"]
184 #[inline]
185 pub fn icr(&self) -> ICRR {
186 let bits = {
187 const MASK: u8 = 63;
188 const OFFSET: u8 = 0;
189 ((self.bits >> OFFSET) & MASK as u8) as u8
190 };
191 ICRR { bits }
192 }
193 #[doc = "Bits 6:7 - Multiplier Factor"]
194 #[inline]
195 pub fn mult(&self) -> MULTR {
196 MULTR::_from({
197 const MASK: u8 = 3;
198 const OFFSET: u8 = 6;
199 ((self.bits >> OFFSET) & MASK as u8) as u8
200 })
201 }
202}
203impl W {
204 #[doc = r" Reset value of the register"]
205 #[inline]
206 pub fn reset_value() -> W {
207 W { bits: 0 }
208 }
209 #[doc = r" Writes raw bits to the register"]
210 #[inline]
211 pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
212 self.bits = bits;
213 self
214 }
215 #[doc = "Bits 0:5 - ClockRate"]
216 #[inline]
217 pub fn icr(&mut self) -> _ICRW {
218 _ICRW { w: self }
219 }
220 #[doc = "Bits 6:7 - Multiplier Factor"]
221 #[inline]
222 pub fn mult(&mut self) -> _MULTW {
223 _MULTW { w: self }
224 }
225}