atsamd51p/ac/
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 = "Field `WEN0` reader - Window 0 Mode Enable"]
6pub type Wen0R = crate::BitReader;
7#[doc = "Field `WEN0` writer - Window 0 Mode Enable"]
8pub type Wen0W<'a, REG> = crate::BitWriter<'a, REG>;
9#[doc = "Window 0 Interrupt Selection\n\nValue on reset: 0"]
10#[derive(Clone, Copy, Debug, PartialEq, Eq)]
11#[repr(u8)]
12pub enum Wintsel0select {
13 #[doc = "0: Interrupt on signal above window"]
14 Above = 0,
15 #[doc = "1: Interrupt on signal inside window"]
16 Inside = 1,
17 #[doc = "2: Interrupt on signal below window"]
18 Below = 2,
19 #[doc = "3: Interrupt on signal outside window"]
20 Outside = 3,
21}
22impl From<Wintsel0select> for u8 {
23 #[inline(always)]
24 fn from(variant: Wintsel0select) -> Self {
25 variant as _
26 }
27}
28impl crate::FieldSpec for Wintsel0select {
29 type Ux = u8;
30}
31impl crate::IsEnum for Wintsel0select {}
32#[doc = "Field `WINTSEL0` reader - Window 0 Interrupt Selection"]
33pub type Wintsel0R = crate::FieldReader<Wintsel0select>;
34impl Wintsel0R {
35 #[doc = "Get enumerated values variant"]
36 #[inline(always)]
37 pub const fn variant(&self) -> Wintsel0select {
38 match self.bits {
39 0 => Wintsel0select::Above,
40 1 => Wintsel0select::Inside,
41 2 => Wintsel0select::Below,
42 3 => Wintsel0select::Outside,
43 _ => unreachable!(),
44 }
45 }
46 #[doc = "Interrupt on signal above window"]
47 #[inline(always)]
48 pub fn is_above(&self) -> bool {
49 *self == Wintsel0select::Above
50 }
51 #[doc = "Interrupt on signal inside window"]
52 #[inline(always)]
53 pub fn is_inside(&self) -> bool {
54 *self == Wintsel0select::Inside
55 }
56 #[doc = "Interrupt on signal below window"]
57 #[inline(always)]
58 pub fn is_below(&self) -> bool {
59 *self == Wintsel0select::Below
60 }
61 #[doc = "Interrupt on signal outside window"]
62 #[inline(always)]
63 pub fn is_outside(&self) -> bool {
64 *self == Wintsel0select::Outside
65 }
66}
67#[doc = "Field `WINTSEL0` writer - Window 0 Interrupt Selection"]
68pub type Wintsel0W<'a, REG> = crate::FieldWriter<'a, REG, 2, Wintsel0select, crate::Safe>;
69impl<'a, REG> Wintsel0W<'a, REG>
70where
71 REG: crate::Writable + crate::RegisterSpec,
72 REG::Ux: From<u8>,
73{
74 #[doc = "Interrupt on signal above window"]
75 #[inline(always)]
76 pub fn above(self) -> &'a mut crate::W<REG> {
77 self.variant(Wintsel0select::Above)
78 }
79 #[doc = "Interrupt on signal inside window"]
80 #[inline(always)]
81 pub fn inside(self) -> &'a mut crate::W<REG> {
82 self.variant(Wintsel0select::Inside)
83 }
84 #[doc = "Interrupt on signal below window"]
85 #[inline(always)]
86 pub fn below(self) -> &'a mut crate::W<REG> {
87 self.variant(Wintsel0select::Below)
88 }
89 #[doc = "Interrupt on signal outside window"]
90 #[inline(always)]
91 pub fn outside(self) -> &'a mut crate::W<REG> {
92 self.variant(Wintsel0select::Outside)
93 }
94}
95impl R {
96 #[doc = "Bit 0 - Window 0 Mode Enable"]
97 #[inline(always)]
98 pub fn wen0(&self) -> Wen0R {
99 Wen0R::new((self.bits & 1) != 0)
100 }
101 #[doc = "Bits 1:2 - Window 0 Interrupt Selection"]
102 #[inline(always)]
103 pub fn wintsel0(&self) -> Wintsel0R {
104 Wintsel0R::new((self.bits >> 1) & 3)
105 }
106}
107impl W {
108 #[doc = "Bit 0 - Window 0 Mode Enable"]
109 #[inline(always)]
110 #[must_use]
111 pub fn wen0(&mut self) -> Wen0W<WinctrlSpec> {
112 Wen0W::new(self, 0)
113 }
114 #[doc = "Bits 1:2 - Window 0 Interrupt Selection"]
115 #[inline(always)]
116 #[must_use]
117 pub fn wintsel0(&mut self) -> Wintsel0W<WinctrlSpec> {
118 Wintsel0W::new(self, 1)
119 }
120}
121#[doc = "Window 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)."]
122pub struct WinctrlSpec;
123impl crate::RegisterSpec for WinctrlSpec {
124 type Ux = u8;
125}
126#[doc = "`read()` method returns [`winctrl::R`](R) reader structure"]
127impl crate::Readable for WinctrlSpec {}
128#[doc = "`write(|w| ..)` method takes [`winctrl::W`](W) writer structure"]
129impl crate::Writable for WinctrlSpec {
130 type Safety = crate::Unsafe;
131 const ZERO_TO_MODIFY_FIELDS_BITMAP: u8 = 0;
132 const ONE_TO_MODIFY_FIELDS_BITMAP: u8 = 0;
133}
134#[doc = "`reset()` method sets WINCTRL to value 0"]
135impl crate::Resettable for WinctrlSpec {
136 const RESET_VALUE: u8 = 0;
137}