mcxa_pac/i3c0/
sdatactrl.rs

1#[doc = "Register `SDATACTRL` reader"]
2pub type R = crate::R<SdatactrlSpec>;
3#[doc = "Register `SDATACTRL` writer"]
4pub type W = crate::W<SdatactrlSpec>;
5#[doc = "Flush To-Bus Buffer or FIFO\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8pub enum Flushtb {
9    #[doc = "0: No action"]
10    NoAction = 0,
11    #[doc = "1: Flush the buffer"]
12    Flush = 1,
13}
14impl From<Flushtb> for bool {
15    #[inline(always)]
16    fn from(variant: Flushtb) -> Self {
17        variant as u8 != 0
18    }
19}
20#[doc = "Field `FLUSHTB` writer - Flush To-Bus Buffer or FIFO"]
21pub type FlushtbW<'a, REG> = crate::BitWriter<'a, REG, Flushtb>;
22impl<'a, REG> FlushtbW<'a, REG>
23where
24    REG: crate::Writable + crate::RegisterSpec,
25{
26    #[doc = "No action"]
27    #[inline(always)]
28    pub fn no_action(self) -> &'a mut crate::W<REG> {
29        self.variant(Flushtb::NoAction)
30    }
31    #[doc = "Flush the buffer"]
32    #[inline(always)]
33    pub fn flush(self) -> &'a mut crate::W<REG> {
34        self.variant(Flushtb::Flush)
35    }
36}
37#[doc = "Flush From-Bus Buffer or FIFO\n\nValue on reset: 0"]
38#[cfg_attr(feature = "defmt", derive(defmt::Format))]
39#[derive(Clone, Copy, Debug, PartialEq, Eq)]
40pub enum Flushfb {
41    #[doc = "0: No action"]
42    NoAction = 0,
43    #[doc = "1: Flush the buffer"]
44    Flush = 1,
45}
46impl From<Flushfb> for bool {
47    #[inline(always)]
48    fn from(variant: Flushfb) -> Self {
49        variant as u8 != 0
50    }
51}
52#[doc = "Field `FLUSHFB` writer - Flush From-Bus Buffer or FIFO"]
53pub type FlushfbW<'a, REG> = crate::BitWriter<'a, REG, Flushfb>;
54impl<'a, REG> FlushfbW<'a, REG>
55where
56    REG: crate::Writable + crate::RegisterSpec,
57{
58    #[doc = "No action"]
59    #[inline(always)]
60    pub fn no_action(self) -> &'a mut crate::W<REG> {
61        self.variant(Flushfb::NoAction)
62    }
63    #[doc = "Flush the buffer"]
64    #[inline(always)]
65    pub fn flush(self) -> &'a mut crate::W<REG> {
66        self.variant(Flushfb::Flush)
67    }
68}
69#[doc = "Unlock\n\nValue on reset: 0"]
70#[cfg_attr(feature = "defmt", derive(defmt::Format))]
71#[derive(Clone, Copy, Debug, PartialEq, Eq)]
72pub enum Unlock {
73    #[doc = "0: Cannot be changed"]
74    Disabled = 0,
75    #[doc = "1: Can be changed"]
76    Enabled = 1,
77}
78impl From<Unlock> for bool {
79    #[inline(always)]
80    fn from(variant: Unlock) -> Self {
81        variant as u8 != 0
82    }
83}
84#[doc = "Field `UNLOCK` writer - Unlock"]
85pub type UnlockW<'a, REG> = crate::BitWriter<'a, REG, Unlock>;
86impl<'a, REG> UnlockW<'a, REG>
87where
88    REG: crate::Writable + crate::RegisterSpec,
89{
90    #[doc = "Cannot be changed"]
91    #[inline(always)]
92    pub fn disabled(self) -> &'a mut crate::W<REG> {
93        self.variant(Unlock::Disabled)
94    }
95    #[doc = "Can be changed"]
96    #[inline(always)]
97    pub fn enabled(self) -> &'a mut crate::W<REG> {
98        self.variant(Unlock::Enabled)
99    }
100}
101#[doc = "Transmit Trigger Level\n\nValue on reset: 3"]
102#[cfg_attr(feature = "defmt", derive(defmt::Format))]
103#[derive(Clone, Copy, Debug, PartialEq, Eq)]
104#[repr(u8)]
105pub enum Txtrig {
106    #[doc = "0: Trigger when empty"]
107    Triggrempty = 0,
108    #[doc = "1: Trigger when 1/4 full or less"]
109    Triggronefourth = 1,
110    #[doc = "2: Trigger when 1/2 full or less"]
111    Triggronehalf = 2,
112    #[doc = "3: Default (trigger when 1 less than full or less)"]
113    Triggroneless = 3,
114}
115impl From<Txtrig> for u8 {
116    #[inline(always)]
117    fn from(variant: Txtrig) -> Self {
118        variant as _
119    }
120}
121impl crate::FieldSpec for Txtrig {
122    type Ux = u8;
123}
124impl crate::IsEnum for Txtrig {}
125#[doc = "Field `TXTRIG` reader - Transmit Trigger Level"]
126pub type TxtrigR = crate::FieldReader<Txtrig>;
127impl TxtrigR {
128    #[doc = "Get enumerated values variant"]
129    #[inline(always)]
130    pub const fn variant(&self) -> Txtrig {
131        match self.bits {
132            0 => Txtrig::Triggrempty,
133            1 => Txtrig::Triggronefourth,
134            2 => Txtrig::Triggronehalf,
135            3 => Txtrig::Triggroneless,
136            _ => unreachable!(),
137        }
138    }
139    #[doc = "Trigger when empty"]
140    #[inline(always)]
141    pub fn is_triggrempty(&self) -> bool {
142        *self == Txtrig::Triggrempty
143    }
144    #[doc = "Trigger when 1/4 full or less"]
145    #[inline(always)]
146    pub fn is_triggronefourth(&self) -> bool {
147        *self == Txtrig::Triggronefourth
148    }
149    #[doc = "Trigger when 1/2 full or less"]
150    #[inline(always)]
151    pub fn is_triggronehalf(&self) -> bool {
152        *self == Txtrig::Triggronehalf
153    }
154    #[doc = "Default (trigger when 1 less than full or less)"]
155    #[inline(always)]
156    pub fn is_triggroneless(&self) -> bool {
157        *self == Txtrig::Triggroneless
158    }
159}
160#[doc = "Field `TXTRIG` writer - Transmit Trigger Level"]
161pub type TxtrigW<'a, REG> = crate::FieldWriter<'a, REG, 2, Txtrig, crate::Safe>;
162impl<'a, REG> TxtrigW<'a, REG>
163where
164    REG: crate::Writable + crate::RegisterSpec,
165    REG::Ux: From<u8>,
166{
167    #[doc = "Trigger when empty"]
168    #[inline(always)]
169    pub fn triggrempty(self) -> &'a mut crate::W<REG> {
170        self.variant(Txtrig::Triggrempty)
171    }
172    #[doc = "Trigger when 1/4 full or less"]
173    #[inline(always)]
174    pub fn triggronefourth(self) -> &'a mut crate::W<REG> {
175        self.variant(Txtrig::Triggronefourth)
176    }
177    #[doc = "Trigger when 1/2 full or less"]
178    #[inline(always)]
179    pub fn triggronehalf(self) -> &'a mut crate::W<REG> {
180        self.variant(Txtrig::Triggronehalf)
181    }
182    #[doc = "Default (trigger when 1 less than full or less)"]
183    #[inline(always)]
184    pub fn triggroneless(self) -> &'a mut crate::W<REG> {
185        self.variant(Txtrig::Triggroneless)
186    }
187}
188#[doc = "Receive Trigger Level\n\nValue on reset: 0"]
189#[cfg_attr(feature = "defmt", derive(defmt::Format))]
190#[derive(Clone, Copy, Debug, PartialEq, Eq)]
191#[repr(u8)]
192pub enum Rxtrig {
193    #[doc = "0: Trigger when not empty (default)"]
194    Triggrnotempty = 0,
195    #[doc = "1: Trigger when 1/4 or more full"]
196    Triggronefourth = 1,
197    #[doc = "2: Trigger when 1/2 or more full"]
198    Triggronehalf = 2,
199    #[doc = "3: Trigger when 3/4 or more full"]
200    Triggrthreefourths = 3,
201}
202impl From<Rxtrig> for u8 {
203    #[inline(always)]
204    fn from(variant: Rxtrig) -> Self {
205        variant as _
206    }
207}
208impl crate::FieldSpec for Rxtrig {
209    type Ux = u8;
210}
211impl crate::IsEnum for Rxtrig {}
212#[doc = "Field `RXTRIG` reader - Receive Trigger Level"]
213pub type RxtrigR = crate::FieldReader<Rxtrig>;
214impl RxtrigR {
215    #[doc = "Get enumerated values variant"]
216    #[inline(always)]
217    pub const fn variant(&self) -> Rxtrig {
218        match self.bits {
219            0 => Rxtrig::Triggrnotempty,
220            1 => Rxtrig::Triggronefourth,
221            2 => Rxtrig::Triggronehalf,
222            3 => Rxtrig::Triggrthreefourths,
223            _ => unreachable!(),
224        }
225    }
226    #[doc = "Trigger when not empty (default)"]
227    #[inline(always)]
228    pub fn is_triggrnotempty(&self) -> bool {
229        *self == Rxtrig::Triggrnotempty
230    }
231    #[doc = "Trigger when 1/4 or more full"]
232    #[inline(always)]
233    pub fn is_triggronefourth(&self) -> bool {
234        *self == Rxtrig::Triggronefourth
235    }
236    #[doc = "Trigger when 1/2 or more full"]
237    #[inline(always)]
238    pub fn is_triggronehalf(&self) -> bool {
239        *self == Rxtrig::Triggronehalf
240    }
241    #[doc = "Trigger when 3/4 or more full"]
242    #[inline(always)]
243    pub fn is_triggrthreefourths(&self) -> bool {
244        *self == Rxtrig::Triggrthreefourths
245    }
246}
247#[doc = "Field `RXTRIG` writer - Receive Trigger Level"]
248pub type RxtrigW<'a, REG> = crate::FieldWriter<'a, REG, 2, Rxtrig, crate::Safe>;
249impl<'a, REG> RxtrigW<'a, REG>
250where
251    REG: crate::Writable + crate::RegisterSpec,
252    REG::Ux: From<u8>,
253{
254    #[doc = "Trigger when not empty (default)"]
255    #[inline(always)]
256    pub fn triggrnotempty(self) -> &'a mut crate::W<REG> {
257        self.variant(Rxtrig::Triggrnotempty)
258    }
259    #[doc = "Trigger when 1/4 or more full"]
260    #[inline(always)]
261    pub fn triggronefourth(self) -> &'a mut crate::W<REG> {
262        self.variant(Rxtrig::Triggronefourth)
263    }
264    #[doc = "Trigger when 1/2 or more full"]
265    #[inline(always)]
266    pub fn triggronehalf(self) -> &'a mut crate::W<REG> {
267        self.variant(Rxtrig::Triggronehalf)
268    }
269    #[doc = "Trigger when 3/4 or more full"]
270    #[inline(always)]
271    pub fn triggrthreefourths(self) -> &'a mut crate::W<REG> {
272        self.variant(Rxtrig::Triggrthreefourths)
273    }
274}
275#[doc = "Field `TXCOUNT` reader - Count of Entries in Transmit"]
276pub type TxcountR = crate::FieldReader;
277#[doc = "Field `RXCOUNT` reader - Count of Entries in Receive"]
278pub type RxcountR = crate::FieldReader;
279#[doc = "Transmit is Full\n\nValue on reset: 0"]
280#[cfg_attr(feature = "defmt", derive(defmt::Format))]
281#[derive(Clone, Copy, Debug, PartialEq, Eq)]
282pub enum Txfull {
283    #[doc = "0: Not full"]
284    Txisnotfull = 0,
285    #[doc = "1: Full"]
286    Txisfull = 1,
287}
288impl From<Txfull> for bool {
289    #[inline(always)]
290    fn from(variant: Txfull) -> Self {
291        variant as u8 != 0
292    }
293}
294#[doc = "Field `TXFULL` reader - Transmit is Full"]
295pub type TxfullR = crate::BitReader<Txfull>;
296impl TxfullR {
297    #[doc = "Get enumerated values variant"]
298    #[inline(always)]
299    pub const fn variant(&self) -> Txfull {
300        match self.bits {
301            false => Txfull::Txisnotfull,
302            true => Txfull::Txisfull,
303        }
304    }
305    #[doc = "Not full"]
306    #[inline(always)]
307    pub fn is_txisnotfull(&self) -> bool {
308        *self == Txfull::Txisnotfull
309    }
310    #[doc = "Full"]
311    #[inline(always)]
312    pub fn is_txisfull(&self) -> bool {
313        *self == Txfull::Txisfull
314    }
315}
316#[doc = "Receive is Empty\n\nValue on reset: 1"]
317#[cfg_attr(feature = "defmt", derive(defmt::Format))]
318#[derive(Clone, Copy, Debug, PartialEq, Eq)]
319pub enum Rxempty {
320    #[doc = "0: Not empty"]
321    Rxisnotempty = 0,
322    #[doc = "1: Empty"]
323    Rxisempty = 1,
324}
325impl From<Rxempty> for bool {
326    #[inline(always)]
327    fn from(variant: Rxempty) -> Self {
328        variant as u8 != 0
329    }
330}
331#[doc = "Field `RXEMPTY` reader - Receive is Empty"]
332pub type RxemptyR = crate::BitReader<Rxempty>;
333impl RxemptyR {
334    #[doc = "Get enumerated values variant"]
335    #[inline(always)]
336    pub const fn variant(&self) -> Rxempty {
337        match self.bits {
338            false => Rxempty::Rxisnotempty,
339            true => Rxempty::Rxisempty,
340        }
341    }
342    #[doc = "Not empty"]
343    #[inline(always)]
344    pub fn is_rxisnotempty(&self) -> bool {
345        *self == Rxempty::Rxisnotempty
346    }
347    #[doc = "Empty"]
348    #[inline(always)]
349    pub fn is_rxisempty(&self) -> bool {
350        *self == Rxempty::Rxisempty
351    }
352}
353impl R {
354    #[doc = "Bits 4:5 - Transmit Trigger Level"]
355    #[inline(always)]
356    pub fn txtrig(&self) -> TxtrigR {
357        TxtrigR::new(((self.bits >> 4) & 3) as u8)
358    }
359    #[doc = "Bits 6:7 - Receive Trigger Level"]
360    #[inline(always)]
361    pub fn rxtrig(&self) -> RxtrigR {
362        RxtrigR::new(((self.bits >> 6) & 3) as u8)
363    }
364    #[doc = "Bits 16:20 - Count of Entries in Transmit"]
365    #[inline(always)]
366    pub fn txcount(&self) -> TxcountR {
367        TxcountR::new(((self.bits >> 16) & 0x1f) as u8)
368    }
369    #[doc = "Bits 24:28 - Count of Entries in Receive"]
370    #[inline(always)]
371    pub fn rxcount(&self) -> RxcountR {
372        RxcountR::new(((self.bits >> 24) & 0x1f) as u8)
373    }
374    #[doc = "Bit 30 - Transmit is Full"]
375    #[inline(always)]
376    pub fn txfull(&self) -> TxfullR {
377        TxfullR::new(((self.bits >> 30) & 1) != 0)
378    }
379    #[doc = "Bit 31 - Receive is Empty"]
380    #[inline(always)]
381    pub fn rxempty(&self) -> RxemptyR {
382        RxemptyR::new(((self.bits >> 31) & 1) != 0)
383    }
384}
385#[cfg(feature = "debug")]
386impl core::fmt::Debug for R {
387    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
388        f.debug_struct("SDATACTRL")
389            .field("txtrig", &self.txtrig())
390            .field("rxtrig", &self.rxtrig())
391            .field("txcount", &self.txcount())
392            .field("rxcount", &self.rxcount())
393            .field("txfull", &self.txfull())
394            .field("rxempty", &self.rxempty())
395            .finish()
396    }
397}
398impl W {
399    #[doc = "Bit 0 - Flush To-Bus Buffer or FIFO"]
400    #[inline(always)]
401    pub fn flushtb(&mut self) -> FlushtbW<'_, SdatactrlSpec> {
402        FlushtbW::new(self, 0)
403    }
404    #[doc = "Bit 1 - Flush From-Bus Buffer or FIFO"]
405    #[inline(always)]
406    pub fn flushfb(&mut self) -> FlushfbW<'_, SdatactrlSpec> {
407        FlushfbW::new(self, 1)
408    }
409    #[doc = "Bit 3 - Unlock"]
410    #[inline(always)]
411    pub fn unlock(&mut self) -> UnlockW<'_, SdatactrlSpec> {
412        UnlockW::new(self, 3)
413    }
414    #[doc = "Bits 4:5 - Transmit Trigger Level"]
415    #[inline(always)]
416    pub fn txtrig(&mut self) -> TxtrigW<'_, SdatactrlSpec> {
417        TxtrigW::new(self, 4)
418    }
419    #[doc = "Bits 6:7 - Receive Trigger Level"]
420    #[inline(always)]
421    pub fn rxtrig(&mut self) -> RxtrigW<'_, SdatactrlSpec> {
422        RxtrigW::new(self, 6)
423    }
424}
425#[doc = "Target Data Control\n\nYou can [`read`](crate::Reg::read) this register and get [`sdatactrl::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`sdatactrl::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
426pub struct SdatactrlSpec;
427impl crate::RegisterSpec for SdatactrlSpec {
428    type Ux = u32;
429}
430#[doc = "`read()` method returns [`sdatactrl::R`](R) reader structure"]
431impl crate::Readable for SdatactrlSpec {}
432#[doc = "`write(|w| ..)` method takes [`sdatactrl::W`](W) writer structure"]
433impl crate::Writable for SdatactrlSpec {
434    type Safety = crate::Unsafe;
435}
436#[doc = "`reset()` method sets SDATACTRL to value 0x8000_0030"]
437impl crate::Resettable for SdatactrlSpec {
438    const RESET_VALUE: u32 = 0x8000_0030;
439}