atsamd11c14a/adc/
winctrl.rs1#[doc = "Reader of register WINCTRL"]
2pub type R = crate::R<u8, super::WINCTRL>;
3#[doc = "Writer for register WINCTRL"]
4pub type W = crate::W<u8, super::WINCTRL>;
5#[doc = "Register WINCTRL `reset()`'s with value 0"]
6impl crate::ResetValue for super::WINCTRL {
7 type Type = u8;
8 #[inline(always)]
9 fn reset_value() -> Self::Type {
10 0
11 }
12}
13#[doc = "Window Monitor Mode\n\nValue on reset: 0"]
14#[derive(Clone, Copy, Debug, PartialEq)]
15#[repr(u8)]
16pub enum WINMODE_A {
17 #[doc = "0: No window mode (default)"]
18 DISABLE = 0,
19 #[doc = "1: Mode 1: RESULT > WINLT"]
20 MODE1 = 1,
21 #[doc = "2: Mode 2: RESULT < WINUT"]
22 MODE2 = 2,
23 #[doc = "3: Mode 3: WINLT < RESULT < WINUT"]
24 MODE3 = 3,
25 #[doc = "4: Mode 4: !(WINLT < RESULT < WINUT)"]
26 MODE4 = 4,
27}
28impl From<WINMODE_A> for u8 {
29 #[inline(always)]
30 fn from(variant: WINMODE_A) -> Self {
31 variant as _
32 }
33}
34#[doc = "Reader of field `WINMODE`"]
35pub type WINMODE_R = crate::R<u8, WINMODE_A>;
36impl WINMODE_R {
37 #[doc = r"Get enumerated values variant"]
38 #[inline(always)]
39 pub fn variant(&self) -> crate::Variant<u8, WINMODE_A> {
40 use crate::Variant::*;
41 match self.bits {
42 0 => Val(WINMODE_A::DISABLE),
43 1 => Val(WINMODE_A::MODE1),
44 2 => Val(WINMODE_A::MODE2),
45 3 => Val(WINMODE_A::MODE3),
46 4 => Val(WINMODE_A::MODE4),
47 i => Res(i),
48 }
49 }
50 #[doc = "Checks if the value of the field is `DISABLE`"]
51 #[inline(always)]
52 pub fn is_disable(&self) -> bool {
53 *self == WINMODE_A::DISABLE
54 }
55 #[doc = "Checks if the value of the field is `MODE1`"]
56 #[inline(always)]
57 pub fn is_mode1(&self) -> bool {
58 *self == WINMODE_A::MODE1
59 }
60 #[doc = "Checks if the value of the field is `MODE2`"]
61 #[inline(always)]
62 pub fn is_mode2(&self) -> bool {
63 *self == WINMODE_A::MODE2
64 }
65 #[doc = "Checks if the value of the field is `MODE3`"]
66 #[inline(always)]
67 pub fn is_mode3(&self) -> bool {
68 *self == WINMODE_A::MODE3
69 }
70 #[doc = "Checks if the value of the field is `MODE4`"]
71 #[inline(always)]
72 pub fn is_mode4(&self) -> bool {
73 *self == WINMODE_A::MODE4
74 }
75}
76#[doc = "Write proxy for field `WINMODE`"]
77pub struct WINMODE_W<'a> {
78 w: &'a mut W,
79}
80impl<'a> WINMODE_W<'a> {
81 #[doc = r"Writes `variant` to the field"]
82 #[inline(always)]
83 pub fn variant(self, variant: WINMODE_A) -> &'a mut W {
84 unsafe { self.bits(variant.into()) }
85 }
86 #[doc = "No window mode (default)"]
87 #[inline(always)]
88 pub fn disable(self) -> &'a mut W {
89 self.variant(WINMODE_A::DISABLE)
90 }
91 #[doc = "Mode 1: RESULT > WINLT"]
92 #[inline(always)]
93 pub fn mode1(self) -> &'a mut W {
94 self.variant(WINMODE_A::MODE1)
95 }
96 #[doc = "Mode 2: RESULT < WINUT"]
97 #[inline(always)]
98 pub fn mode2(self) -> &'a mut W {
99 self.variant(WINMODE_A::MODE2)
100 }
101 #[doc = "Mode 3: WINLT < RESULT < WINUT"]
102 #[inline(always)]
103 pub fn mode3(self) -> &'a mut W {
104 self.variant(WINMODE_A::MODE3)
105 }
106 #[doc = "Mode 4: !(WINLT < RESULT < WINUT)"]
107 #[inline(always)]
108 pub fn mode4(self) -> &'a mut W {
109 self.variant(WINMODE_A::MODE4)
110 }
111 #[doc = r"Writes raw bits to the field"]
112 #[inline(always)]
113 pub unsafe fn bits(self, value: u8) -> &'a mut W {
114 self.w.bits = (self.w.bits & !0x07) | ((value as u8) & 0x07);
115 self.w
116 }
117}
118impl R {
119 #[doc = "Bits 0:2 - Window Monitor Mode"]
120 #[inline(always)]
121 pub fn winmode(&self) -> WINMODE_R {
122 WINMODE_R::new((self.bits & 0x07) as u8)
123 }
124}
125impl W {
126 #[doc = "Bits 0:2 - Window Monitor Mode"]
127 #[inline(always)]
128 pub fn winmode(&mut self) -> WINMODE_W {
129 WINMODE_W { w: self }
130 }
131}