Skip to main content

mcxa_pac/lpi2c0/
mrdror.rs

1#[doc = "Register `MRDROR` reader"]
2pub type R = crate::R<MrdrorSpec>;
3#[doc = "Field `DATA` reader - Receive Data"]
4pub type DataR = crate::FieldReader;
5#[doc = "RX Empty\n\nValue on reset: 1"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8pub enum Rxempty {
9    #[doc = "0: Not empty"]
10    NotEmpty = 0,
11    #[doc = "1: Empty"]
12    Empty = 1,
13}
14impl From<Rxempty> for bool {
15    #[inline(always)]
16    fn from(variant: Rxempty) -> Self {
17        variant as u8 != 0
18    }
19}
20#[doc = "Field `RXEMPTY` reader - RX Empty"]
21pub type RxemptyR = crate::BitReader<Rxempty>;
22impl RxemptyR {
23    #[doc = "Get enumerated values variant"]
24    #[inline(always)]
25    pub const fn variant(&self) -> Rxempty {
26        match self.bits {
27            false => Rxempty::NotEmpty,
28            true => Rxempty::Empty,
29        }
30    }
31    #[doc = "Not empty"]
32    #[inline(always)]
33    pub fn is_not_empty(&self) -> bool {
34        *self == Rxempty::NotEmpty
35    }
36    #[doc = "Empty"]
37    #[inline(always)]
38    pub fn is_empty(&self) -> bool {
39        *self == Rxempty::Empty
40    }
41}
42impl R {
43    #[doc = "Bits 0:7 - Receive Data"]
44    #[inline(always)]
45    pub fn data(&self) -> DataR {
46        DataR::new((self.bits & 0xff) as u8)
47    }
48    #[doc = "Bit 14 - RX Empty"]
49    #[inline(always)]
50    pub fn rxempty(&self) -> RxemptyR {
51        RxemptyR::new(((self.bits >> 14) & 1) != 0)
52    }
53}
54#[cfg(feature = "debug")]
55impl core::fmt::Debug for R {
56    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
57        f.debug_struct("MRDROR")
58            .field("data", &self.data())
59            .field("rxempty", &self.rxempty())
60            .finish()
61    }
62}
63#[doc = "Controller Receive Data Read Only\n\nYou can [`read`](crate::Reg::read) this register and get [`mrdror::R`](R). See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
64pub struct MrdrorSpec;
65impl crate::RegisterSpec for MrdrorSpec {
66    type Ux = u32;
67}
68#[doc = "`read()` method returns [`mrdror::R`](R) reader structure"]
69impl crate::Readable for MrdrorSpec {}
70#[doc = "`reset()` method sets MRDROR to value 0x4000"]
71impl crate::Resettable for MrdrorSpec {
72    const RESET_VALUE: u32 = 0x4000;
73}