bl808_pac/i2c/
sub_address.rs

1#[doc = "Register `sub_address` reader"]
2pub struct R(crate::R<SUB_ADDRESS_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<SUB_ADDRESS_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<SUB_ADDRESS_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<SUB_ADDRESS_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `sub_address` writer"]
17pub struct W(crate::W<SUB_ADDRESS_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<SUB_ADDRESS_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<SUB_ADDRESS_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<SUB_ADDRESS_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `byte[0-3]` reader - I2C sub-address byte %s"]
38pub type BYTE_R = crate::FieldReader<u8, u8>;
39#[doc = "Field `byte[0-3]` writer - I2C sub-address byte %s"]
40pub type BYTE_W<'a, const O: u8> = crate::FieldWriter<'a, u32, SUB_ADDRESS_SPEC, u8, u8, 8, O>;
41impl R {
42    #[doc = "I2C sub-address byte [0-3]"]
43    #[inline(always)]
44    pub unsafe fn byte(&self, n: u8) -> BYTE_R {
45        BYTE_R::new(((self.bits >> (n * 8)) & 0xff) as u8)
46    }
47    #[doc = "Bits 0:7 - I2C sub-address byte 0"]
48    #[inline(always)]
49    pub fn byte0(&self) -> BYTE_R {
50        BYTE_R::new((self.bits & 0xff) as u8)
51    }
52    #[doc = "Bits 8:15 - I2C sub-address byte 1"]
53    #[inline(always)]
54    pub fn byte1(&self) -> BYTE_R {
55        BYTE_R::new(((self.bits >> 8) & 0xff) as u8)
56    }
57    #[doc = "Bits 16:23 - I2C sub-address byte 2"]
58    #[inline(always)]
59    pub fn byte2(&self) -> BYTE_R {
60        BYTE_R::new(((self.bits >> 16) & 0xff) as u8)
61    }
62    #[doc = "Bits 24:31 - I2C sub-address byte 3"]
63    #[inline(always)]
64    pub fn byte3(&self) -> BYTE_R {
65        BYTE_R::new(((self.bits >> 24) & 0xff) as u8)
66    }
67}
68impl W {
69    #[doc = "I2C sub-address byte [0-3]"]
70    #[inline(always)]
71    pub unsafe fn byte<const O: u8>(&mut self) -> BYTE_W<O> {
72        BYTE_W::new(self)
73    }
74    #[doc = "Bits 0:7 - I2C sub-address byte 0"]
75    #[inline(always)]
76    pub fn byte0(&mut self) -> BYTE_W<0> {
77        BYTE_W::new(self)
78    }
79    #[doc = "Bits 8:15 - I2C sub-address byte 1"]
80    #[inline(always)]
81    pub fn byte1(&mut self) -> BYTE_W<8> {
82        BYTE_W::new(self)
83    }
84    #[doc = "Bits 16:23 - I2C sub-address byte 2"]
85    #[inline(always)]
86    pub fn byte2(&mut self) -> BYTE_W<16> {
87        BYTE_W::new(self)
88    }
89    #[doc = "Bits 24:31 - I2C sub-address byte 3"]
90    #[inline(always)]
91    pub fn byte3(&mut self) -> BYTE_W<24> {
92        BYTE_W::new(self)
93    }
94    #[doc = "Writes raw bits to the register."]
95    #[inline(always)]
96    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
97        self.0.bits(bits);
98        self
99    }
100}
101#[doc = "Register address of slave device\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 [sub_address](index.html) module"]
102pub struct SUB_ADDRESS_SPEC;
103impl crate::RegisterSpec for SUB_ADDRESS_SPEC {
104    type Ux = u32;
105}
106#[doc = "`read()` method returns [sub_address::R](R) reader structure"]
107impl crate::Readable for SUB_ADDRESS_SPEC {
108    type Reader = R;
109}
110#[doc = "`write(|w| ..)` method takes [sub_address::W](W) writer structure"]
111impl crate::Writable for SUB_ADDRESS_SPEC {
112    type Writer = W;
113}
114#[doc = "`reset()` method sets sub_address to value 0"]
115impl crate::Resettable for SUB_ADDRESS_SPEC {
116    #[inline(always)]
117    fn reset_value() -> Self::Ux {
118        0
119    }
120}