mcxa_pac/i3c0/
smsgmapaddr.rs

1#[doc = "Register `SMSGMAPADDR` reader"]
2pub type R = crate::R<SmsgmapaddrSpec>;
3#[doc = "Field `MAPLAST` reader - Matched Address Index"]
4pub type MaplastR = crate::FieldReader;
5#[doc = "Last Static Address Matched\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8pub enum Laststatic {
9    #[doc = "0: I3C dynamic address"]
10    I3c = 0,
11    #[doc = "1: I2C static address"]
12    I2c = 1,
13}
14impl From<Laststatic> for bool {
15    #[inline(always)]
16    fn from(variant: Laststatic) -> Self {
17        variant as u8 != 0
18    }
19}
20#[doc = "Field `LASTSTATIC` reader - Last Static Address Matched"]
21pub type LaststaticR = crate::BitReader<Laststatic>;
22impl LaststaticR {
23    #[doc = "Get enumerated values variant"]
24    #[inline(always)]
25    pub const fn variant(&self) -> Laststatic {
26        match self.bits {
27            false => Laststatic::I3c,
28            true => Laststatic::I2c,
29        }
30    }
31    #[doc = "I3C dynamic address"]
32    #[inline(always)]
33    pub fn is_i3c(&self) -> bool {
34        *self == Laststatic::I3c
35    }
36    #[doc = "I2C static address"]
37    #[inline(always)]
38    pub fn is_i2c(&self) -> bool {
39        *self == Laststatic::I2c
40    }
41}
42#[doc = "Field `MAPLASTM1` reader - Matched Previous Address Index 1"]
43pub type Maplastm1R = crate::FieldReader;
44#[doc = "Field `MAPLASTM2` reader - Matched Previous Index 2"]
45pub type Maplastm2R = crate::FieldReader;
46impl R {
47    #[doc = "Bits 0:3 - Matched Address Index"]
48    #[inline(always)]
49    pub fn maplast(&self) -> MaplastR {
50        MaplastR::new((self.bits & 0x0f) as u8)
51    }
52    #[doc = "Bit 4 - Last Static Address Matched"]
53    #[inline(always)]
54    pub fn laststatic(&self) -> LaststaticR {
55        LaststaticR::new(((self.bits >> 4) & 1) != 0)
56    }
57    #[doc = "Bits 8:11 - Matched Previous Address Index 1"]
58    #[inline(always)]
59    pub fn maplastm1(&self) -> Maplastm1R {
60        Maplastm1R::new(((self.bits >> 8) & 0x0f) as u8)
61    }
62    #[doc = "Bits 16:19 - Matched Previous Index 2"]
63    #[inline(always)]
64    pub fn maplastm2(&self) -> Maplastm2R {
65        Maplastm2R::new(((self.bits >> 16) & 0x0f) as u8)
66    }
67}
68#[cfg(feature = "debug")]
69impl core::fmt::Debug for R {
70    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
71        f.debug_struct("SMSGMAPADDR")
72            .field("maplast", &self.maplast())
73            .field("laststatic", &self.laststatic())
74            .field("maplastm1", &self.maplastm1())
75            .field("maplastm2", &self.maplastm2())
76            .finish()
77    }
78}
79#[doc = "Target Message Map Address\n\nYou can [`read`](crate::Reg::read) this register and get [`smsgmapaddr::R`](R). See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
80pub struct SmsgmapaddrSpec;
81impl crate::RegisterSpec for SmsgmapaddrSpec {
82    type Ux = u32;
83}
84#[doc = "`read()` method returns [`smsgmapaddr::R`](R) reader structure"]
85impl crate::Readable for SmsgmapaddrSpec {}
86#[doc = "`reset()` method sets SMSGMAPADDR to value 0"]
87impl crate::Resettable for SmsgmapaddrSpec {}