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
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
#[doc = "Register `CSCTL2` reader"]
pub struct R(crate::R<CSCTL2_SPEC>);
impl core::ops::Deref for R {
    type Target = crate::R<CSCTL2_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl core::convert::From<crate::R<CSCTL2_SPEC>> for R {
    fn from(reader: crate::R<CSCTL2_SPEC>) -> Self {
        R(reader)
    }
}
#[doc = "Register `CSCTL2` writer"]
pub struct W(crate::W<CSCTL2_SPEC>);
impl core::ops::Deref for W {
    type Target = crate::W<CSCTL2_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 core::convert::From<crate::W<CSCTL2_SPEC>> for W {
    fn from(writer: crate::W<CSCTL2_SPEC>) -> Self {
        W(writer)
    }
}
#[doc = "LFXT oscillator current can be adjusted to its drive needs\n\nValue on reset: 3"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum LFXTDRIVE_A {
    #[doc = "0: Lowest drive strength and current consumption LFXT oscillator."]
    LFXTDRIVE_0 = 0,
    #[doc = "1: Increased drive strength LFXT oscillator."]
    LFXTDRIVE_1 = 1,
    #[doc = "2: Increased drive strength LFXT oscillator."]
    LFXTDRIVE_2 = 2,
    #[doc = "3: Maximum drive strength and maximum current consumption LFXT oscillator."]
    LFXTDRIVE_3 = 3,
}
impl From<LFXTDRIVE_A> for u8 {
    #[inline(always)]
    fn from(variant: LFXTDRIVE_A) -> Self {
        variant as _
    }
}
#[doc = "Field `LFXTDRIVE` reader - LFXT oscillator current can be adjusted to its drive needs"]
pub struct LFXTDRIVE_R(crate::FieldReader<u8, LFXTDRIVE_A>);
impl LFXTDRIVE_R {
    pub(crate) fn new(bits: u8) -> Self {
        LFXTDRIVE_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> LFXTDRIVE_A {
        match self.bits {
            0 => LFXTDRIVE_A::LFXTDRIVE_0,
            1 => LFXTDRIVE_A::LFXTDRIVE_1,
            2 => LFXTDRIVE_A::LFXTDRIVE_2,
            3 => LFXTDRIVE_A::LFXTDRIVE_3,
            _ => unreachable!(),
        }
    }
    #[doc = "Checks if the value of the field is `LFXTDRIVE_0`"]
    #[inline(always)]
    pub fn is_lfxtdrive_0(&self) -> bool {
        **self == LFXTDRIVE_A::LFXTDRIVE_0
    }
    #[doc = "Checks if the value of the field is `LFXTDRIVE_1`"]
    #[inline(always)]
    pub fn is_lfxtdrive_1(&self) -> bool {
        **self == LFXTDRIVE_A::LFXTDRIVE_1
    }
    #[doc = "Checks if the value of the field is `LFXTDRIVE_2`"]
    #[inline(always)]
    pub fn is_lfxtdrive_2(&self) -> bool {
        **self == LFXTDRIVE_A::LFXTDRIVE_2
    }
    #[doc = "Checks if the value of the field is `LFXTDRIVE_3`"]
    #[inline(always)]
    pub fn is_lfxtdrive_3(&self) -> bool {
        **self == LFXTDRIVE_A::LFXTDRIVE_3
    }
}
impl core::ops::Deref for LFXTDRIVE_R {
    type Target = crate::FieldReader<u8, LFXTDRIVE_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `LFXTDRIVE` writer - LFXT oscillator current can be adjusted to its drive needs"]
pub struct LFXTDRIVE_W<'a> {
    w: &'a mut W,
}
impl<'a> LFXTDRIVE_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: LFXTDRIVE_A) -> &'a mut W {
        self.bits(variant.into())
    }
    #[doc = "Lowest drive strength and current consumption LFXT oscillator."]
    #[inline(always)]
    pub fn lfxtdrive_0(self) -> &'a mut W {
        self.variant(LFXTDRIVE_A::LFXTDRIVE_0)
    }
    #[doc = "Increased drive strength LFXT oscillator."]
    #[inline(always)]
    pub fn lfxtdrive_1(self) -> &'a mut W {
        self.variant(LFXTDRIVE_A::LFXTDRIVE_1)
    }
    #[doc = "Increased drive strength LFXT oscillator."]
    #[inline(always)]
    pub fn lfxtdrive_2(self) -> &'a mut W {
        self.variant(LFXTDRIVE_A::LFXTDRIVE_2)
    }
    #[doc = "Maximum drive strength and maximum current consumption LFXT oscillator."]
    #[inline(always)]
    pub fn lfxtdrive_3(self) -> &'a mut W {
        self.variant(LFXTDRIVE_A::LFXTDRIVE_3)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bits(self, value: u8) -> &'a mut W {
        self.w.bits = (self.w.bits & !0x03) | (value as u32 & 0x03);
        self.w
    }
}
#[doc = "Disables the automatic gain control of the LFXT crystal\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum LFXTAGCOFF_A {
    #[doc = "0: AGC enabled."]
    LFXTAGCOFF_0 = 0,
    #[doc = "1: AGC disabled."]
    LFXTAGCOFF_1 = 1,
}
impl From<LFXTAGCOFF_A> for bool {
    #[inline(always)]
    fn from(variant: LFXTAGCOFF_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `LFXTAGCOFF` reader - Disables the automatic gain control of the LFXT crystal"]
pub struct LFXTAGCOFF_R(crate::FieldReader<bool, LFXTAGCOFF_A>);
impl LFXTAGCOFF_R {
    pub(crate) fn new(bits: bool) -> Self {
        LFXTAGCOFF_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> LFXTAGCOFF_A {
        match self.bits {
            false => LFXTAGCOFF_A::LFXTAGCOFF_0,
            true => LFXTAGCOFF_A::LFXTAGCOFF_1,
        }
    }
    #[doc = "Checks if the value of the field is `LFXTAGCOFF_0`"]
    #[inline(always)]
    pub fn is_lfxtagcoff_0(&self) -> bool {
        **self == LFXTAGCOFF_A::LFXTAGCOFF_0
    }
    #[doc = "Checks if the value of the field is `LFXTAGCOFF_1`"]
    #[inline(always)]
    pub fn is_lfxtagcoff_1(&self) -> bool {
        **self == LFXTAGCOFF_A::LFXTAGCOFF_1
    }
}
impl core::ops::Deref for LFXTAGCOFF_R {
    type Target = crate::FieldReader<bool, LFXTAGCOFF_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `LFXTAGCOFF` writer - Disables the automatic gain control of the LFXT crystal"]
pub struct LFXTAGCOFF_W<'a> {
    w: &'a mut W,
}
impl<'a> LFXTAGCOFF_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: LFXTAGCOFF_A) -> &'a mut W {
        self.bit(variant.into())
    }
    #[doc = "AGC enabled."]
    #[inline(always)]
    pub fn lfxtagcoff_0(self) -> &'a mut W {
        self.variant(LFXTAGCOFF_A::LFXTAGCOFF_0)
    }
    #[doc = "AGC disabled."]
    #[inline(always)]
    pub fn lfxtagcoff_1(self) -> &'a mut W {
        self.variant(LFXTAGCOFF_A::LFXTAGCOFF_1)
    }
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W {
        self.bit(true)
    }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W {
        self.bit(false)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 7)) | ((value as u32 & 0x01) << 7);
        self.w
    }
}
#[doc = "Turns on the LFXT oscillator regardless if used as a clock resource\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum LFXT_EN_A {
    #[doc = "0: LFXT is on if it is used as a source for ACLK, MCLK, HSMCLK , or SMCLK\r\r\nand is selected via the port selection and not in bypass mode of operation."]
    LFXT_EN_0 = 0,
    #[doc = "1: LFXT is on if LFXT is selected via the port selection and LFXT is not in\r\r\nbypass mode of operation."]
    LFXT_EN_1 = 1,
}
impl From<LFXT_EN_A> for bool {
    #[inline(always)]
    fn from(variant: LFXT_EN_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `LFXT_EN` reader - Turns on the LFXT oscillator regardless if used as a clock resource"]
pub struct LFXT_EN_R(crate::FieldReader<bool, LFXT_EN_A>);
impl LFXT_EN_R {
    pub(crate) fn new(bits: bool) -> Self {
        LFXT_EN_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> LFXT_EN_A {
        match self.bits {
            false => LFXT_EN_A::LFXT_EN_0,
            true => LFXT_EN_A::LFXT_EN_1,
        }
    }
    #[doc = "Checks if the value of the field is `LFXT_EN_0`"]
    #[inline(always)]
    pub fn is_lfxt_en_0(&self) -> bool {
        **self == LFXT_EN_A::LFXT_EN_0
    }
    #[doc = "Checks if the value of the field is `LFXT_EN_1`"]
    #[inline(always)]
    pub fn is_lfxt_en_1(&self) -> bool {
        **self == LFXT_EN_A::LFXT_EN_1
    }
}
impl core::ops::Deref for LFXT_EN_R {
    type Target = crate::FieldReader<bool, LFXT_EN_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `LFXT_EN` writer - Turns on the LFXT oscillator regardless if used as a clock resource"]
pub struct LFXT_EN_W<'a> {
    w: &'a mut W,
}
impl<'a> LFXT_EN_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: LFXT_EN_A) -> &'a mut W {
        self.bit(variant.into())
    }
    #[doc = "LFXT is on if it is used as a source for ACLK, MCLK, HSMCLK , or SMCLK and is selected via the port selection and not in bypass mode of operation."]
    #[inline(always)]
    pub fn lfxt_en_0(self) -> &'a mut W {
        self.variant(LFXT_EN_A::LFXT_EN_0)
    }
    #[doc = "LFXT is on if LFXT is selected via the port selection and LFXT is not in bypass mode of operation."]
    #[inline(always)]
    pub fn lfxt_en_1(self) -> &'a mut W {
        self.variant(LFXT_EN_A::LFXT_EN_1)
    }
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W {
        self.bit(true)
    }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W {
        self.bit(false)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 8)) | ((value as u32 & 0x01) << 8);
        self.w
    }
}
#[doc = "LFXT bypass select\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum LFXTBYPASS_A {
    #[doc = "0: LFXT sourced by external crystal."]
    LFXTBYPASS_0 = 0,
    #[doc = "1: LFXT sourced by external square wave."]
    LFXTBYPASS_1 = 1,
}
impl From<LFXTBYPASS_A> for bool {
    #[inline(always)]
    fn from(variant: LFXTBYPASS_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `LFXTBYPASS` reader - LFXT bypass select"]
pub struct LFXTBYPASS_R(crate::FieldReader<bool, LFXTBYPASS_A>);
impl LFXTBYPASS_R {
    pub(crate) fn new(bits: bool) -> Self {
        LFXTBYPASS_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> LFXTBYPASS_A {
        match self.bits {
            false => LFXTBYPASS_A::LFXTBYPASS_0,
            true => LFXTBYPASS_A::LFXTBYPASS_1,
        }
    }
    #[doc = "Checks if the value of the field is `LFXTBYPASS_0`"]
    #[inline(always)]
    pub fn is_lfxtbypass_0(&self) -> bool {
        **self == LFXTBYPASS_A::LFXTBYPASS_0
    }
    #[doc = "Checks if the value of the field is `LFXTBYPASS_1`"]
    #[inline(always)]
    pub fn is_lfxtbypass_1(&self) -> bool {
        **self == LFXTBYPASS_A::LFXTBYPASS_1
    }
}
impl core::ops::Deref for LFXTBYPASS_R {
    type Target = crate::FieldReader<bool, LFXTBYPASS_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `LFXTBYPASS` writer - LFXT bypass select"]
pub struct LFXTBYPASS_W<'a> {
    w: &'a mut W,
}
impl<'a> LFXTBYPASS_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: LFXTBYPASS_A) -> &'a mut W {
        self.bit(variant.into())
    }
    #[doc = "LFXT sourced by external crystal."]
    #[inline(always)]
    pub fn lfxtbypass_0(self) -> &'a mut W {
        self.variant(LFXTBYPASS_A::LFXTBYPASS_0)
    }
    #[doc = "LFXT sourced by external square wave."]
    #[inline(always)]
    pub fn lfxtbypass_1(self) -> &'a mut W {
        self.variant(LFXTBYPASS_A::LFXTBYPASS_1)
    }
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W {
        self.bit(true)
    }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W {
        self.bit(false)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 9)) | ((value as u32 & 0x01) << 9);
        self.w
    }
}
#[doc = "HFXT oscillator drive selection\n\nValue on reset: 1"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum HFXTDRIVE_A {
    #[doc = "0: To be used for HFXTFREQ setting 000b"]
    HFXTDRIVE_0 = 0,
    #[doc = "1: To be used for HFXTFREQ settings 001b to 110b"]
    HFXTDRIVE_1 = 1,
}
impl From<HFXTDRIVE_A> for bool {
    #[inline(always)]
    fn from(variant: HFXTDRIVE_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `HFXTDRIVE` reader - HFXT oscillator drive selection"]
pub struct HFXTDRIVE_R(crate::FieldReader<bool, HFXTDRIVE_A>);
impl HFXTDRIVE_R {
    pub(crate) fn new(bits: bool) -> Self {
        HFXTDRIVE_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> HFXTDRIVE_A {
        match self.bits {
            false => HFXTDRIVE_A::HFXTDRIVE_0,
            true => HFXTDRIVE_A::HFXTDRIVE_1,
        }
    }
    #[doc = "Checks if the value of the field is `HFXTDRIVE_0`"]
    #[inline(always)]
    pub fn is_hfxtdrive_0(&self) -> bool {
        **self == HFXTDRIVE_A::HFXTDRIVE_0
    }
    #[doc = "Checks if the value of the field is `HFXTDRIVE_1`"]
    #[inline(always)]
    pub fn is_hfxtdrive_1(&self) -> bool {
        **self == HFXTDRIVE_A::HFXTDRIVE_1
    }
}
impl core::ops::Deref for HFXTDRIVE_R {
    type Target = crate::FieldReader<bool, HFXTDRIVE_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `HFXTDRIVE` writer - HFXT oscillator drive selection"]
pub struct HFXTDRIVE_W<'a> {
    w: &'a mut W,
}
impl<'a> HFXTDRIVE_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: HFXTDRIVE_A) -> &'a mut W {
        self.bit(variant.into())
    }
    #[doc = "To be used for HFXTFREQ setting 000b"]
    #[inline(always)]
    pub fn hfxtdrive_0(self) -> &'a mut W {
        self.variant(HFXTDRIVE_A::HFXTDRIVE_0)
    }
    #[doc = "To be used for HFXTFREQ settings 001b to 110b"]
    #[inline(always)]
    pub fn hfxtdrive_1(self) -> &'a mut W {
        self.variant(HFXTDRIVE_A::HFXTDRIVE_1)
    }
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W {
        self.bit(true)
    }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W {
        self.bit(false)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 16)) | ((value as u32 & 0x01) << 16);
        self.w
    }
}
#[doc = "HFXT frequency selection\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum HFXTFREQ_A {
    #[doc = "0: 1 MHz to 4 MHz"]
    HFXTFREQ_0 = 0,
    #[doc = "1: >4 MHz to 8 MHz"]
    HFXTFREQ_1 = 1,
    #[doc = "2: >8 MHz to 16 MHz"]
    HFXTFREQ_2 = 2,
    #[doc = "3: >16 MHz to 24 MHz"]
    HFXTFREQ_3 = 3,
    #[doc = "4: >24 MHz to 32 MHz"]
    HFXTFREQ_4 = 4,
    #[doc = "5: >32 MHz to 40 MHz"]
    HFXTFREQ_5 = 5,
    #[doc = "6: >40 MHz to 48 MHz"]
    HFXTFREQ_6 = 6,
}
impl From<HFXTFREQ_A> for u8 {
    #[inline(always)]
    fn from(variant: HFXTFREQ_A) -> Self {
        variant as _
    }
}
#[doc = "Field `HFXTFREQ` reader - HFXT frequency selection"]
pub struct HFXTFREQ_R(crate::FieldReader<u8, HFXTFREQ_A>);
impl HFXTFREQ_R {
    pub(crate) fn new(bits: u8) -> Self {
        HFXTFREQ_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> Option<HFXTFREQ_A> {
        match self.bits {
            0 => Some(HFXTFREQ_A::HFXTFREQ_0),
            1 => Some(HFXTFREQ_A::HFXTFREQ_1),
            2 => Some(HFXTFREQ_A::HFXTFREQ_2),
            3 => Some(HFXTFREQ_A::HFXTFREQ_3),
            4 => Some(HFXTFREQ_A::HFXTFREQ_4),
            5 => Some(HFXTFREQ_A::HFXTFREQ_5),
            6 => Some(HFXTFREQ_A::HFXTFREQ_6),
            _ => None,
        }
    }
    #[doc = "Checks if the value of the field is `HFXTFREQ_0`"]
    #[inline(always)]
    pub fn is_hfxtfreq_0(&self) -> bool {
        **self == HFXTFREQ_A::HFXTFREQ_0
    }
    #[doc = "Checks if the value of the field is `HFXTFREQ_1`"]
    #[inline(always)]
    pub fn is_hfxtfreq_1(&self) -> bool {
        **self == HFXTFREQ_A::HFXTFREQ_1
    }
    #[doc = "Checks if the value of the field is `HFXTFREQ_2`"]
    #[inline(always)]
    pub fn is_hfxtfreq_2(&self) -> bool {
        **self == HFXTFREQ_A::HFXTFREQ_2
    }
    #[doc = "Checks if the value of the field is `HFXTFREQ_3`"]
    #[inline(always)]
    pub fn is_hfxtfreq_3(&self) -> bool {
        **self == HFXTFREQ_A::HFXTFREQ_3
    }
    #[doc = "Checks if the value of the field is `HFXTFREQ_4`"]
    #[inline(always)]
    pub fn is_hfxtfreq_4(&self) -> bool {
        **self == HFXTFREQ_A::HFXTFREQ_4
    }
    #[doc = "Checks if the value of the field is `HFXTFREQ_5`"]
    #[inline(always)]
    pub fn is_hfxtfreq_5(&self) -> bool {
        **self == HFXTFREQ_A::HFXTFREQ_5
    }
    #[doc = "Checks if the value of the field is `HFXTFREQ_6`"]
    #[inline(always)]
    pub fn is_hfxtfreq_6(&self) -> bool {
        **self == HFXTFREQ_A::HFXTFREQ_6
    }
}
impl core::ops::Deref for HFXTFREQ_R {
    type Target = crate::FieldReader<u8, HFXTFREQ_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `HFXTFREQ` writer - HFXT frequency selection"]
pub struct HFXTFREQ_W<'a> {
    w: &'a mut W,
}
impl<'a> HFXTFREQ_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: HFXTFREQ_A) -> &'a mut W {
        unsafe { self.bits(variant.into()) }
    }
    #[doc = "1 MHz to 4 MHz"]
    #[inline(always)]
    pub fn hfxtfreq_0(self) -> &'a mut W {
        self.variant(HFXTFREQ_A::HFXTFREQ_0)
    }
    #[doc = ">4 MHz to 8 MHz"]
    #[inline(always)]
    pub fn hfxtfreq_1(self) -> &'a mut W {
        self.variant(HFXTFREQ_A::HFXTFREQ_1)
    }
    #[doc = ">8 MHz to 16 MHz"]
    #[inline(always)]
    pub fn hfxtfreq_2(self) -> &'a mut W {
        self.variant(HFXTFREQ_A::HFXTFREQ_2)
    }
    #[doc = ">16 MHz to 24 MHz"]
    #[inline(always)]
    pub fn hfxtfreq_3(self) -> &'a mut W {
        self.variant(HFXTFREQ_A::HFXTFREQ_3)
    }
    #[doc = ">24 MHz to 32 MHz"]
    #[inline(always)]
    pub fn hfxtfreq_4(self) -> &'a mut W {
        self.variant(HFXTFREQ_A::HFXTFREQ_4)
    }
    #[doc = ">32 MHz to 40 MHz"]
    #[inline(always)]
    pub fn hfxtfreq_5(self) -> &'a mut W {
        self.variant(HFXTFREQ_A::HFXTFREQ_5)
    }
    #[doc = ">40 MHz to 48 MHz"]
    #[inline(always)]
    pub fn hfxtfreq_6(self) -> &'a mut W {
        self.variant(HFXTFREQ_A::HFXTFREQ_6)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub unsafe fn bits(self, value: u8) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x07 << 20)) | ((value as u32 & 0x07) << 20);
        self.w
    }
}
#[doc = "Turns on the HFXT oscillator regardless if used as a clock resource\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum HFXT_EN_A {
    #[doc = "0: HFXT is on if it is used as a source for MCLK, HSMCLK , or SMCLK and is selected via the port selection and not in bypass mode of operation."]
    HFXT_EN_0 = 0,
    #[doc = "1: HFXT is on if HFXT is selected via the port selection and HFXT is not in bypass mode of operation."]
    HFXT_EN_1 = 1,
}
impl From<HFXT_EN_A> for bool {
    #[inline(always)]
    fn from(variant: HFXT_EN_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `HFXT_EN` reader - Turns on the HFXT oscillator regardless if used as a clock resource"]
pub struct HFXT_EN_R(crate::FieldReader<bool, HFXT_EN_A>);
impl HFXT_EN_R {
    pub(crate) fn new(bits: bool) -> Self {
        HFXT_EN_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> HFXT_EN_A {
        match self.bits {
            false => HFXT_EN_A::HFXT_EN_0,
            true => HFXT_EN_A::HFXT_EN_1,
        }
    }
    #[doc = "Checks if the value of the field is `HFXT_EN_0`"]
    #[inline(always)]
    pub fn is_hfxt_en_0(&self) -> bool {
        **self == HFXT_EN_A::HFXT_EN_0
    }
    #[doc = "Checks if the value of the field is `HFXT_EN_1`"]
    #[inline(always)]
    pub fn is_hfxt_en_1(&self) -> bool {
        **self == HFXT_EN_A::HFXT_EN_1
    }
}
impl core::ops::Deref for HFXT_EN_R {
    type Target = crate::FieldReader<bool, HFXT_EN_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `HFXT_EN` writer - Turns on the HFXT oscillator regardless if used as a clock resource"]
pub struct HFXT_EN_W<'a> {
    w: &'a mut W,
}
impl<'a> HFXT_EN_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: HFXT_EN_A) -> &'a mut W {
        self.bit(variant.into())
    }
    #[doc = "HFXT is on if it is used as a source for MCLK, HSMCLK , or SMCLK and is selected via the port selection and not in bypass mode of operation."]
    #[inline(always)]
    pub fn hfxt_en_0(self) -> &'a mut W {
        self.variant(HFXT_EN_A::HFXT_EN_0)
    }
    #[doc = "HFXT is on if HFXT is selected via the port selection and HFXT is not in bypass mode of operation."]
    #[inline(always)]
    pub fn hfxt_en_1(self) -> &'a mut W {
        self.variant(HFXT_EN_A::HFXT_EN_1)
    }
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W {
        self.bit(true)
    }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W {
        self.bit(false)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 24)) | ((value as u32 & 0x01) << 24);
        self.w
    }
}
#[doc = "HFXT bypass select\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum HFXTBYPASS_A {
    #[doc = "0: HFXT sourced by external crystal."]
    HFXTBYPASS_0 = 0,
    #[doc = "1: HFXT sourced by external square wave."]
    HFXTBYPASS_1 = 1,
}
impl From<HFXTBYPASS_A> for bool {
    #[inline(always)]
    fn from(variant: HFXTBYPASS_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `HFXTBYPASS` reader - HFXT bypass select"]
pub struct HFXTBYPASS_R(crate::FieldReader<bool, HFXTBYPASS_A>);
impl HFXTBYPASS_R {
    pub(crate) fn new(bits: bool) -> Self {
        HFXTBYPASS_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> HFXTBYPASS_A {
        match self.bits {
            false => HFXTBYPASS_A::HFXTBYPASS_0,
            true => HFXTBYPASS_A::HFXTBYPASS_1,
        }
    }
    #[doc = "Checks if the value of the field is `HFXTBYPASS_0`"]
    #[inline(always)]
    pub fn is_hfxtbypass_0(&self) -> bool {
        **self == HFXTBYPASS_A::HFXTBYPASS_0
    }
    #[doc = "Checks if the value of the field is `HFXTBYPASS_1`"]
    #[inline(always)]
    pub fn is_hfxtbypass_1(&self) -> bool {
        **self == HFXTBYPASS_A::HFXTBYPASS_1
    }
}
impl core::ops::Deref for HFXTBYPASS_R {
    type Target = crate::FieldReader<bool, HFXTBYPASS_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `HFXTBYPASS` writer - HFXT bypass select"]
pub struct HFXTBYPASS_W<'a> {
    w: &'a mut W,
}
impl<'a> HFXTBYPASS_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: HFXTBYPASS_A) -> &'a mut W {
        self.bit(variant.into())
    }
    #[doc = "HFXT sourced by external crystal."]
    #[inline(always)]
    pub fn hfxtbypass_0(self) -> &'a mut W {
        self.variant(HFXTBYPASS_A::HFXTBYPASS_0)
    }
    #[doc = "HFXT sourced by external square wave."]
    #[inline(always)]
    pub fn hfxtbypass_1(self) -> &'a mut W {
        self.variant(HFXTBYPASS_A::HFXTBYPASS_1)
    }
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W {
        self.bit(true)
    }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W {
        self.bit(false)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 25)) | ((value as u32 & 0x01) << 25);
        self.w
    }
}
impl R {
    #[doc = "Bits 0:1 - LFXT oscillator current can be adjusted to its drive needs"]
    #[inline(always)]
    pub fn lfxtdrive(&self) -> LFXTDRIVE_R {
        LFXTDRIVE_R::new((self.bits & 0x03) as u8)
    }
    #[doc = "Bit 7 - Disables the automatic gain control of the LFXT crystal"]
    #[inline(always)]
    pub fn lfxtagcoff(&self) -> LFXTAGCOFF_R {
        LFXTAGCOFF_R::new(((self.bits >> 7) & 0x01) != 0)
    }
    #[doc = "Bit 8 - Turns on the LFXT oscillator regardless if used as a clock resource"]
    #[inline(always)]
    pub fn lfxt_en(&self) -> LFXT_EN_R {
        LFXT_EN_R::new(((self.bits >> 8) & 0x01) != 0)
    }
    #[doc = "Bit 9 - LFXT bypass select"]
    #[inline(always)]
    pub fn lfxtbypass(&self) -> LFXTBYPASS_R {
        LFXTBYPASS_R::new(((self.bits >> 9) & 0x01) != 0)
    }
    #[doc = "Bit 16 - HFXT oscillator drive selection"]
    #[inline(always)]
    pub fn hfxtdrive(&self) -> HFXTDRIVE_R {
        HFXTDRIVE_R::new(((self.bits >> 16) & 0x01) != 0)
    }
    #[doc = "Bits 20:22 - HFXT frequency selection"]
    #[inline(always)]
    pub fn hfxtfreq(&self) -> HFXTFREQ_R {
        HFXTFREQ_R::new(((self.bits >> 20) & 0x07) as u8)
    }
    #[doc = "Bit 24 - Turns on the HFXT oscillator regardless if used as a clock resource"]
    #[inline(always)]
    pub fn hfxt_en(&self) -> HFXT_EN_R {
        HFXT_EN_R::new(((self.bits >> 24) & 0x01) != 0)
    }
    #[doc = "Bit 25 - HFXT bypass select"]
    #[inline(always)]
    pub fn hfxtbypass(&self) -> HFXTBYPASS_R {
        HFXTBYPASS_R::new(((self.bits >> 25) & 0x01) != 0)
    }
}
impl W {
    #[doc = "Bits 0:1 - LFXT oscillator current can be adjusted to its drive needs"]
    #[inline(always)]
    pub fn lfxtdrive(&mut self) -> LFXTDRIVE_W {
        LFXTDRIVE_W { w: self }
    }
    #[doc = "Bit 7 - Disables the automatic gain control of the LFXT crystal"]
    #[inline(always)]
    pub fn lfxtagcoff(&mut self) -> LFXTAGCOFF_W {
        LFXTAGCOFF_W { w: self }
    }
    #[doc = "Bit 8 - Turns on the LFXT oscillator regardless if used as a clock resource"]
    #[inline(always)]
    pub fn lfxt_en(&mut self) -> LFXT_EN_W {
        LFXT_EN_W { w: self }
    }
    #[doc = "Bit 9 - LFXT bypass select"]
    #[inline(always)]
    pub fn lfxtbypass(&mut self) -> LFXTBYPASS_W {
        LFXTBYPASS_W { w: self }
    }
    #[doc = "Bit 16 - HFXT oscillator drive selection"]
    #[inline(always)]
    pub fn hfxtdrive(&mut self) -> HFXTDRIVE_W {
        HFXTDRIVE_W { w: self }
    }
    #[doc = "Bits 20:22 - HFXT frequency selection"]
    #[inline(always)]
    pub fn hfxtfreq(&mut self) -> HFXTFREQ_W {
        HFXTFREQ_W { w: self }
    }
    #[doc = "Bit 24 - Turns on the HFXT oscillator regardless if used as a clock resource"]
    #[inline(always)]
    pub fn hfxt_en(&mut self) -> HFXT_EN_W {
        HFXT_EN_W { w: self }
    }
    #[doc = "Bit 25 - HFXT bypass select"]
    #[inline(always)]
    pub fn hfxtbypass(&mut self) -> HFXTBYPASS_W {
        HFXTBYPASS_W { w: self }
    }
    #[doc = "Writes raw bits to the register."]
    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
        self.0.bits(bits);
        self
    }
}
#[doc = "Control 2 Register\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 [csctl2](index.html) module"]
pub struct CSCTL2_SPEC;
impl crate::RegisterSpec for CSCTL2_SPEC {
    type Ux = u32;
}
#[doc = "`read()` method returns [csctl2::R](R) reader structure"]
impl crate::Readable for CSCTL2_SPEC {
    type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [csctl2::W](W) writer structure"]
impl crate::Writable for CSCTL2_SPEC {
    type Writer = W;
}
#[doc = "`reset()` method sets CSCTL2 to value 0x0001_0003"]
impl crate::Resettable for CSCTL2_SPEC {
    #[inline(always)]
    fn reset_value() -> Self::Ux {
        0x0001_0003
    }
}