mimxrt595s/i3c0/
sdynaddr.rs

1#[doc = "Register `SDYNADDR` reader"]
2pub struct R(crate::R<SDYNADDR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<SDYNADDR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<SDYNADDR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<SDYNADDR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `SDYNADDR` writer"]
17pub struct W(crate::W<SDYNADDR_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<SDYNADDR_SPEC>;
20    #[inline(always)]
21    fn deref(&self) -> &Self::Target {
22        &self.0
23    }
24}
25impl core::ops::DerefMut for W {
26    #[inline(always)]
27    fn deref_mut(&mut self) -> &mut Self::Target {
28        &mut self.0
29    }
30}
31impl From<crate::W<SDYNADDR_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<SDYNADDR_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `DAVALID` reader - DAVALID"]
38pub type DAVALID_R = crate::BitReader<DAVALID_A>;
39#[doc = "DAVALID\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41pub enum DAVALID_A {
42    #[doc = "0: DANOTASSIGNED"]
43    DANOTASSIGNED = 0,
44    #[doc = "1: DAASSIGNED"]
45    DAASSIGNED = 1,
46}
47impl From<DAVALID_A> for bool {
48    #[inline(always)]
49    fn from(variant: DAVALID_A) -> Self {
50        variant as u8 != 0
51    }
52}
53impl DAVALID_R {
54    #[doc = "Get enumerated values variant"]
55    #[inline(always)]
56    pub fn variant(&self) -> DAVALID_A {
57        match self.bits {
58            false => DAVALID_A::DANOTASSIGNED,
59            true => DAVALID_A::DAASSIGNED,
60        }
61    }
62    #[doc = "Checks if the value of the field is `DANOTASSIGNED`"]
63    #[inline(always)]
64    pub fn is_danotassigned(&self) -> bool {
65        *self == DAVALID_A::DANOTASSIGNED
66    }
67    #[doc = "Checks if the value of the field is `DAASSIGNED`"]
68    #[inline(always)]
69    pub fn is_daassigned(&self) -> bool {
70        *self == DAVALID_A::DAASSIGNED
71    }
72}
73#[doc = "Field `DAVALID` writer - DAVALID"]
74pub type DAVALID_W<'a, const O: u8> = crate::BitWriter<'a, u32, SDYNADDR_SPEC, DAVALID_A, O>;
75impl<'a, const O: u8> DAVALID_W<'a, O> {
76    #[doc = "DANOTASSIGNED"]
77    #[inline(always)]
78    pub fn danotassigned(self) -> &'a mut W {
79        self.variant(DAVALID_A::DANOTASSIGNED)
80    }
81    #[doc = "DAASSIGNED"]
82    #[inline(always)]
83    pub fn daassigned(self) -> &'a mut W {
84        self.variant(DAVALID_A::DAASSIGNED)
85    }
86}
87#[doc = "Field `DADDR` reader - Dynamic address"]
88pub type DADDR_R = crate::FieldReader<u8, u8>;
89#[doc = "Field `DADDR` writer - Dynamic address"]
90pub type DADDR_W<'a, const O: u8> = crate::FieldWriter<'a, u32, SDYNADDR_SPEC, u8, u8, 7, O>;
91#[doc = "Field `MAPIDX` writer - Mapped Dynamic Address"]
92pub type MAPIDX_W<'a, const O: u8> = crate::FieldWriter<'a, u32, SDYNADDR_SPEC, u8, u8, 4, O>;
93#[doc = "Field `MAPSA` writer - Map a Static Address"]
94pub type MAPSA_W<'a, const O: u8> = crate::BitWriter<'a, u32, SDYNADDR_SPEC, bool, O>;
95#[doc = "Field `KEY` reader - Key"]
96pub type KEY_R = crate::FieldReader<u16, u16>;
97#[doc = "Field `KEY` writer - Key"]
98pub type KEY_W<'a, const O: u8> = crate::FieldWriter<'a, u32, SDYNADDR_SPEC, u16, u16, 16, O>;
99impl R {
100    #[doc = "Bit 0 - DAVALID"]
101    #[inline(always)]
102    pub fn davalid(&self) -> DAVALID_R {
103        DAVALID_R::new((self.bits & 1) != 0)
104    }
105    #[doc = "Bits 1:7 - Dynamic address"]
106    #[inline(always)]
107    pub fn daddr(&self) -> DADDR_R {
108        DADDR_R::new(((self.bits >> 1) & 0x7f) as u8)
109    }
110    #[doc = "Bits 16:31 - Key"]
111    #[inline(always)]
112    pub fn key(&self) -> KEY_R {
113        KEY_R::new(((self.bits >> 16) & 0xffff) as u16)
114    }
115}
116impl W {
117    #[doc = "Bit 0 - DAVALID"]
118    #[inline(always)]
119    #[must_use]
120    pub fn davalid(&mut self) -> DAVALID_W<0> {
121        DAVALID_W::new(self)
122    }
123    #[doc = "Bits 1:7 - Dynamic address"]
124    #[inline(always)]
125    #[must_use]
126    pub fn daddr(&mut self) -> DADDR_W<1> {
127        DADDR_W::new(self)
128    }
129    #[doc = "Bits 8:11 - Mapped Dynamic Address"]
130    #[inline(always)]
131    #[must_use]
132    pub fn mapidx(&mut self) -> MAPIDX_W<8> {
133        MAPIDX_W::new(self)
134    }
135    #[doc = "Bit 12 - Map a Static Address"]
136    #[inline(always)]
137    #[must_use]
138    pub fn mapsa(&mut self) -> MAPSA_W<12> {
139        MAPSA_W::new(self)
140    }
141    #[doc = "Bits 16:31 - Key"]
142    #[inline(always)]
143    #[must_use]
144    pub fn key(&mut self) -> KEY_W<16> {
145        KEY_W::new(self)
146    }
147    #[doc = "Writes raw bits to the register."]
148    #[inline(always)]
149    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
150        self.0.bits(bits);
151        self
152    }
153}
154#[doc = "Slave Dynamic Address Register\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [sdynaddr](index.html) module"]
155pub struct SDYNADDR_SPEC;
156impl crate::RegisterSpec for SDYNADDR_SPEC {
157    type Ux = u32;
158}
159#[doc = "`read()` method returns [sdynaddr::R](R) reader structure"]
160impl crate::Readable for SDYNADDR_SPEC {
161    type Reader = R;
162}
163#[doc = "`write(|w| ..)` method takes [sdynaddr::W](W) writer structure"]
164impl crate::Writable for SDYNADDR_SPEC {
165    type Writer = W;
166    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
167    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
168}
169#[doc = "`reset()` method sets SDYNADDR to value 0"]
170impl crate::Resettable for SDYNADDR_SPEC {
171    const RESET_VALUE: Self::Ux = 0;
172}