atsamd11c/adc/
winctrl.rs
1#[doc = "Register `WINCTRL` reader"]
2pub type R = crate::R<WinctrlSpec>;
3#[doc = "Register `WINCTRL` writer"]
4pub type W = crate::W<WinctrlSpec>;
5#[doc = "Window Monitor Mode\n\nValue on reset: 0"]
6#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7#[repr(u8)]
8pub enum Winmodeselect {
9 #[doc = "0: No window mode (default)"]
10 Disable = 0,
11 #[doc = "1: Mode 1: RESULT > WINLT"]
12 Mode1 = 1,
13 #[doc = "2: Mode 2: RESULT < WINUT"]
14 Mode2 = 2,
15 #[doc = "3: Mode 3: WINLT < RESULT < WINUT"]
16 Mode3 = 3,
17 #[doc = "4: Mode 4: !(WINLT < RESULT < WINUT)"]
18 Mode4 = 4,
19}
20impl From<Winmodeselect> for u8 {
21 #[inline(always)]
22 fn from(variant: Winmodeselect) -> Self {
23 variant as _
24 }
25}
26impl crate::FieldSpec for Winmodeselect {
27 type Ux = u8;
28}
29impl crate::IsEnum for Winmodeselect {}
30#[doc = "Field `WINMODE` reader - Window Monitor Mode"]
31pub type WinmodeR = crate::FieldReader<Winmodeselect>;
32impl WinmodeR {
33 #[doc = "Get enumerated values variant"]
34 #[inline(always)]
35 pub const fn variant(&self) -> Option<Winmodeselect> {
36 match self.bits {
37 0 => Some(Winmodeselect::Disable),
38 1 => Some(Winmodeselect::Mode1),
39 2 => Some(Winmodeselect::Mode2),
40 3 => Some(Winmodeselect::Mode3),
41 4 => Some(Winmodeselect::Mode4),
42 _ => None,
43 }
44 }
45 #[doc = "No window mode (default)"]
46 #[inline(always)]
47 pub fn is_disable(&self) -> bool {
48 *self == Winmodeselect::Disable
49 }
50 #[doc = "Mode 1: RESULT > WINLT"]
51 #[inline(always)]
52 pub fn is_mode1(&self) -> bool {
53 *self == Winmodeselect::Mode1
54 }
55 #[doc = "Mode 2: RESULT < WINUT"]
56 #[inline(always)]
57 pub fn is_mode2(&self) -> bool {
58 *self == Winmodeselect::Mode2
59 }
60 #[doc = "Mode 3: WINLT < RESULT < WINUT"]
61 #[inline(always)]
62 pub fn is_mode3(&self) -> bool {
63 *self == Winmodeselect::Mode3
64 }
65 #[doc = "Mode 4: !(WINLT < RESULT < WINUT)"]
66 #[inline(always)]
67 pub fn is_mode4(&self) -> bool {
68 *self == Winmodeselect::Mode4
69 }
70}
71#[doc = "Field `WINMODE` writer - Window Monitor Mode"]
72pub type WinmodeW<'a, REG> = crate::FieldWriter<'a, REG, 3, Winmodeselect>;
73impl<'a, REG> WinmodeW<'a, REG>
74where
75 REG: crate::Writable + crate::RegisterSpec,
76 REG::Ux: From<u8>,
77{
78 #[doc = "No window mode (default)"]
79 #[inline(always)]
80 pub fn disable(self) -> &'a mut crate::W<REG> {
81 self.variant(Winmodeselect::Disable)
82 }
83 #[doc = "Mode 1: RESULT > WINLT"]
84 #[inline(always)]
85 pub fn mode1(self) -> &'a mut crate::W<REG> {
86 self.variant(Winmodeselect::Mode1)
87 }
88 #[doc = "Mode 2: RESULT < WINUT"]
89 #[inline(always)]
90 pub fn mode2(self) -> &'a mut crate::W<REG> {
91 self.variant(Winmodeselect::Mode2)
92 }
93 #[doc = "Mode 3: WINLT < RESULT < WINUT"]
94 #[inline(always)]
95 pub fn mode3(self) -> &'a mut crate::W<REG> {
96 self.variant(Winmodeselect::Mode3)
97 }
98 #[doc = "Mode 4: !(WINLT < RESULT < WINUT)"]
99 #[inline(always)]
100 pub fn mode4(self) -> &'a mut crate::W<REG> {
101 self.variant(Winmodeselect::Mode4)
102 }
103}
104impl R {
105 #[doc = "Bits 0:2 - Window Monitor Mode"]
106 #[inline(always)]
107 pub fn winmode(&self) -> WinmodeR {
108 WinmodeR::new(self.bits & 7)
109 }
110}
111impl W {
112 #[doc = "Bits 0:2 - Window Monitor Mode"]
113 #[inline(always)]
114 #[must_use]
115 pub fn winmode(&mut self) -> WinmodeW<WinctrlSpec> {
116 WinmodeW::new(self, 0)
117 }
118}
119#[doc = "Window Monitor Control\n\nYou can [`read`](crate::Reg::read) this register and get [`winctrl::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`winctrl::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
120pub struct WinctrlSpec;
121impl crate::RegisterSpec for WinctrlSpec {
122 type Ux = u8;
123}
124#[doc = "`read()` method returns [`winctrl::R`](R) reader structure"]
125impl crate::Readable for WinctrlSpec {}
126#[doc = "`write(|w| ..)` method takes [`winctrl::W`](W) writer structure"]
127impl crate::Writable for WinctrlSpec {
128 type Safety = crate::Unsafe;
129 const ZERO_TO_MODIFY_FIELDS_BITMAP: u8 = 0;
130 const ONE_TO_MODIFY_FIELDS_BITMAP: u8 = 0;
131}
132#[doc = "`reset()` method sets WINCTRL to value 0"]
133impl crate::Resettable for WinctrlSpec {
134 const RESET_VALUE: u8 = 0;
135}