ra2e2/i3c/
sdatbas0.rs

1#[doc = "Register `SDATBAS0` reader"]
2pub struct R(crate::R<SDATBAS0_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<SDATBAS0_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<SDATBAS0_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<SDATBAS0_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `SDATBAS0` writer"]
17pub struct W(crate::W<SDATBAS0_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<SDATBAS0_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<SDATBAS0_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<SDATBAS0_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `SDSTAD` reader - Slave Device Static Address"]
38pub type SDSTAD_R = crate::FieldReader<u16, u16>;
39#[doc = "Field `SDSTAD` writer - Slave Device Static Address"]
40pub type SDSTAD_W<'a, const O: u8> = crate::FieldWriter<'a, u32, SDATBAS0_SPEC, u16, u16, 10, O>;
41#[doc = "Field `SDADLS` reader - Slave Device Address Length Selection"]
42pub type SDADLS_R = crate::BitReader<SDADLS_A>;
43#[doc = "Slave Device Address Length Selection\n\nValue on reset: 0"]
44#[derive(Clone, Copy, Debug, PartialEq, Eq)]
45pub enum SDADLS_A {
46    #[doc = "0: Slave device address length 7 bits selected."]
47    _0 = 0,
48    #[doc = "1: Slave device address length 10 bits selected. (I2C device only)"]
49    _1 = 1,
50}
51impl From<SDADLS_A> for bool {
52    #[inline(always)]
53    fn from(variant: SDADLS_A) -> Self {
54        variant as u8 != 0
55    }
56}
57impl SDADLS_R {
58    #[doc = "Get enumerated values variant"]
59    #[inline(always)]
60    pub fn variant(&self) -> SDADLS_A {
61        match self.bits {
62            false => SDADLS_A::_0,
63            true => SDADLS_A::_1,
64        }
65    }
66    #[doc = "Checks if the value of the field is `_0`"]
67    #[inline(always)]
68    pub fn is_0(&self) -> bool {
69        *self == SDADLS_A::_0
70    }
71    #[doc = "Checks if the value of the field is `_1`"]
72    #[inline(always)]
73    pub fn is_1(&self) -> bool {
74        *self == SDADLS_A::_1
75    }
76}
77#[doc = "Field `SDADLS` writer - Slave Device Address Length Selection"]
78pub type SDADLS_W<'a, const O: u8> = crate::BitWriter<'a, u32, SDATBAS0_SPEC, SDADLS_A, O>;
79impl<'a, const O: u8> SDADLS_W<'a, O> {
80    #[doc = "Slave device address length 7 bits selected."]
81    #[inline(always)]
82    pub fn _0(self) -> &'a mut W {
83        self.variant(SDADLS_A::_0)
84    }
85    #[doc = "Slave device address length 10 bits selected. (I2C device only)"]
86    #[inline(always)]
87    pub fn _1(self) -> &'a mut W {
88        self.variant(SDADLS_A::_1)
89    }
90}
91#[doc = "Field `SDIBIPL` reader - Slave Device IBI Payload"]
92pub type SDIBIPL_R = crate::BitReader<SDIBIPL_A>;
93#[doc = "Slave Device IBI Payload\n\nValue on reset: 0"]
94#[derive(Clone, Copy, Debug, PartialEq, Eq)]
95pub enum SDIBIPL_A {
96    #[doc = "0: IBIs from this device do not carry a data payload."]
97    _0 = 0,
98    #[doc = "1: IBIs from this device carry a data payload."]
99    _1 = 1,
100}
101impl From<SDIBIPL_A> for bool {
102    #[inline(always)]
103    fn from(variant: SDIBIPL_A) -> Self {
104        variant as u8 != 0
105    }
106}
107impl SDIBIPL_R {
108    #[doc = "Get enumerated values variant"]
109    #[inline(always)]
110    pub fn variant(&self) -> SDIBIPL_A {
111        match self.bits {
112            false => SDIBIPL_A::_0,
113            true => SDIBIPL_A::_1,
114        }
115    }
116    #[doc = "Checks if the value of the field is `_0`"]
117    #[inline(always)]
118    pub fn is_0(&self) -> bool {
119        *self == SDIBIPL_A::_0
120    }
121    #[doc = "Checks if the value of the field is `_1`"]
122    #[inline(always)]
123    pub fn is_1(&self) -> bool {
124        *self == SDIBIPL_A::_1
125    }
126}
127#[doc = "Field `SDIBIPL` writer - Slave Device IBI Payload"]
128pub type SDIBIPL_W<'a, const O: u8> = crate::BitWriter<'a, u32, SDATBAS0_SPEC, SDIBIPL_A, O>;
129impl<'a, const O: u8> SDIBIPL_W<'a, O> {
130    #[doc = "IBIs from this device do not carry a data payload."]
131    #[inline(always)]
132    pub fn _0(self) -> &'a mut W {
133        self.variant(SDIBIPL_A::_0)
134    }
135    #[doc = "IBIs from this device carry a data payload."]
136    #[inline(always)]
137    pub fn _1(self) -> &'a mut W {
138        self.variant(SDIBIPL_A::_1)
139    }
140}
141#[doc = "Field `SDDYAD` reader - Slave Device I3C Dynamic Address"]
142pub type SDDYAD_R = crate::FieldReader<u8, u8>;
143#[doc = "Field `SDDYAD` writer - Slave Device I3C Dynamic Address"]
144pub type SDDYAD_W<'a, const O: u8> = crate::FieldWriter<'a, u32, SDATBAS0_SPEC, u8, u8, 7, O>;
145impl R {
146    #[doc = "Bits 0:9 - Slave Device Static Address"]
147    #[inline(always)]
148    pub fn sdstad(&self) -> SDSTAD_R {
149        SDSTAD_R::new((self.bits & 0x03ff) as u16)
150    }
151    #[doc = "Bit 10 - Slave Device Address Length Selection"]
152    #[inline(always)]
153    pub fn sdadls(&self) -> SDADLS_R {
154        SDADLS_R::new(((self.bits >> 10) & 1) != 0)
155    }
156    #[doc = "Bit 12 - Slave Device IBI Payload"]
157    #[inline(always)]
158    pub fn sdibipl(&self) -> SDIBIPL_R {
159        SDIBIPL_R::new(((self.bits >> 12) & 1) != 0)
160    }
161    #[doc = "Bits 16:22 - Slave Device I3C Dynamic Address"]
162    #[inline(always)]
163    pub fn sddyad(&self) -> SDDYAD_R {
164        SDDYAD_R::new(((self.bits >> 16) & 0x7f) as u8)
165    }
166}
167impl W {
168    #[doc = "Bits 0:9 - Slave Device Static Address"]
169    #[inline(always)]
170    #[must_use]
171    pub fn sdstad(&mut self) -> SDSTAD_W<0> {
172        SDSTAD_W::new(self)
173    }
174    #[doc = "Bit 10 - Slave Device Address Length Selection"]
175    #[inline(always)]
176    #[must_use]
177    pub fn sdadls(&mut self) -> SDADLS_W<10> {
178        SDADLS_W::new(self)
179    }
180    #[doc = "Bit 12 - Slave Device IBI Payload"]
181    #[inline(always)]
182    #[must_use]
183    pub fn sdibipl(&mut self) -> SDIBIPL_W<12> {
184        SDIBIPL_W::new(self)
185    }
186    #[doc = "Bits 16:22 - Slave Device I3C Dynamic Address"]
187    #[inline(always)]
188    #[must_use]
189    pub fn sddyad(&mut self) -> SDDYAD_W<16> {
190        SDDYAD_W::new(self)
191    }
192    #[doc = "Writes raw bits to the register."]
193    #[inline(always)]
194    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
195        self.0.bits(bits);
196        self
197    }
198}
199#[doc = "Slave Device Address Table Basic Register 0\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 [sdatbas0](index.html) module"]
200pub struct SDATBAS0_SPEC;
201impl crate::RegisterSpec for SDATBAS0_SPEC {
202    type Ux = u32;
203}
204#[doc = "`read()` method returns [sdatbas0::R](R) reader structure"]
205impl crate::Readable for SDATBAS0_SPEC {
206    type Reader = R;
207}
208#[doc = "`write(|w| ..)` method takes [sdatbas0::W](W) writer structure"]
209impl crate::Writable for SDATBAS0_SPEC {
210    type Writer = W;
211    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
212    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
213}
214#[doc = "`reset()` method sets SDATBAS0 to value 0"]
215impl crate::Resettable for SDATBAS0_SPEC {
216    const RESET_VALUE: Self::Ux = 0;
217}