bl702_pac/gpip/
gpdac_config.rs

1#[doc = "Register `gpdac_config` reader"]
2pub struct R(crate::R<GPDAC_CONFIG_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<GPDAC_CONFIG_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<GPDAC_CONFIG_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<GPDAC_CONFIG_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `gpdac_config` writer"]
17pub struct W(crate::W<GPDAC_CONFIG_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<GPDAC_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<GPDAC_CONFIG_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<GPDAC_CONFIG_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `gpdac_en` reader - "]
38pub type GPDAC_EN_R = crate::BitReader<bool>;
39#[doc = "Field `gpdac_en` writer - "]
40pub type GPDAC_EN_W<'a, const O: u8> = crate::BitWriter<'a, u32, GPDAC_CONFIG_SPEC, bool, O>;
41#[doc = "Field `gpdac_en2` reader - "]
42pub type GPDAC_EN2_R = crate::BitReader<bool>;
43#[doc = "Field `gpdac_en2` writer - "]
44pub type GPDAC_EN2_W<'a, const O: u8> = crate::BitWriter<'a, u32, GPDAC_CONFIG_SPEC, bool, O>;
45#[doc = "Field `dsm_mode` reader - "]
46pub type DSM_MODE_R = crate::FieldReader<u8, u8>;
47#[doc = "Field `dsm_mode` writer - "]
48pub type DSM_MODE_W<'a, const O: u8> = crate::FieldWriter<'a, u32, GPDAC_CONFIG_SPEC, u8, u8, 2, O>;
49#[doc = "Field `gpdac_mode` reader - "]
50pub type GPDAC_MODE_R = crate::FieldReader<u8, u8>;
51#[doc = "Field `gpdac_mode` writer - "]
52pub type GPDAC_MODE_W<'a, const O: u8> =
53    crate::FieldWriter<'a, u32, GPDAC_CONFIG_SPEC, u8, u8, 3, O>;
54#[doc = "Field `gpdac_ch_a_sel` reader - "]
55pub type GPDAC_CH_A_SEL_R = crate::FieldReader<u8, u8>;
56#[doc = "Field `gpdac_ch_a_sel` writer - "]
57pub type GPDAC_CH_A_SEL_W<'a, const O: u8> =
58    crate::FieldWriter<'a, u32, GPDAC_CONFIG_SPEC, u8, u8, 4, O>;
59#[doc = "Field `gpdac_ch_b_sel` reader - "]
60pub type GPDAC_CH_B_SEL_R = crate::FieldReader<u8, u8>;
61#[doc = "Field `gpdac_ch_b_sel` writer - "]
62pub type GPDAC_CH_B_SEL_W<'a, const O: u8> =
63    crate::FieldWriter<'a, u32, GPDAC_CONFIG_SPEC, u8, u8, 4, O>;
64#[doc = "Field `rsvd_31_24` reader - "]
65pub type RSVD_31_24_R = crate::FieldReader<u8, u8>;
66#[doc = "Field `rsvd_31_24` writer - "]
67pub type RSVD_31_24_W<'a, const O: u8> =
68    crate::FieldWriter<'a, u32, GPDAC_CONFIG_SPEC, u8, u8, 8, O>;
69impl R {
70    #[doc = "Bit 0"]
71    #[inline(always)]
72    pub fn gpdac_en(&self) -> GPDAC_EN_R {
73        GPDAC_EN_R::new((self.bits & 1) != 0)
74    }
75    #[doc = "Bit 1"]
76    #[inline(always)]
77    pub fn gpdac_en2(&self) -> GPDAC_EN2_R {
78        GPDAC_EN2_R::new(((self.bits >> 1) & 1) != 0)
79    }
80    #[doc = "Bits 4:5"]
81    #[inline(always)]
82    pub fn dsm_mode(&self) -> DSM_MODE_R {
83        DSM_MODE_R::new(((self.bits >> 4) & 3) as u8)
84    }
85    #[doc = "Bits 8:10"]
86    #[inline(always)]
87    pub fn gpdac_mode(&self) -> GPDAC_MODE_R {
88        GPDAC_MODE_R::new(((self.bits >> 8) & 7) as u8)
89    }
90    #[doc = "Bits 16:19"]
91    #[inline(always)]
92    pub fn gpdac_ch_a_sel(&self) -> GPDAC_CH_A_SEL_R {
93        GPDAC_CH_A_SEL_R::new(((self.bits >> 16) & 0x0f) as u8)
94    }
95    #[doc = "Bits 20:23"]
96    #[inline(always)]
97    pub fn gpdac_ch_b_sel(&self) -> GPDAC_CH_B_SEL_R {
98        GPDAC_CH_B_SEL_R::new(((self.bits >> 20) & 0x0f) as u8)
99    }
100    #[doc = "Bits 24:31"]
101    #[inline(always)]
102    pub fn rsvd_31_24(&self) -> RSVD_31_24_R {
103        RSVD_31_24_R::new(((self.bits >> 24) & 0xff) as u8)
104    }
105}
106impl W {
107    #[doc = "Bit 0"]
108    #[inline(always)]
109    #[must_use]
110    pub fn gpdac_en(&mut self) -> GPDAC_EN_W<0> {
111        GPDAC_EN_W::new(self)
112    }
113    #[doc = "Bit 1"]
114    #[inline(always)]
115    #[must_use]
116    pub fn gpdac_en2(&mut self) -> GPDAC_EN2_W<1> {
117        GPDAC_EN2_W::new(self)
118    }
119    #[doc = "Bits 4:5"]
120    #[inline(always)]
121    #[must_use]
122    pub fn dsm_mode(&mut self) -> DSM_MODE_W<4> {
123        DSM_MODE_W::new(self)
124    }
125    #[doc = "Bits 8:10"]
126    #[inline(always)]
127    #[must_use]
128    pub fn gpdac_mode(&mut self) -> GPDAC_MODE_W<8> {
129        GPDAC_MODE_W::new(self)
130    }
131    #[doc = "Bits 16:19"]
132    #[inline(always)]
133    #[must_use]
134    pub fn gpdac_ch_a_sel(&mut self) -> GPDAC_CH_A_SEL_W<16> {
135        GPDAC_CH_A_SEL_W::new(self)
136    }
137    #[doc = "Bits 20:23"]
138    #[inline(always)]
139    #[must_use]
140    pub fn gpdac_ch_b_sel(&mut self) -> GPDAC_CH_B_SEL_W<20> {
141        GPDAC_CH_B_SEL_W::new(self)
142    }
143    #[doc = "Bits 24:31"]
144    #[inline(always)]
145    #[must_use]
146    pub fn rsvd_31_24(&mut self) -> RSVD_31_24_W<24> {
147        RSVD_31_24_W::new(self)
148    }
149    #[doc = "Writes raw bits to the register."]
150    #[inline(always)]
151    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
152        self.0.bits(bits);
153        self
154    }
155}
156#[doc = "gpdac_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 [gpdac_config](index.html) module"]
157pub struct GPDAC_CONFIG_SPEC;
158impl crate::RegisterSpec for GPDAC_CONFIG_SPEC {
159    type Ux = u32;
160}
161#[doc = "`read()` method returns [gpdac_config::R](R) reader structure"]
162impl crate::Readable for GPDAC_CONFIG_SPEC {
163    type Reader = R;
164}
165#[doc = "`write(|w| ..)` method takes [gpdac_config::W](W) writer structure"]
166impl crate::Writable for GPDAC_CONFIG_SPEC {
167    type Writer = W;
168    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
169    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
170}
171#[doc = "`reset()` method sets gpdac_config to value 0"]
172impl crate::Resettable for GPDAC_CONFIG_SPEC {
173    const RESET_VALUE: Self::Ux = 0;
174}