rp2040_pac/i2c0/
ic_sar.rs1#[doc = "Register `IC_SAR` reader"]
2pub type R = crate::R<IC_SAR_SPEC>;
3#[doc = "Register `IC_SAR` writer"]
4pub type W = crate::W<IC_SAR_SPEC>;
5#[doc = "Field `IC_SAR` reader - The IC_SAR holds the slave address when the I2C is operating as a slave. For 7-bit addressing, only IC_SAR\\[6:0\\]
6is used.
7
8 This register can be written only when the I2C interface is disabled, which corresponds to the IC_ENABLE\\[0\\]
9register being set to 0. Writes at other times have no effect.
10
11 Note: The default values cannot be any of the reserved address locations: that is, 0x00 to 0x07, or 0x78 to 0x7f. The correct operation of the device is not guaranteed if you program the IC_SAR or IC_TAR to a reserved value. Refer to <<table_I2C_firstbyte_bit_defs>> for a complete list of these reserved values."]
12pub type IC_SAR_R = crate::FieldReader<u16>;
13#[doc = "Field `IC_SAR` writer - The IC_SAR holds the slave address when the I2C is operating as a slave. For 7-bit addressing, only IC_SAR\\[6:0\\]
14is used.
15
16 This register can be written only when the I2C interface is disabled, which corresponds to the IC_ENABLE\\[0\\]
17register being set to 0. Writes at other times have no effect.
18
19 Note: The default values cannot be any of the reserved address locations: that is, 0x00 to 0x07, or 0x78 to 0x7f. The correct operation of the device is not guaranteed if you program the IC_SAR or IC_TAR to a reserved value. Refer to <<table_I2C_firstbyte_bit_defs>> for a complete list of these reserved values."]
20pub type IC_SAR_W<'a, REG> = crate::FieldWriter<'a, REG, 10, u16>;
21impl R {
22 #[doc = "Bits 0:9 - The IC_SAR holds the slave address when the I2C is operating as a slave. For 7-bit addressing, only IC_SAR\\[6:0\\]
23is used.
24
25 This register can be written only when the I2C interface is disabled, which corresponds to the IC_ENABLE\\[0\\]
26register being set to 0. Writes at other times have no effect.
27
28 Note: The default values cannot be any of the reserved address locations: that is, 0x00 to 0x07, or 0x78 to 0x7f. The correct operation of the device is not guaranteed if you program the IC_SAR or IC_TAR to a reserved value. Refer to <<table_I2C_firstbyte_bit_defs>> for a complete list of these reserved values."]
29 #[inline(always)]
30 pub fn ic_sar(&self) -> IC_SAR_R {
31 IC_SAR_R::new((self.bits & 0x03ff) as u16)
32 }
33}
34impl W {
35 #[doc = "Bits 0:9 - The IC_SAR holds the slave address when the I2C is operating as a slave. For 7-bit addressing, only IC_SAR\\[6:0\\]
36is used.
37
38 This register can be written only when the I2C interface is disabled, which corresponds to the IC_ENABLE\\[0\\]
39register being set to 0. Writes at other times have no effect.
40
41 Note: The default values cannot be any of the reserved address locations: that is, 0x00 to 0x07, or 0x78 to 0x7f. The correct operation of the device is not guaranteed if you program the IC_SAR or IC_TAR to a reserved value. Refer to <<table_I2C_firstbyte_bit_defs>> for a complete list of these reserved values."]
42 #[inline(always)]
43 #[must_use]
44 pub fn ic_sar(&mut self) -> IC_SAR_W<IC_SAR_SPEC> {
45 IC_SAR_W::new(self, 0)
46 }
47 #[doc = r" Writes raw bits to the register."]
48 #[doc = r""]
49 #[doc = r" # Safety"]
50 #[doc = r""]
51 #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
52 #[inline(always)]
53 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
54 self.bits = bits;
55 self
56 }
57}
58#[doc = "I2C Slave Address Register
59
60You can [`read`](crate::generic::Reg::read) this register and get [`ic_sar::R`](R). You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`ic_sar::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
61pub struct IC_SAR_SPEC;
62impl crate::RegisterSpec for IC_SAR_SPEC {
63 type Ux = u32;
64}
65#[doc = "`read()` method returns [`ic_sar::R`](R) reader structure"]
66impl crate::Readable for IC_SAR_SPEC {}
67#[doc = "`write(|w| ..)` method takes [`ic_sar::W`](W) writer structure"]
68impl crate::Writable for IC_SAR_SPEC {
69 const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
70 const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
71}
72#[doc = "`reset()` method sets IC_SAR to value 0x55"]
73impl crate::Resettable for IC_SAR_SPEC {
74 const RESET_VALUE: u32 = 0x55;
75}