bl702_pac/i2c/
i2c_config.rs1#[doc = "Register `i2c_config` reader"]
2pub struct R(crate::R<I2C_CONFIG_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<I2C_CONFIG_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<I2C_CONFIG_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<I2C_CONFIG_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `i2c_config` writer"]
17pub struct W(crate::W<I2C_CONFIG_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<I2C_CONFIG_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<I2C_CONFIG_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<I2C_CONFIG_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `cr_i2c_m_en` reader - "]
38pub type CR_I2C_M_EN_R = crate::BitReader<bool>;
39#[doc = "Field `cr_i2c_m_en` writer - "]
40pub type CR_I2C_M_EN_W<'a, const O: u8> = crate::BitWriter<'a, u32, I2C_CONFIG_SPEC, bool, O>;
41#[doc = "Field `cr_i2c_pkt_dir` reader - "]
42pub type CR_I2C_PKT_DIR_R = crate::BitReader<bool>;
43#[doc = "Field `cr_i2c_pkt_dir` writer - "]
44pub type CR_I2C_PKT_DIR_W<'a, const O: u8> = crate::BitWriter<'a, u32, I2C_CONFIG_SPEC, bool, O>;
45#[doc = "Field `cr_i2c_deg_en` reader - "]
46pub type CR_I2C_DEG_EN_R = crate::BitReader<bool>;
47#[doc = "Field `cr_i2c_deg_en` writer - "]
48pub type CR_I2C_DEG_EN_W<'a, const O: u8> = crate::BitWriter<'a, u32, I2C_CONFIG_SPEC, bool, O>;
49#[doc = "Field `cr_i2c_scl_sync_en` reader - "]
50pub type CR_I2C_SCL_SYNC_EN_R = crate::BitReader<bool>;
51#[doc = "Field `cr_i2c_scl_sync_en` writer - "]
52pub type CR_I2C_SCL_SYNC_EN_W<'a, const O: u8> =
53 crate::BitWriter<'a, u32, I2C_CONFIG_SPEC, bool, O>;
54#[doc = "Field `cr_i2c_sub_addr_en` reader - "]
55pub type CR_I2C_SUB_ADDR_EN_R = crate::BitReader<bool>;
56#[doc = "Field `cr_i2c_sub_addr_en` writer - "]
57pub type CR_I2C_SUB_ADDR_EN_W<'a, const O: u8> =
58 crate::BitWriter<'a, u32, I2C_CONFIG_SPEC, bool, O>;
59#[doc = "Field `cr_i2c_sub_addr_bc` reader - "]
60pub type CR_I2C_SUB_ADDR_BC_R = crate::FieldReader<u8, u8>;
61#[doc = "Field `cr_i2c_sub_addr_bc` writer - "]
62pub type CR_I2C_SUB_ADDR_BC_W<'a, const O: u8> =
63 crate::FieldWriter<'a, u32, I2C_CONFIG_SPEC, u8, u8, 2, O>;
64#[doc = "Field `cr_i2c_slv_addr` reader - "]
65pub type CR_I2C_SLV_ADDR_R = crate::FieldReader<u8, u8>;
66#[doc = "Field `cr_i2c_slv_addr` writer - "]
67pub type CR_I2C_SLV_ADDR_W<'a, const O: u8> =
68 crate::FieldWriter<'a, u32, I2C_CONFIG_SPEC, u8, u8, 7, O>;
69#[doc = "Field `cr_i2c_pkt_len` reader - "]
70pub type CR_I2C_PKT_LEN_R = crate::FieldReader<u8, u8>;
71#[doc = "Field `cr_i2c_pkt_len` writer - "]
72pub type CR_I2C_PKT_LEN_W<'a, const O: u8> =
73 crate::FieldWriter<'a, u32, I2C_CONFIG_SPEC, u8, u8, 8, O>;
74#[doc = "Field `cr_i2c_deg_cnt` reader - "]
75pub type CR_I2C_DEG_CNT_R = crate::FieldReader<u8, u8>;
76#[doc = "Field `cr_i2c_deg_cnt` writer - "]
77pub type CR_I2C_DEG_CNT_W<'a, const O: u8> =
78 crate::FieldWriter<'a, u32, I2C_CONFIG_SPEC, u8, u8, 4, O>;
79impl R {
80 #[doc = "Bit 0"]
81 #[inline(always)]
82 pub fn cr_i2c_m_en(&self) -> CR_I2C_M_EN_R {
83 CR_I2C_M_EN_R::new((self.bits & 1) != 0)
84 }
85 #[doc = "Bit 1"]
86 #[inline(always)]
87 pub fn cr_i2c_pkt_dir(&self) -> CR_I2C_PKT_DIR_R {
88 CR_I2C_PKT_DIR_R::new(((self.bits >> 1) & 1) != 0)
89 }
90 #[doc = "Bit 2"]
91 #[inline(always)]
92 pub fn cr_i2c_deg_en(&self) -> CR_I2C_DEG_EN_R {
93 CR_I2C_DEG_EN_R::new(((self.bits >> 2) & 1) != 0)
94 }
95 #[doc = "Bit 3"]
96 #[inline(always)]
97 pub fn cr_i2c_scl_sync_en(&self) -> CR_I2C_SCL_SYNC_EN_R {
98 CR_I2C_SCL_SYNC_EN_R::new(((self.bits >> 3) & 1) != 0)
99 }
100 #[doc = "Bit 4"]
101 #[inline(always)]
102 pub fn cr_i2c_sub_addr_en(&self) -> CR_I2C_SUB_ADDR_EN_R {
103 CR_I2C_SUB_ADDR_EN_R::new(((self.bits >> 4) & 1) != 0)
104 }
105 #[doc = "Bits 5:6"]
106 #[inline(always)]
107 pub fn cr_i2c_sub_addr_bc(&self) -> CR_I2C_SUB_ADDR_BC_R {
108 CR_I2C_SUB_ADDR_BC_R::new(((self.bits >> 5) & 3) as u8)
109 }
110 #[doc = "Bits 8:14"]
111 #[inline(always)]
112 pub fn cr_i2c_slv_addr(&self) -> CR_I2C_SLV_ADDR_R {
113 CR_I2C_SLV_ADDR_R::new(((self.bits >> 8) & 0x7f) as u8)
114 }
115 #[doc = "Bits 16:23"]
116 #[inline(always)]
117 pub fn cr_i2c_pkt_len(&self) -> CR_I2C_PKT_LEN_R {
118 CR_I2C_PKT_LEN_R::new(((self.bits >> 16) & 0xff) as u8)
119 }
120 #[doc = "Bits 28:31"]
121 #[inline(always)]
122 pub fn cr_i2c_deg_cnt(&self) -> CR_I2C_DEG_CNT_R {
123 CR_I2C_DEG_CNT_R::new(((self.bits >> 28) & 0x0f) as u8)
124 }
125}
126impl W {
127 #[doc = "Bit 0"]
128 #[inline(always)]
129 #[must_use]
130 pub fn cr_i2c_m_en(&mut self) -> CR_I2C_M_EN_W<0> {
131 CR_I2C_M_EN_W::new(self)
132 }
133 #[doc = "Bit 1"]
134 #[inline(always)]
135 #[must_use]
136 pub fn cr_i2c_pkt_dir(&mut self) -> CR_I2C_PKT_DIR_W<1> {
137 CR_I2C_PKT_DIR_W::new(self)
138 }
139 #[doc = "Bit 2"]
140 #[inline(always)]
141 #[must_use]
142 pub fn cr_i2c_deg_en(&mut self) -> CR_I2C_DEG_EN_W<2> {
143 CR_I2C_DEG_EN_W::new(self)
144 }
145 #[doc = "Bit 3"]
146 #[inline(always)]
147 #[must_use]
148 pub fn cr_i2c_scl_sync_en(&mut self) -> CR_I2C_SCL_SYNC_EN_W<3> {
149 CR_I2C_SCL_SYNC_EN_W::new(self)
150 }
151 #[doc = "Bit 4"]
152 #[inline(always)]
153 #[must_use]
154 pub fn cr_i2c_sub_addr_en(&mut self) -> CR_I2C_SUB_ADDR_EN_W<4> {
155 CR_I2C_SUB_ADDR_EN_W::new(self)
156 }
157 #[doc = "Bits 5:6"]
158 #[inline(always)]
159 #[must_use]
160 pub fn cr_i2c_sub_addr_bc(&mut self) -> CR_I2C_SUB_ADDR_BC_W<5> {
161 CR_I2C_SUB_ADDR_BC_W::new(self)
162 }
163 #[doc = "Bits 8:14"]
164 #[inline(always)]
165 #[must_use]
166 pub fn cr_i2c_slv_addr(&mut self) -> CR_I2C_SLV_ADDR_W<8> {
167 CR_I2C_SLV_ADDR_W::new(self)
168 }
169 #[doc = "Bits 16:23"]
170 #[inline(always)]
171 #[must_use]
172 pub fn cr_i2c_pkt_len(&mut self) -> CR_I2C_PKT_LEN_W<16> {
173 CR_I2C_PKT_LEN_W::new(self)
174 }
175 #[doc = "Bits 28:31"]
176 #[inline(always)]
177 #[must_use]
178 pub fn cr_i2c_deg_cnt(&mut self) -> CR_I2C_DEG_CNT_W<28> {
179 CR_I2C_DEG_CNT_W::new(self)
180 }
181 #[doc = "Writes raw bits to the register."]
182 #[inline(always)]
183 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
184 self.0.bits(bits);
185 self
186 }
187}
188#[doc = "i2c_config.\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 [i2c_config](index.html) module"]
189pub struct I2C_CONFIG_SPEC;
190impl crate::RegisterSpec for I2C_CONFIG_SPEC {
191 type Ux = u32;
192}
193#[doc = "`read()` method returns [i2c_config::R](R) reader structure"]
194impl crate::Readable for I2C_CONFIG_SPEC {
195 type Reader = R;
196}
197#[doc = "`write(|w| ..)` method takes [i2c_config::W](W) writer structure"]
198impl crate::Writable for I2C_CONFIG_SPEC {
199 type Writer = W;
200 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
201 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
202}
203#[doc = "`reset()` method sets i2c_config to value 0"]
204impl crate::Resettable for I2C_CONFIG_SPEC {
205 const RESET_VALUE: Self::Ux = 0;
206}