xmc4500/vadc/
globeflag.rs

1#[doc = "Register `GLOBEFLAG` reader"]
2pub type R = crate::R<GLOBEFLAG_SPEC>;
3#[doc = "Register `GLOBEFLAG` writer"]
4pub type W = crate::W<GLOBEFLAG_SPEC>;
5#[doc = "Source Event (Background)\n\nValue on reset: 0"]
6#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7pub enum SEVGLB_A {
8    #[doc = "0: No source event"]
9    VALUE1 = 0,
10    #[doc = "1: A source event has occurred"]
11    VALUE2 = 1,
12}
13impl From<SEVGLB_A> for bool {
14    #[inline(always)]
15    fn from(variant: SEVGLB_A) -> Self {
16        variant as u8 != 0
17    }
18}
19#[doc = "Field `SEVGLB` reader - Source Event (Background)"]
20pub type SEVGLB_R = crate::BitReader<SEVGLB_A>;
21impl SEVGLB_R {
22    #[doc = "Get enumerated values variant"]
23    #[inline(always)]
24    pub const fn variant(&self) -> SEVGLB_A {
25        match self.bits {
26            false => SEVGLB_A::VALUE1,
27            true => SEVGLB_A::VALUE2,
28        }
29    }
30    #[doc = "No source event"]
31    #[inline(always)]
32    pub fn is_value1(&self) -> bool {
33        *self == SEVGLB_A::VALUE1
34    }
35    #[doc = "A source event has occurred"]
36    #[inline(always)]
37    pub fn is_value2(&self) -> bool {
38        *self == SEVGLB_A::VALUE2
39    }
40}
41#[doc = "Field `SEVGLB` writer - Source Event (Background)"]
42pub type SEVGLB_W<'a, REG> = crate::BitWriter<'a, REG, SEVGLB_A>;
43impl<'a, REG> SEVGLB_W<'a, REG>
44where
45    REG: crate::Writable + crate::RegisterSpec,
46{
47    #[doc = "No source event"]
48    #[inline(always)]
49    pub fn value1(self) -> &'a mut crate::W<REG> {
50        self.variant(SEVGLB_A::VALUE1)
51    }
52    #[doc = "A source event has occurred"]
53    #[inline(always)]
54    pub fn value2(self) -> &'a mut crate::W<REG> {
55        self.variant(SEVGLB_A::VALUE2)
56    }
57}
58#[doc = "Global Result Event\n\nValue on reset: 0"]
59#[derive(Clone, Copy, Debug, PartialEq, Eq)]
60pub enum REVGLB_A {
61    #[doc = "0: No result event"]
62    VALUE1 = 0,
63    #[doc = "1: New result was stored in register GLOBRES"]
64    VALUE2 = 1,
65}
66impl From<REVGLB_A> for bool {
67    #[inline(always)]
68    fn from(variant: REVGLB_A) -> Self {
69        variant as u8 != 0
70    }
71}
72#[doc = "Field `REVGLB` reader - Global Result Event"]
73pub type REVGLB_R = crate::BitReader<REVGLB_A>;
74impl REVGLB_R {
75    #[doc = "Get enumerated values variant"]
76    #[inline(always)]
77    pub const fn variant(&self) -> REVGLB_A {
78        match self.bits {
79            false => REVGLB_A::VALUE1,
80            true => REVGLB_A::VALUE2,
81        }
82    }
83    #[doc = "No result event"]
84    #[inline(always)]
85    pub fn is_value1(&self) -> bool {
86        *self == REVGLB_A::VALUE1
87    }
88    #[doc = "New result was stored in register GLOBRES"]
89    #[inline(always)]
90    pub fn is_value2(&self) -> bool {
91        *self == REVGLB_A::VALUE2
92    }
93}
94#[doc = "Field `REVGLB` writer - Global Result Event"]
95pub type REVGLB_W<'a, REG> = crate::BitWriter<'a, REG, REVGLB_A>;
96impl<'a, REG> REVGLB_W<'a, REG>
97where
98    REG: crate::Writable + crate::RegisterSpec,
99{
100    #[doc = "No result event"]
101    #[inline(always)]
102    pub fn value1(self) -> &'a mut crate::W<REG> {
103        self.variant(REVGLB_A::VALUE1)
104    }
105    #[doc = "New result was stored in register GLOBRES"]
106    #[inline(always)]
107    pub fn value2(self) -> &'a mut crate::W<REG> {
108        self.variant(REVGLB_A::VALUE2)
109    }
110}
111#[doc = "Clear Source Event (Background)\n\nValue on reset: 0"]
112#[derive(Clone, Copy, Debug, PartialEq, Eq)]
113pub enum SEVGLBCLR_A {
114    #[doc = "0: No action"]
115    VALUE1 = 0,
116    #[doc = "1: Clear the source event flag SEVGLB"]
117    VALUE2 = 1,
118}
119impl From<SEVGLBCLR_A> for bool {
120    #[inline(always)]
121    fn from(variant: SEVGLBCLR_A) -> Self {
122        variant as u8 != 0
123    }
124}
125#[doc = "Field `SEVGLBCLR` writer - Clear Source Event (Background)"]
126pub type SEVGLBCLR_W<'a, REG> = crate::BitWriter<'a, REG, SEVGLBCLR_A>;
127impl<'a, REG> SEVGLBCLR_W<'a, REG>
128where
129    REG: crate::Writable + crate::RegisterSpec,
130{
131    #[doc = "No action"]
132    #[inline(always)]
133    pub fn value1(self) -> &'a mut crate::W<REG> {
134        self.variant(SEVGLBCLR_A::VALUE1)
135    }
136    #[doc = "Clear the source event flag SEVGLB"]
137    #[inline(always)]
138    pub fn value2(self) -> &'a mut crate::W<REG> {
139        self.variant(SEVGLBCLR_A::VALUE2)
140    }
141}
142#[doc = "Clear Global Result Event\n\nValue on reset: 0"]
143#[derive(Clone, Copy, Debug, PartialEq, Eq)]
144pub enum REVGLBCLR_A {
145    #[doc = "0: No action"]
146    VALUE1 = 0,
147    #[doc = "1: Clear the result event flag REVGLB"]
148    VALUE2 = 1,
149}
150impl From<REVGLBCLR_A> for bool {
151    #[inline(always)]
152    fn from(variant: REVGLBCLR_A) -> Self {
153        variant as u8 != 0
154    }
155}
156#[doc = "Field `REVGLBCLR` writer - Clear Global Result Event"]
157pub type REVGLBCLR_W<'a, REG> = crate::BitWriter<'a, REG, REVGLBCLR_A>;
158impl<'a, REG> REVGLBCLR_W<'a, REG>
159where
160    REG: crate::Writable + crate::RegisterSpec,
161{
162    #[doc = "No action"]
163    #[inline(always)]
164    pub fn value1(self) -> &'a mut crate::W<REG> {
165        self.variant(REVGLBCLR_A::VALUE1)
166    }
167    #[doc = "Clear the result event flag REVGLB"]
168    #[inline(always)]
169    pub fn value2(self) -> &'a mut crate::W<REG> {
170        self.variant(REVGLBCLR_A::VALUE2)
171    }
172}
173impl R {
174    #[doc = "Bit 0 - Source Event (Background)"]
175    #[inline(always)]
176    pub fn sevglb(&self) -> SEVGLB_R {
177        SEVGLB_R::new((self.bits & 1) != 0)
178    }
179    #[doc = "Bit 8 - Global Result Event"]
180    #[inline(always)]
181    pub fn revglb(&self) -> REVGLB_R {
182        REVGLB_R::new(((self.bits >> 8) & 1) != 0)
183    }
184}
185impl W {
186    #[doc = "Bit 0 - Source Event (Background)"]
187    #[inline(always)]
188    pub fn sevglb(&mut self) -> SEVGLB_W<GLOBEFLAG_SPEC> {
189        SEVGLB_W::new(self, 0)
190    }
191    #[doc = "Bit 8 - Global Result Event"]
192    #[inline(always)]
193    pub fn revglb(&mut self) -> REVGLB_W<GLOBEFLAG_SPEC> {
194        REVGLB_W::new(self, 8)
195    }
196    #[doc = "Bit 16 - Clear Source Event (Background)"]
197    #[inline(always)]
198    pub fn sevglbclr(&mut self) -> SEVGLBCLR_W<GLOBEFLAG_SPEC> {
199        SEVGLBCLR_W::new(self, 16)
200    }
201    #[doc = "Bit 24 - Clear Global Result Event"]
202    #[inline(always)]
203    pub fn revglbclr(&mut self) -> REVGLBCLR_W<GLOBEFLAG_SPEC> {
204        REVGLBCLR_W::new(self, 24)
205    }
206}
207#[doc = "Global Event Flag Register\n\nYou can [`read`](crate::Reg::read) this register and get [`globeflag::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`globeflag::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
208pub struct GLOBEFLAG_SPEC;
209impl crate::RegisterSpec for GLOBEFLAG_SPEC {
210    type Ux = u32;
211}
212#[doc = "`read()` method returns [`globeflag::R`](R) reader structure"]
213impl crate::Readable for GLOBEFLAG_SPEC {}
214#[doc = "`write(|w| ..)` method takes [`globeflag::W`](W) writer structure"]
215impl crate::Writable for GLOBEFLAG_SPEC {
216    type Safety = crate::Unsafe;
217    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
218    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
219}
220#[doc = "`reset()` method sets GLOBEFLAG to value 0"]
221impl crate::Resettable for GLOBEFLAG_SPEC {
222    const RESET_VALUE: u32 = 0;
223}