xmc4800/vadc_g0/
qsr0.rs

1#[doc = "Register `QSR0` reader"]
2pub type R = crate::R<QSR0_SPEC>;
3#[doc = "Filling Level for Queue 2\n\nValue on reset: 0"]
4#[derive(Clone, Copy, Debug, PartialEq, Eq)]
5#[repr(u8)]
6pub enum FILL_A {
7    #[doc = "0: There is 1 ( if EMPTY = 0) or no (if EMPTY = 1) valid entry in the queue"]
8    VALUE1 = 0,
9    #[doc = "1: There are 2 valid entries in the queue"]
10    VALUE2 = 1,
11    #[doc = "2: There are 3 valid entries in the queue"]
12    VALUE3 = 2,
13    #[doc = "7: There are 8 valid entries in the queue"]
14    VALUE4 = 7,
15}
16impl From<FILL_A> for u8 {
17    #[inline(always)]
18    fn from(variant: FILL_A) -> Self {
19        variant as _
20    }
21}
22impl crate::FieldSpec for FILL_A {
23    type Ux = u8;
24}
25impl crate::IsEnum for FILL_A {}
26#[doc = "Field `FILL` reader - Filling Level for Queue 2"]
27pub type FILL_R = crate::FieldReader<FILL_A>;
28impl FILL_R {
29    #[doc = "Get enumerated values variant"]
30    #[inline(always)]
31    pub const fn variant(&self) -> Option<FILL_A> {
32        match self.bits {
33            0 => Some(FILL_A::VALUE1),
34            1 => Some(FILL_A::VALUE2),
35            2 => Some(FILL_A::VALUE3),
36            7 => Some(FILL_A::VALUE4),
37            _ => None,
38        }
39    }
40    #[doc = "There is 1 ( if EMPTY = 0) or no (if EMPTY = 1) valid entry in the queue"]
41    #[inline(always)]
42    pub fn is_value1(&self) -> bool {
43        *self == FILL_A::VALUE1
44    }
45    #[doc = "There are 2 valid entries in the queue"]
46    #[inline(always)]
47    pub fn is_value2(&self) -> bool {
48        *self == FILL_A::VALUE2
49    }
50    #[doc = "There are 3 valid entries in the queue"]
51    #[inline(always)]
52    pub fn is_value3(&self) -> bool {
53        *self == FILL_A::VALUE3
54    }
55    #[doc = "There are 8 valid entries in the queue"]
56    #[inline(always)]
57    pub fn is_value4(&self) -> bool {
58        *self == FILL_A::VALUE4
59    }
60}
61#[doc = "Queue Empty\n\nValue on reset: 1"]
62#[derive(Clone, Copy, Debug, PartialEq, Eq)]
63pub enum EMPTY_A {
64    #[doc = "0: There are valid entries in the queue (see FILL)"]
65    VALUE1 = 0,
66    #[doc = "1: No valid entries (queue is empty)"]
67    VALUE2 = 1,
68}
69impl From<EMPTY_A> for bool {
70    #[inline(always)]
71    fn from(variant: EMPTY_A) -> Self {
72        variant as u8 != 0
73    }
74}
75#[doc = "Field `EMPTY` reader - Queue Empty"]
76pub type EMPTY_R = crate::BitReader<EMPTY_A>;
77impl EMPTY_R {
78    #[doc = "Get enumerated values variant"]
79    #[inline(always)]
80    pub const fn variant(&self) -> EMPTY_A {
81        match self.bits {
82            false => EMPTY_A::VALUE1,
83            true => EMPTY_A::VALUE2,
84        }
85    }
86    #[doc = "There are valid entries in the queue (see FILL)"]
87    #[inline(always)]
88    pub fn is_value1(&self) -> bool {
89        *self == EMPTY_A::VALUE1
90    }
91    #[doc = "No valid entries (queue is empty)"]
92    #[inline(always)]
93    pub fn is_value2(&self) -> bool {
94        *self == EMPTY_A::VALUE2
95    }
96}
97#[doc = "Request Gate Level\n\nValue on reset: 0"]
98#[derive(Clone, Copy, Debug, PartialEq, Eq)]
99pub enum REQGT_A {
100    #[doc = "0: The gate input is low"]
101    VALUE1 = 0,
102    #[doc = "1: The gate input is high"]
103    VALUE2 = 1,
104}
105impl From<REQGT_A> for bool {
106    #[inline(always)]
107    fn from(variant: REQGT_A) -> Self {
108        variant as u8 != 0
109    }
110}
111#[doc = "Field `REQGT` reader - Request Gate Level"]
112pub type REQGT_R = crate::BitReader<REQGT_A>;
113impl REQGT_R {
114    #[doc = "Get enumerated values variant"]
115    #[inline(always)]
116    pub const fn variant(&self) -> REQGT_A {
117        match self.bits {
118            false => REQGT_A::VALUE1,
119            true => REQGT_A::VALUE2,
120        }
121    }
122    #[doc = "The gate input is low"]
123    #[inline(always)]
124    pub fn is_value1(&self) -> bool {
125        *self == REQGT_A::VALUE1
126    }
127    #[doc = "The gate input is high"]
128    #[inline(always)]
129    pub fn is_value2(&self) -> bool {
130        *self == REQGT_A::VALUE2
131    }
132}
133#[doc = "Event Detected\n\nValue on reset: 0"]
134#[derive(Clone, Copy, Debug, PartialEq, Eq)]
135pub enum EV_A {
136    #[doc = "0: No trigger event"]
137    VALUE1 = 0,
138    #[doc = "1: A trigger event has been detected"]
139    VALUE2 = 1,
140}
141impl From<EV_A> for bool {
142    #[inline(always)]
143    fn from(variant: EV_A) -> Self {
144        variant as u8 != 0
145    }
146}
147#[doc = "Field `EV` reader - Event Detected"]
148pub type EV_R = crate::BitReader<EV_A>;
149impl EV_R {
150    #[doc = "Get enumerated values variant"]
151    #[inline(always)]
152    pub const fn variant(&self) -> EV_A {
153        match self.bits {
154            false => EV_A::VALUE1,
155            true => EV_A::VALUE2,
156        }
157    }
158    #[doc = "No trigger event"]
159    #[inline(always)]
160    pub fn is_value1(&self) -> bool {
161        *self == EV_A::VALUE1
162    }
163    #[doc = "A trigger event has been detected"]
164    #[inline(always)]
165    pub fn is_value2(&self) -> bool {
166        *self == EV_A::VALUE2
167    }
168}
169impl R {
170    #[doc = "Bits 0:3 - Filling Level for Queue 2"]
171    #[inline(always)]
172    pub fn fill(&self) -> FILL_R {
173        FILL_R::new((self.bits & 0x0f) as u8)
174    }
175    #[doc = "Bit 5 - Queue Empty"]
176    #[inline(always)]
177    pub fn empty(&self) -> EMPTY_R {
178        EMPTY_R::new(((self.bits >> 5) & 1) != 0)
179    }
180    #[doc = "Bit 7 - Request Gate Level"]
181    #[inline(always)]
182    pub fn reqgt(&self) -> REQGT_R {
183        REQGT_R::new(((self.bits >> 7) & 1) != 0)
184    }
185    #[doc = "Bit 8 - Event Detected"]
186    #[inline(always)]
187    pub fn ev(&self) -> EV_R {
188        EV_R::new(((self.bits >> 8) & 1) != 0)
189    }
190}
191#[doc = "Queue 0 Status Register\n\nYou can [`read`](crate::Reg::read) this register and get [`qsr0::R`](R). See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
192pub struct QSR0_SPEC;
193impl crate::RegisterSpec for QSR0_SPEC {
194    type Ux = u32;
195}
196#[doc = "`read()` method returns [`qsr0::R`](R) reader structure"]
197impl crate::Readable for QSR0_SPEC {}
198#[doc = "`reset()` method sets QSR0 to value 0x20"]
199impl crate::Resettable for QSR0_SPEC {
200    const RESET_VALUE: u32 = 0x20;
201}