xmc4400/vadc_g0/
seflag.rs1#[doc = "Register `SEFLAG` reader"]
2pub type R = crate::R<SEFLAG_SPEC>;
3#[doc = "Register `SEFLAG` writer"]
4pub type W = crate::W<SEFLAG_SPEC>;
5#[doc = "Source Event 0/1\n\nValue on reset: 0"]
6#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7pub enum SEV0_A {
8 #[doc = "0: No source event"]
9 VALUE1 = 0,
10 #[doc = "1: A source event has occurred"]
11 VALUE2 = 1,
12}
13impl From<SEV0_A> for bool {
14 #[inline(always)]
15 fn from(variant: SEV0_A) -> Self {
16 variant as u8 != 0
17 }
18}
19#[doc = "Field `SEV0` reader - Source Event 0/1"]
20pub type SEV0_R = crate::BitReader<SEV0_A>;
21impl SEV0_R {
22 #[doc = "Get enumerated values variant"]
23 #[inline(always)]
24 pub const fn variant(&self) -> SEV0_A {
25 match self.bits {
26 false => SEV0_A::VALUE1,
27 true => SEV0_A::VALUE2,
28 }
29 }
30 #[doc = "No source event"]
31 #[inline(always)]
32 pub fn is_value1(&self) -> bool {
33 *self == SEV0_A::VALUE1
34 }
35 #[doc = "A source event has occurred"]
36 #[inline(always)]
37 pub fn is_value2(&self) -> bool {
38 *self == SEV0_A::VALUE2
39 }
40}
41#[doc = "Field `SEV0` writer - Source Event 0/1"]
42pub type SEV0_W<'a, REG> = crate::BitWriter<'a, REG, SEV0_A>;
43impl<'a, REG> SEV0_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(SEV0_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(SEV0_A::VALUE2)
56 }
57}
58#[doc = "Source Event 0/1\n\nValue on reset: 0"]
59#[derive(Clone, Copy, Debug, PartialEq, Eq)]
60pub enum SEV1_A {
61 #[doc = "0: No source event"]
62 VALUE1 = 0,
63 #[doc = "1: A source event has occurred"]
64 VALUE2 = 1,
65}
66impl From<SEV1_A> for bool {
67 #[inline(always)]
68 fn from(variant: SEV1_A) -> Self {
69 variant as u8 != 0
70 }
71}
72#[doc = "Field `SEV1` reader - Source Event 0/1"]
73pub type SEV1_R = crate::BitReader<SEV1_A>;
74impl SEV1_R {
75 #[doc = "Get enumerated values variant"]
76 #[inline(always)]
77 pub const fn variant(&self) -> SEV1_A {
78 match self.bits {
79 false => SEV1_A::VALUE1,
80 true => SEV1_A::VALUE2,
81 }
82 }
83 #[doc = "No source event"]
84 #[inline(always)]
85 pub fn is_value1(&self) -> bool {
86 *self == SEV1_A::VALUE1
87 }
88 #[doc = "A source event has occurred"]
89 #[inline(always)]
90 pub fn is_value2(&self) -> bool {
91 *self == SEV1_A::VALUE2
92 }
93}
94#[doc = "Field `SEV1` writer - Source Event 0/1"]
95pub type SEV1_W<'a, REG> = crate::BitWriter<'a, REG, SEV1_A>;
96impl<'a, REG> SEV1_W<'a, REG>
97where
98 REG: crate::Writable + crate::RegisterSpec,
99{
100 #[doc = "No source event"]
101 #[inline(always)]
102 pub fn value1(self) -> &'a mut crate::W<REG> {
103 self.variant(SEV1_A::VALUE1)
104 }
105 #[doc = "A source event has occurred"]
106 #[inline(always)]
107 pub fn value2(self) -> &'a mut crate::W<REG> {
108 self.variant(SEV1_A::VALUE2)
109 }
110}
111impl R {
112 #[doc = "Bit 0 - Source Event 0/1"]
113 #[inline(always)]
114 pub fn sev0(&self) -> SEV0_R {
115 SEV0_R::new((self.bits & 1) != 0)
116 }
117 #[doc = "Bit 1 - Source Event 0/1"]
118 #[inline(always)]
119 pub fn sev1(&self) -> SEV1_R {
120 SEV1_R::new(((self.bits >> 1) & 1) != 0)
121 }
122}
123impl W {
124 #[doc = "Bit 0 - Source Event 0/1"]
125 #[inline(always)]
126 pub fn sev0(&mut self) -> SEV0_W<SEFLAG_SPEC> {
127 SEV0_W::new(self, 0)
128 }
129 #[doc = "Bit 1 - Source Event 0/1"]
130 #[inline(always)]
131 pub fn sev1(&mut self) -> SEV1_W<SEFLAG_SPEC> {
132 SEV1_W::new(self, 1)
133 }
134}
135#[doc = "Source Event Flag Register\n\nYou can [`read`](crate::Reg::read) this register and get [`seflag::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`seflag::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
136pub struct SEFLAG_SPEC;
137impl crate::RegisterSpec for SEFLAG_SPEC {
138 type Ux = u32;
139}
140#[doc = "`read()` method returns [`seflag::R`](R) reader structure"]
141impl crate::Readable for SEFLAG_SPEC {}
142#[doc = "`write(|w| ..)` method takes [`seflag::W`](W) writer structure"]
143impl crate::Writable for SEFLAG_SPEC {
144 type Safety = crate::Unsafe;
145 const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
146 const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
147}
148#[doc = "`reset()` method sets SEFLAG to value 0"]
149impl crate::Resettable for SEFLAG_SPEC {
150 const RESET_VALUE: u32 = 0;
151}