msp430f249 0.1.1

Peripheral access API for MSP430F249 microcontroller
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
#[doc = "Register `ADC12MCTL10` reader"]
pub struct R(crate::R<ADC12MCTL10_SPEC>);
impl core::ops::Deref for R {
    type Target = crate::R<ADC12MCTL10_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl From<crate::R<ADC12MCTL10_SPEC>> for R {
    #[inline(always)]
    fn from(reader: crate::R<ADC12MCTL10_SPEC>) -> Self {
        R(reader)
    }
}
#[doc = "Register `ADC12MCTL10` writer"]
pub struct W(crate::W<ADC12MCTL10_SPEC>);
impl core::ops::Deref for W {
    type Target = crate::W<ADC12MCTL10_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl core::ops::DerefMut for W {
    #[inline(always)]
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl From<crate::W<ADC12MCTL10_SPEC>> for W {
    #[inline(always)]
    fn from(writer: crate::W<ADC12MCTL10_SPEC>) -> Self {
        W(writer)
    }
}
#[doc = "Field `INCH` reader - ADC12 Input Channel Select Bit 0"]
pub type INCH_R = crate::FieldReader<INCH_A>;
#[doc = "ADC12 Input Channel Select Bit 0\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum INCH_A {
    #[doc = "0: ADC12 Input Channel 0"]
    INCH_0 = 0,
    #[doc = "1: ADC12 Input Channel 1"]
    INCH_1 = 1,
    #[doc = "2: ADC12 Input Channel 2"]
    INCH_2 = 2,
    #[doc = "3: ADC12 Input Channel 3"]
    INCH_3 = 3,
    #[doc = "4: ADC12 Input Channel 4"]
    INCH_4 = 4,
    #[doc = "5: ADC12 Input Channel 5"]
    INCH_5 = 5,
    #[doc = "6: ADC12 Input Channel 6"]
    INCH_6 = 6,
    #[doc = "7: ADC12 Input Channel 7"]
    INCH_7 = 7,
    #[doc = "8: ADC12 Input Channel 8"]
    INCH_8 = 8,
    #[doc = "9: ADC12 Input Channel 9"]
    INCH_9 = 9,
    #[doc = "10: ADC12 Input Channel 10"]
    INCH_10 = 10,
    #[doc = "11: ADC12 Input Channel 11"]
    INCH_11 = 11,
    #[doc = "12: ADC12 Input Channel 12"]
    INCH_12 = 12,
    #[doc = "13: ADC12 Input Channel 13"]
    INCH_13 = 13,
    #[doc = "14: ADC12 Input Channel 14"]
    INCH_14 = 14,
    #[doc = "15: ADC12 Input Channel 15"]
    INCH_15 = 15,
}
impl From<INCH_A> for u8 {
    #[inline(always)]
    fn from(variant: INCH_A) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for INCH_A {
    type Ux = u8;
}
impl INCH_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> INCH_A {
        match self.bits {
            0 => INCH_A::INCH_0,
            1 => INCH_A::INCH_1,
            2 => INCH_A::INCH_2,
            3 => INCH_A::INCH_3,
            4 => INCH_A::INCH_4,
            5 => INCH_A::INCH_5,
            6 => INCH_A::INCH_6,
            7 => INCH_A::INCH_7,
            8 => INCH_A::INCH_8,
            9 => INCH_A::INCH_9,
            10 => INCH_A::INCH_10,
            11 => INCH_A::INCH_11,
            12 => INCH_A::INCH_12,
            13 => INCH_A::INCH_13,
            14 => INCH_A::INCH_14,
            15 => INCH_A::INCH_15,
            _ => unreachable!(),
        }
    }
    #[doc = "Checks if the value of the field is `INCH_0`"]
    #[inline(always)]
    pub fn is_inch_0(&self) -> bool {
        *self == INCH_A::INCH_0
    }
    #[doc = "Checks if the value of the field is `INCH_1`"]
    #[inline(always)]
    pub fn is_inch_1(&self) -> bool {
        *self == INCH_A::INCH_1
    }
    #[doc = "Checks if the value of the field is `INCH_2`"]
    #[inline(always)]
    pub fn is_inch_2(&self) -> bool {
        *self == INCH_A::INCH_2
    }
    #[doc = "Checks if the value of the field is `INCH_3`"]
    #[inline(always)]
    pub fn is_inch_3(&self) -> bool {
        *self == INCH_A::INCH_3
    }
    #[doc = "Checks if the value of the field is `INCH_4`"]
    #[inline(always)]
    pub fn is_inch_4(&self) -> bool {
        *self == INCH_A::INCH_4
    }
    #[doc = "Checks if the value of the field is `INCH_5`"]
    #[inline(always)]
    pub fn is_inch_5(&self) -> bool {
        *self == INCH_A::INCH_5
    }
    #[doc = "Checks if the value of the field is `INCH_6`"]
    #[inline(always)]
    pub fn is_inch_6(&self) -> bool {
        *self == INCH_A::INCH_6
    }
    #[doc = "Checks if the value of the field is `INCH_7`"]
    #[inline(always)]
    pub fn is_inch_7(&self) -> bool {
        *self == INCH_A::INCH_7
    }
    #[doc = "Checks if the value of the field is `INCH_8`"]
    #[inline(always)]
    pub fn is_inch_8(&self) -> bool {
        *self == INCH_A::INCH_8
    }
    #[doc = "Checks if the value of the field is `INCH_9`"]
    #[inline(always)]
    pub fn is_inch_9(&self) -> bool {
        *self == INCH_A::INCH_9
    }
    #[doc = "Checks if the value of the field is `INCH_10`"]
    #[inline(always)]
    pub fn is_inch_10(&self) -> bool {
        *self == INCH_A::INCH_10
    }
    #[doc = "Checks if the value of the field is `INCH_11`"]
    #[inline(always)]
    pub fn is_inch_11(&self) -> bool {
        *self == INCH_A::INCH_11
    }
    #[doc = "Checks if the value of the field is `INCH_12`"]
    #[inline(always)]
    pub fn is_inch_12(&self) -> bool {
        *self == INCH_A::INCH_12
    }
    #[doc = "Checks if the value of the field is `INCH_13`"]
    #[inline(always)]
    pub fn is_inch_13(&self) -> bool {
        *self == INCH_A::INCH_13
    }
    #[doc = "Checks if the value of the field is `INCH_14`"]
    #[inline(always)]
    pub fn is_inch_14(&self) -> bool {
        *self == INCH_A::INCH_14
    }
    #[doc = "Checks if the value of the field is `INCH_15`"]
    #[inline(always)]
    pub fn is_inch_15(&self) -> bool {
        *self == INCH_A::INCH_15
    }
}
#[doc = "Field `INCH` writer - ADC12 Input Channel Select Bit 0"]
pub type INCH_W<'a, const O: u8> = crate::FieldWriterSafe<'a, ADC12MCTL10_SPEC, 4, O, INCH_A>;
impl<'a, const O: u8> INCH_W<'a, O> {
    #[doc = "ADC12 Input Channel 0"]
    #[inline(always)]
    pub fn inch_0(self) -> &'a mut W {
        self.variant(INCH_A::INCH_0)
    }
    #[doc = "ADC12 Input Channel 1"]
    #[inline(always)]
    pub fn inch_1(self) -> &'a mut W {
        self.variant(INCH_A::INCH_1)
    }
    #[doc = "ADC12 Input Channel 2"]
    #[inline(always)]
    pub fn inch_2(self) -> &'a mut W {
        self.variant(INCH_A::INCH_2)
    }
    #[doc = "ADC12 Input Channel 3"]
    #[inline(always)]
    pub fn inch_3(self) -> &'a mut W {
        self.variant(INCH_A::INCH_3)
    }
    #[doc = "ADC12 Input Channel 4"]
    #[inline(always)]
    pub fn inch_4(self) -> &'a mut W {
        self.variant(INCH_A::INCH_4)
    }
    #[doc = "ADC12 Input Channel 5"]
    #[inline(always)]
    pub fn inch_5(self) -> &'a mut W {
        self.variant(INCH_A::INCH_5)
    }
    #[doc = "ADC12 Input Channel 6"]
    #[inline(always)]
    pub fn inch_6(self) -> &'a mut W {
        self.variant(INCH_A::INCH_6)
    }
    #[doc = "ADC12 Input Channel 7"]
    #[inline(always)]
    pub fn inch_7(self) -> &'a mut W {
        self.variant(INCH_A::INCH_7)
    }
    #[doc = "ADC12 Input Channel 8"]
    #[inline(always)]
    pub fn inch_8(self) -> &'a mut W {
        self.variant(INCH_A::INCH_8)
    }
    #[doc = "ADC12 Input Channel 9"]
    #[inline(always)]
    pub fn inch_9(self) -> &'a mut W {
        self.variant(INCH_A::INCH_9)
    }
    #[doc = "ADC12 Input Channel 10"]
    #[inline(always)]
    pub fn inch_10(self) -> &'a mut W {
        self.variant(INCH_A::INCH_10)
    }
    #[doc = "ADC12 Input Channel 11"]
    #[inline(always)]
    pub fn inch_11(self) -> &'a mut W {
        self.variant(INCH_A::INCH_11)
    }
    #[doc = "ADC12 Input Channel 12"]
    #[inline(always)]
    pub fn inch_12(self) -> &'a mut W {
        self.variant(INCH_A::INCH_12)
    }
    #[doc = "ADC12 Input Channel 13"]
    #[inline(always)]
    pub fn inch_13(self) -> &'a mut W {
        self.variant(INCH_A::INCH_13)
    }
    #[doc = "ADC12 Input Channel 14"]
    #[inline(always)]
    pub fn inch_14(self) -> &'a mut W {
        self.variant(INCH_A::INCH_14)
    }
    #[doc = "ADC12 Input Channel 15"]
    #[inline(always)]
    pub fn inch_15(self) -> &'a mut W {
        self.variant(INCH_A::INCH_15)
    }
}
#[doc = "Field `SREF` reader - ADC12 Select Reference Bit 0"]
pub type SREF_R = crate::FieldReader<SREF_A>;
#[doc = "ADC12 Select Reference Bit 0\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum SREF_A {
    #[doc = "0: ADC12 Select Reference 0"]
    SREF_0 = 0,
    #[doc = "1: ADC12 Select Reference 1"]
    SREF_1 = 1,
    #[doc = "2: ADC12 Select Reference 2"]
    SREF_2 = 2,
    #[doc = "3: ADC12 Select Reference 3"]
    SREF_3 = 3,
    #[doc = "4: ADC12 Select Reference 4"]
    SREF_4 = 4,
    #[doc = "5: ADC12 Select Reference 5"]
    SREF_5 = 5,
    #[doc = "6: ADC12 Select Reference 6"]
    SREF_6 = 6,
    #[doc = "7: ADC12 Select Reference 7"]
    SREF_7 = 7,
}
impl From<SREF_A> for u8 {
    #[inline(always)]
    fn from(variant: SREF_A) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for SREF_A {
    type Ux = u8;
}
impl SREF_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> SREF_A {
        match self.bits {
            0 => SREF_A::SREF_0,
            1 => SREF_A::SREF_1,
            2 => SREF_A::SREF_2,
            3 => SREF_A::SREF_3,
            4 => SREF_A::SREF_4,
            5 => SREF_A::SREF_5,
            6 => SREF_A::SREF_6,
            7 => SREF_A::SREF_7,
            _ => unreachable!(),
        }
    }
    #[doc = "Checks if the value of the field is `SREF_0`"]
    #[inline(always)]
    pub fn is_sref_0(&self) -> bool {
        *self == SREF_A::SREF_0
    }
    #[doc = "Checks if the value of the field is `SREF_1`"]
    #[inline(always)]
    pub fn is_sref_1(&self) -> bool {
        *self == SREF_A::SREF_1
    }
    #[doc = "Checks if the value of the field is `SREF_2`"]
    #[inline(always)]
    pub fn is_sref_2(&self) -> bool {
        *self == SREF_A::SREF_2
    }
    #[doc = "Checks if the value of the field is `SREF_3`"]
    #[inline(always)]
    pub fn is_sref_3(&self) -> bool {
        *self == SREF_A::SREF_3
    }
    #[doc = "Checks if the value of the field is `SREF_4`"]
    #[inline(always)]
    pub fn is_sref_4(&self) -> bool {
        *self == SREF_A::SREF_4
    }
    #[doc = "Checks if the value of the field is `SREF_5`"]
    #[inline(always)]
    pub fn is_sref_5(&self) -> bool {
        *self == SREF_A::SREF_5
    }
    #[doc = "Checks if the value of the field is `SREF_6`"]
    #[inline(always)]
    pub fn is_sref_6(&self) -> bool {
        *self == SREF_A::SREF_6
    }
    #[doc = "Checks if the value of the field is `SREF_7`"]
    #[inline(always)]
    pub fn is_sref_7(&self) -> bool {
        *self == SREF_A::SREF_7
    }
}
#[doc = "Field `SREF` writer - ADC12 Select Reference Bit 0"]
pub type SREF_W<'a, const O: u8> = crate::FieldWriterSafe<'a, ADC12MCTL10_SPEC, 3, O, SREF_A>;
impl<'a, const O: u8> SREF_W<'a, O> {
    #[doc = "ADC12 Select Reference 0"]
    #[inline(always)]
    pub fn sref_0(self) -> &'a mut W {
        self.variant(SREF_A::SREF_0)
    }
    #[doc = "ADC12 Select Reference 1"]
    #[inline(always)]
    pub fn sref_1(self) -> &'a mut W {
        self.variant(SREF_A::SREF_1)
    }
    #[doc = "ADC12 Select Reference 2"]
    #[inline(always)]
    pub fn sref_2(self) -> &'a mut W {
        self.variant(SREF_A::SREF_2)
    }
    #[doc = "ADC12 Select Reference 3"]
    #[inline(always)]
    pub fn sref_3(self) -> &'a mut W {
        self.variant(SREF_A::SREF_3)
    }
    #[doc = "ADC12 Select Reference 4"]
    #[inline(always)]
    pub fn sref_4(self) -> &'a mut W {
        self.variant(SREF_A::SREF_4)
    }
    #[doc = "ADC12 Select Reference 5"]
    #[inline(always)]
    pub fn sref_5(self) -> &'a mut W {
        self.variant(SREF_A::SREF_5)
    }
    #[doc = "ADC12 Select Reference 6"]
    #[inline(always)]
    pub fn sref_6(self) -> &'a mut W {
        self.variant(SREF_A::SREF_6)
    }
    #[doc = "ADC12 Select Reference 7"]
    #[inline(always)]
    pub fn sref_7(self) -> &'a mut W {
        self.variant(SREF_A::SREF_7)
    }
}
#[doc = "Field `EOS` reader - ADC12 End of Sequence"]
pub type EOS_R = crate::BitReader;
#[doc = "Field `EOS` writer - ADC12 End of Sequence"]
pub type EOS_W<'a, const O: u8> = crate::BitWriter<'a, ADC12MCTL10_SPEC, O>;
impl R {
    #[doc = "Bits 0:3 - ADC12 Input Channel Select Bit 0"]
    #[inline(always)]
    pub fn inch(&self) -> INCH_R {
        INCH_R::new(self.bits & 0x0f)
    }
    #[doc = "Bits 4:6 - ADC12 Select Reference Bit 0"]
    #[inline(always)]
    pub fn sref(&self) -> SREF_R {
        SREF_R::new((self.bits >> 4) & 7)
    }
    #[doc = "Bit 7 - ADC12 End of Sequence"]
    #[inline(always)]
    pub fn eos(&self) -> EOS_R {
        EOS_R::new(((self.bits >> 7) & 1) != 0)
    }
}
impl W {
    #[doc = "Bits 0:3 - ADC12 Input Channel Select Bit 0"]
    #[inline(always)]
    #[must_use]
    pub fn inch(&mut self) -> INCH_W<0> {
        INCH_W::new(self)
    }
    #[doc = "Bits 4:6 - ADC12 Select Reference Bit 0"]
    #[inline(always)]
    #[must_use]
    pub fn sref(&mut self) -> SREF_W<4> {
        SREF_W::new(self)
    }
    #[doc = "Bit 7 - ADC12 End of Sequence"]
    #[inline(always)]
    #[must_use]
    pub fn eos(&mut self) -> EOS_W<7> {
        EOS_W::new(self)
    }
    #[doc = "Writes raw bits to the register."]
    #[inline(always)]
    pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
        self.0.bits(bits);
        self
    }
}
#[doc = "ADC12 Memory Control 10\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [adc12mctl10](index.html) module"]
pub struct ADC12MCTL10_SPEC;
impl crate::RegisterSpec for ADC12MCTL10_SPEC {
    type Ux = u8;
}
#[doc = "`read()` method returns [adc12mctl10::R](R) reader structure"]
impl crate::Readable for ADC12MCTL10_SPEC {
    type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [adc12mctl10::W](W) writer structure"]
impl crate::Writable for ADC12MCTL10_SPEC {
    type Writer = W;
    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
}
#[doc = "`reset()` method sets ADC12MCTL10 to value 0"]
impl crate::Resettable for ADC12MCTL10_SPEC {
    const RESET_VALUE: Self::Ux = 0;
}