1#[doc = "Reader of register SMCR"]
2pub type R = crate::R<u32, super::SMCR>;
3#[doc = "Writer for register SMCR"]
4pub type W = crate::W<u32, super::SMCR>;
5#[doc = "Register SMCR `reset()`'s with value 0"]
6impl crate::ResetValue for super::SMCR {
7 type Type = u32;
8 #[inline(always)]
9 fn reset_value() -> Self::Type {
10 0
11 }
12}
13#[doc = "Reader of field `SMS`"]
14pub type SMS_R = crate::R<u8, u8>;
15#[doc = "Write proxy for field `SMS`"]
16pub struct SMS_W<'a> {
17 w: &'a mut W,
18}
19impl<'a> SMS_W<'a> {
20 #[doc = r"Writes raw bits to the field"]
21 #[inline(always)]
22 pub unsafe fn bits(self, value: u8) -> &'a mut W {
23 self.w.bits = (self.w.bits & !0x07) | ((value as u32) & 0x07);
24 self.w
25 }
26}
27#[doc = "Reader of field `OCCS`"]
28pub type OCCS_R = crate::R<bool, bool>;
29#[doc = "Write proxy for field `OCCS`"]
30pub struct OCCS_W<'a> {
31 w: &'a mut W,
32}
33impl<'a> OCCS_W<'a> {
34 #[doc = r"Sets the field bit"]
35 #[inline(always)]
36 pub fn set_bit(self) -> &'a mut W {
37 self.bit(true)
38 }
39 #[doc = r"Clears the field bit"]
40 #[inline(always)]
41 pub fn clear_bit(self) -> &'a mut W {
42 self.bit(false)
43 }
44 #[doc = r"Writes raw bits to the field"]
45 #[inline(always)]
46 pub fn bit(self, value: bool) -> &'a mut W {
47 self.w.bits = (self.w.bits & !(0x01 << 3)) | (((value as u32) & 0x01) << 3);
48 self.w
49 }
50}
51#[doc = "Reader of field `TS`"]
52pub type TS_R = crate::R<u8, u8>;
53#[doc = "Write proxy for field `TS`"]
54pub struct TS_W<'a> {
55 w: &'a mut W,
56}
57impl<'a> TS_W<'a> {
58 #[doc = r"Writes raw bits to the field"]
59 #[inline(always)]
60 pub unsafe fn bits(self, value: u8) -> &'a mut W {
61 self.w.bits = (self.w.bits & !(0x07 << 4)) | (((value as u32) & 0x07) << 4);
62 self.w
63 }
64}
65#[doc = "Reader of field `MSM`"]
66pub type MSM_R = crate::R<bool, bool>;
67#[doc = "Write proxy for field `MSM`"]
68pub struct MSM_W<'a> {
69 w: &'a mut W,
70}
71impl<'a> MSM_W<'a> {
72 #[doc = r"Sets the field bit"]
73 #[inline(always)]
74 pub fn set_bit(self) -> &'a mut W {
75 self.bit(true)
76 }
77 #[doc = r"Clears the field bit"]
78 #[inline(always)]
79 pub fn clear_bit(self) -> &'a mut W {
80 self.bit(false)
81 }
82 #[doc = r"Writes raw bits to the field"]
83 #[inline(always)]
84 pub fn bit(self, value: bool) -> &'a mut W {
85 self.w.bits = (self.w.bits & !(0x01 << 7)) | (((value as u32) & 0x01) << 7);
86 self.w
87 }
88}
89#[doc = "Reader of field `ETF`"]
90pub type ETF_R = crate::R<u8, u8>;
91#[doc = "Write proxy for field `ETF`"]
92pub struct ETF_W<'a> {
93 w: &'a mut W,
94}
95impl<'a> ETF_W<'a> {
96 #[doc = r"Writes raw bits to the field"]
97 #[inline(always)]
98 pub unsafe fn bits(self, value: u8) -> &'a mut W {
99 self.w.bits = (self.w.bits & !(0x0f << 8)) | (((value as u32) & 0x0f) << 8);
100 self.w
101 }
102}
103#[doc = "Reader of field `ETPS`"]
104pub type ETPS_R = crate::R<u8, u8>;
105#[doc = "Write proxy for field `ETPS`"]
106pub struct ETPS_W<'a> {
107 w: &'a mut W,
108}
109impl<'a> ETPS_W<'a> {
110 #[doc = r"Writes raw bits to the field"]
111 #[inline(always)]
112 pub unsafe fn bits(self, value: u8) -> &'a mut W {
113 self.w.bits = (self.w.bits & !(0x03 << 12)) | (((value as u32) & 0x03) << 12);
114 self.w
115 }
116}
117#[doc = "Reader of field `ECE`"]
118pub type ECE_R = crate::R<bool, bool>;
119#[doc = "Write proxy for field `ECE`"]
120pub struct ECE_W<'a> {
121 w: &'a mut W,
122}
123impl<'a> ECE_W<'a> {
124 #[doc = r"Sets the field bit"]
125 #[inline(always)]
126 pub fn set_bit(self) -> &'a mut W {
127 self.bit(true)
128 }
129 #[doc = r"Clears the field bit"]
130 #[inline(always)]
131 pub fn clear_bit(self) -> &'a mut W {
132 self.bit(false)
133 }
134 #[doc = r"Writes raw bits to the field"]
135 #[inline(always)]
136 pub fn bit(self, value: bool) -> &'a mut W {
137 self.w.bits = (self.w.bits & !(0x01 << 14)) | (((value as u32) & 0x01) << 14);
138 self.w
139 }
140}
141#[doc = "Reader of field `ETP`"]
142pub type ETP_R = crate::R<bool, bool>;
143#[doc = "Write proxy for field `ETP`"]
144pub struct ETP_W<'a> {
145 w: &'a mut W,
146}
147impl<'a> ETP_W<'a> {
148 #[doc = r"Sets the field bit"]
149 #[inline(always)]
150 pub fn set_bit(self) -> &'a mut W {
151 self.bit(true)
152 }
153 #[doc = r"Clears the field bit"]
154 #[inline(always)]
155 pub fn clear_bit(self) -> &'a mut W {
156 self.bit(false)
157 }
158 #[doc = r"Writes raw bits to the field"]
159 #[inline(always)]
160 pub fn bit(self, value: bool) -> &'a mut W {
161 self.w.bits = (self.w.bits & !(0x01 << 15)) | (((value as u32) & 0x01) << 15);
162 self.w
163 }
164}
165#[doc = "Reader of field `SMS_3`"]
166pub type SMS_3_R = crate::R<bool, bool>;
167#[doc = "Write proxy for field `SMS_3`"]
168pub struct SMS_3_W<'a> {
169 w: &'a mut W,
170}
171impl<'a> SMS_3_W<'a> {
172 #[doc = r"Sets the field bit"]
173 #[inline(always)]
174 pub fn set_bit(self) -> &'a mut W {
175 self.bit(true)
176 }
177 #[doc = r"Clears the field bit"]
178 #[inline(always)]
179 pub fn clear_bit(self) -> &'a mut W {
180 self.bit(false)
181 }
182 #[doc = r"Writes raw bits to the field"]
183 #[inline(always)]
184 pub fn bit(self, value: bool) -> &'a mut W {
185 self.w.bits = (self.w.bits & !(0x01 << 16)) | (((value as u32) & 0x01) << 16);
186 self.w
187 }
188}
189impl R {
190 #[doc = "Bits 0:2 - Slave mode selection"]
191 #[inline(always)]
192 pub fn sms(&self) -> SMS_R {
193 SMS_R::new((self.bits & 0x07) as u8)
194 }
195 #[doc = "Bit 3 - OCREF clear selection"]
196 #[inline(always)]
197 pub fn occs(&self) -> OCCS_R {
198 OCCS_R::new(((self.bits >> 3) & 0x01) != 0)
199 }
200 #[doc = "Bits 4:6 - Trigger selection"]
201 #[inline(always)]
202 pub fn ts(&self) -> TS_R {
203 TS_R::new(((self.bits >> 4) & 0x07) as u8)
204 }
205 #[doc = "Bit 7 - Master/Slave mode"]
206 #[inline(always)]
207 pub fn msm(&self) -> MSM_R {
208 MSM_R::new(((self.bits >> 7) & 0x01) != 0)
209 }
210 #[doc = "Bits 8:11 - External trigger filter"]
211 #[inline(always)]
212 pub fn etf(&self) -> ETF_R {
213 ETF_R::new(((self.bits >> 8) & 0x0f) as u8)
214 }
215 #[doc = "Bits 12:13 - External trigger prescaler"]
216 #[inline(always)]
217 pub fn etps(&self) -> ETPS_R {
218 ETPS_R::new(((self.bits >> 12) & 0x03) as u8)
219 }
220 #[doc = "Bit 14 - External clock enable"]
221 #[inline(always)]
222 pub fn ece(&self) -> ECE_R {
223 ECE_R::new(((self.bits >> 14) & 0x01) != 0)
224 }
225 #[doc = "Bit 15 - External trigger polarity"]
226 #[inline(always)]
227 pub fn etp(&self) -> ETP_R {
228 ETP_R::new(((self.bits >> 15) & 0x01) != 0)
229 }
230 #[doc = "Bit 16 - Slave mode selection - bit 3"]
231 #[inline(always)]
232 pub fn sms_3(&self) -> SMS_3_R {
233 SMS_3_R::new(((self.bits >> 16) & 0x01) != 0)
234 }
235}
236impl W {
237 #[doc = "Bits 0:2 - Slave mode selection"]
238 #[inline(always)]
239 pub fn sms(&mut self) -> SMS_W {
240 SMS_W { w: self }
241 }
242 #[doc = "Bit 3 - OCREF clear selection"]
243 #[inline(always)]
244 pub fn occs(&mut self) -> OCCS_W {
245 OCCS_W { w: self }
246 }
247 #[doc = "Bits 4:6 - Trigger selection"]
248 #[inline(always)]
249 pub fn ts(&mut self) -> TS_W {
250 TS_W { w: self }
251 }
252 #[doc = "Bit 7 - Master/Slave mode"]
253 #[inline(always)]
254 pub fn msm(&mut self) -> MSM_W {
255 MSM_W { w: self }
256 }
257 #[doc = "Bits 8:11 - External trigger filter"]
258 #[inline(always)]
259 pub fn etf(&mut self) -> ETF_W {
260 ETF_W { w: self }
261 }
262 #[doc = "Bits 12:13 - External trigger prescaler"]
263 #[inline(always)]
264 pub fn etps(&mut self) -> ETPS_W {
265 ETPS_W { w: self }
266 }
267 #[doc = "Bit 14 - External clock enable"]
268 #[inline(always)]
269 pub fn ece(&mut self) -> ECE_W {
270 ECE_W { w: self }
271 }
272 #[doc = "Bit 15 - External trigger polarity"]
273 #[inline(always)]
274 pub fn etp(&mut self) -> ETP_W {
275 ETP_W { w: self }
276 }
277 #[doc = "Bit 16 - Slave mode selection - bit 3"]
278 #[inline(always)]
279 pub fn sms_3(&mut self) -> SMS_3_W {
280 SMS_3_W { w: self }
281 }
282}