max32660/spi0/
wake_fl.rs

1#[doc = "Register `WAKE_FL` reader"]
2pub type R = crate::R<WAKE_FL_SPEC>;
3#[doc = "Register `WAKE_FL` writer"]
4pub type W = crate::W<WAKE_FL_SPEC>;
5#[doc = "Field `TX_LEVEL` reader - Wake on TX FIFO Threshold Crossed."]
6pub type TX_LEVEL_R = crate::BitReader<TX_LEVEL_A>;
7#[doc = "Wake on TX FIFO Threshold Crossed.\n\nValue on reset: 0"]
8#[derive(Clone, Copy, Debug, PartialEq, Eq)]
9pub enum TX_LEVEL_A {
10    #[doc = "1: Flag is set when value read is 1."]
11    CLEAR = 1,
12}
13impl From<TX_LEVEL_A> for bool {
14    #[inline(always)]
15    fn from(variant: TX_LEVEL_A) -> Self {
16        variant as u8 != 0
17    }
18}
19impl TX_LEVEL_R {
20    #[doc = "Get enumerated values variant"]
21    #[inline(always)]
22    pub fn variant(&self) -> Option<TX_LEVEL_A> {
23        match self.bits {
24            true => Some(TX_LEVEL_A::CLEAR),
25            _ => None,
26        }
27    }
28    #[doc = "Flag is set when value read is 1."]
29    #[inline(always)]
30    pub fn is_clear(&self) -> bool {
31        *self == TX_LEVEL_A::CLEAR
32    }
33}
34#[doc = "Field `TX_LEVEL` writer - Wake on TX FIFO Threshold Crossed."]
35pub type TX_LEVEL_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O, TX_LEVEL_A>;
36impl<'a, REG, const O: u8> TX_LEVEL_W<'a, REG, O>
37where
38    REG: crate::Writable + crate::RegisterSpec,
39{
40    #[doc = "Flag is set when value read is 1."]
41    #[inline(always)]
42    pub fn clear(self) -> &'a mut crate::W<REG> {
43        self.variant(TX_LEVEL_A::CLEAR)
44    }
45}
46#[doc = "Field `TX_EMPTY` reader - Wake on TX FIFO Empty."]
47pub type TX_EMPTY_R = crate::BitReader<TX_EMPTY_A>;
48#[doc = "Wake on TX FIFO Empty.\n\nValue on reset: 0"]
49#[derive(Clone, Copy, Debug, PartialEq, Eq)]
50pub enum TX_EMPTY_A {
51    #[doc = "1: Flag is set when value read is 1."]
52    CLEAR = 1,
53}
54impl From<TX_EMPTY_A> for bool {
55    #[inline(always)]
56    fn from(variant: TX_EMPTY_A) -> Self {
57        variant as u8 != 0
58    }
59}
60impl TX_EMPTY_R {
61    #[doc = "Get enumerated values variant"]
62    #[inline(always)]
63    pub fn variant(&self) -> Option<TX_EMPTY_A> {
64        match self.bits {
65            true => Some(TX_EMPTY_A::CLEAR),
66            _ => None,
67        }
68    }
69    #[doc = "Flag is set when value read is 1."]
70    #[inline(always)]
71    pub fn is_clear(&self) -> bool {
72        *self == TX_EMPTY_A::CLEAR
73    }
74}
75#[doc = "Field `TX_EMPTY` writer - Wake on TX FIFO Empty."]
76pub type TX_EMPTY_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O, TX_EMPTY_A>;
77impl<'a, REG, const O: u8> TX_EMPTY_W<'a, REG, O>
78where
79    REG: crate::Writable + crate::RegisterSpec,
80{
81    #[doc = "Flag is set when value read is 1."]
82    #[inline(always)]
83    pub fn clear(self) -> &'a mut crate::W<REG> {
84        self.variant(TX_EMPTY_A::CLEAR)
85    }
86}
87#[doc = "Field `RX_LEVEL` reader - Wake on RX FIFO Threshold Crossed."]
88pub type RX_LEVEL_R = crate::BitReader<RX_LEVEL_A>;
89#[doc = "Wake on RX FIFO Threshold Crossed.\n\nValue on reset: 0"]
90#[derive(Clone, Copy, Debug, PartialEq, Eq)]
91pub enum RX_LEVEL_A {
92    #[doc = "1: Flag is set when value read is 1."]
93    CLEAR = 1,
94}
95impl From<RX_LEVEL_A> for bool {
96    #[inline(always)]
97    fn from(variant: RX_LEVEL_A) -> Self {
98        variant as u8 != 0
99    }
100}
101impl RX_LEVEL_R {
102    #[doc = "Get enumerated values variant"]
103    #[inline(always)]
104    pub fn variant(&self) -> Option<RX_LEVEL_A> {
105        match self.bits {
106            true => Some(RX_LEVEL_A::CLEAR),
107            _ => None,
108        }
109    }
110    #[doc = "Flag is set when value read is 1."]
111    #[inline(always)]
112    pub fn is_clear(&self) -> bool {
113        *self == RX_LEVEL_A::CLEAR
114    }
115}
116#[doc = "Field `RX_LEVEL` writer - Wake on RX FIFO Threshold Crossed."]
117pub type RX_LEVEL_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O, RX_LEVEL_A>;
118impl<'a, REG, const O: u8> RX_LEVEL_W<'a, REG, O>
119where
120    REG: crate::Writable + crate::RegisterSpec,
121{
122    #[doc = "Flag is set when value read is 1."]
123    #[inline(always)]
124    pub fn clear(self) -> &'a mut crate::W<REG> {
125        self.variant(RX_LEVEL_A::CLEAR)
126    }
127}
128#[doc = "Field `RX_FULL` reader - Wake on RX FIFO Full."]
129pub type RX_FULL_R = crate::BitReader<RX_FULL_A>;
130#[doc = "Wake on RX FIFO Full.\n\nValue on reset: 0"]
131#[derive(Clone, Copy, Debug, PartialEq, Eq)]
132pub enum RX_FULL_A {
133    #[doc = "1: Flag is set when value read is 1."]
134    CLEAR = 1,
135}
136impl From<RX_FULL_A> for bool {
137    #[inline(always)]
138    fn from(variant: RX_FULL_A) -> Self {
139        variant as u8 != 0
140    }
141}
142impl RX_FULL_R {
143    #[doc = "Get enumerated values variant"]
144    #[inline(always)]
145    pub fn variant(&self) -> Option<RX_FULL_A> {
146        match self.bits {
147            true => Some(RX_FULL_A::CLEAR),
148            _ => None,
149        }
150    }
151    #[doc = "Flag is set when value read is 1."]
152    #[inline(always)]
153    pub fn is_clear(&self) -> bool {
154        *self == RX_FULL_A::CLEAR
155    }
156}
157#[doc = "Field `RX_FULL` writer - Wake on RX FIFO Full."]
158pub type RX_FULL_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O, RX_FULL_A>;
159impl<'a, REG, const O: u8> RX_FULL_W<'a, REG, O>
160where
161    REG: crate::Writable + crate::RegisterSpec,
162{
163    #[doc = "Flag is set when value read is 1."]
164    #[inline(always)]
165    pub fn clear(self) -> &'a mut crate::W<REG> {
166        self.variant(RX_FULL_A::CLEAR)
167    }
168}
169impl R {
170    #[doc = "Bit 0 - Wake on TX FIFO Threshold Crossed."]
171    #[inline(always)]
172    pub fn tx_level(&self) -> TX_LEVEL_R {
173        TX_LEVEL_R::new((self.bits & 1) != 0)
174    }
175    #[doc = "Bit 1 - Wake on TX FIFO Empty."]
176    #[inline(always)]
177    pub fn tx_empty(&self) -> TX_EMPTY_R {
178        TX_EMPTY_R::new(((self.bits >> 1) & 1) != 0)
179    }
180    #[doc = "Bit 2 - Wake on RX FIFO Threshold Crossed."]
181    #[inline(always)]
182    pub fn rx_level(&self) -> RX_LEVEL_R {
183        RX_LEVEL_R::new(((self.bits >> 2) & 1) != 0)
184    }
185    #[doc = "Bit 3 - Wake on RX FIFO Full."]
186    #[inline(always)]
187    pub fn rx_full(&self) -> RX_FULL_R {
188        RX_FULL_R::new(((self.bits >> 3) & 1) != 0)
189    }
190}
191impl W {
192    #[doc = "Bit 0 - Wake on TX FIFO Threshold Crossed."]
193    #[inline(always)]
194    #[must_use]
195    pub fn tx_level(&mut self) -> TX_LEVEL_W<WAKE_FL_SPEC, 0> {
196        TX_LEVEL_W::new(self)
197    }
198    #[doc = "Bit 1 - Wake on TX FIFO Empty."]
199    #[inline(always)]
200    #[must_use]
201    pub fn tx_empty(&mut self) -> TX_EMPTY_W<WAKE_FL_SPEC, 1> {
202        TX_EMPTY_W::new(self)
203    }
204    #[doc = "Bit 2 - Wake on RX FIFO Threshold Crossed."]
205    #[inline(always)]
206    #[must_use]
207    pub fn rx_level(&mut self) -> RX_LEVEL_W<WAKE_FL_SPEC, 2> {
208        RX_LEVEL_W::new(self)
209    }
210    #[doc = "Bit 3 - Wake on RX FIFO Full."]
211    #[inline(always)]
212    #[must_use]
213    pub fn rx_full(&mut self) -> RX_FULL_W<WAKE_FL_SPEC, 3> {
214        RX_FULL_W::new(self)
215    }
216    #[doc = r" Writes raw bits to the register."]
217    #[doc = r""]
218    #[doc = r" # Safety"]
219    #[doc = r""]
220    #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
221    #[inline(always)]
222    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
223        self.bits = bits;
224        self
225    }
226}
227#[doc = "Wakeup Flags.\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`wake_fl::R`](R).  You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`wake_fl::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
228pub struct WAKE_FL_SPEC;
229impl crate::RegisterSpec for WAKE_FL_SPEC {
230    type Ux = u32;
231}
232#[doc = "`read()` method returns [`wake_fl::R`](R) reader structure"]
233impl crate::Readable for WAKE_FL_SPEC {}
234#[doc = "`write(|w| ..)` method takes [`wake_fl::W`](W) writer structure"]
235impl crate::Writable for WAKE_FL_SPEC {
236    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
237    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
238}
239#[doc = "`reset()` method sets WAKE_FL to value 0"]
240impl crate::Resettable for WAKE_FL_SPEC {
241    const RESET_VALUE: Self::Ux = 0;
242}