bl61x_pac/glb/
gpdac_config_2.rs

1#[doc = "Register `gpdac_config_2` reader"]
2pub type R = crate::R<GPDAC_CONFIG_2_SPEC>;
3#[doc = "Register `gpdac_config_2` writer"]
4pub type W = crate::W<GPDAC_CONFIG_2_SPEC>;
5#[doc = "Field `gpdac_b_en` reader - "]
6pub type GPDAC_B_EN_R = crate::BitReader;
7#[doc = "Field `gpdac_b_en` writer - "]
8pub type GPDAC_B_EN_W<'a, REG> = crate::BitWriter<'a, REG>;
9#[doc = "Field `gpdac_iob_en` reader - "]
10pub type GPDAC_IOB_EN_R = crate::BitReader;
11#[doc = "Field `gpdac_iob_en` writer - "]
12pub type GPDAC_IOB_EN_W<'a, REG> = crate::BitWriter<'a, REG>;
13#[doc = "Field `gpdac_b_rng` reader - "]
14pub type GPDAC_B_RNG_R = crate::FieldReader;
15#[doc = "Field `gpdac_b_rng` writer - "]
16pub type GPDAC_B_RNG_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
17#[doc = "Field `gpdac_b_outmux` reader - "]
18pub type GPDAC_B_OUTMUX_R = crate::FieldReader;
19#[doc = "Field `gpdac_b_outmux` writer - "]
20pub type GPDAC_B_OUTMUX_W<'a, REG> = crate::FieldWriter<'a, REG, 3>;
21impl R {
22    #[doc = "Bit 0"]
23    #[inline(always)]
24    pub fn gpdac_b_en(&self) -> GPDAC_B_EN_R {
25        GPDAC_B_EN_R::new((self.bits & 1) != 0)
26    }
27    #[doc = "Bit 1"]
28    #[inline(always)]
29    pub fn gpdac_iob_en(&self) -> GPDAC_IOB_EN_R {
30        GPDAC_IOB_EN_R::new(((self.bits >> 1) & 1) != 0)
31    }
32    #[doc = "Bits 18:19"]
33    #[inline(always)]
34    pub fn gpdac_b_rng(&self) -> GPDAC_B_RNG_R {
35        GPDAC_B_RNG_R::new(((self.bits >> 18) & 3) as u8)
36    }
37    #[doc = "Bits 20:22"]
38    #[inline(always)]
39    pub fn gpdac_b_outmux(&self) -> GPDAC_B_OUTMUX_R {
40        GPDAC_B_OUTMUX_R::new(((self.bits >> 20) & 7) as u8)
41    }
42}
43impl W {
44    #[doc = "Bit 0"]
45    #[inline(always)]
46    #[must_use]
47    pub fn gpdac_b_en(&mut self) -> GPDAC_B_EN_W<GPDAC_CONFIG_2_SPEC> {
48        GPDAC_B_EN_W::new(self, 0)
49    }
50    #[doc = "Bit 1"]
51    #[inline(always)]
52    #[must_use]
53    pub fn gpdac_iob_en(&mut self) -> GPDAC_IOB_EN_W<GPDAC_CONFIG_2_SPEC> {
54        GPDAC_IOB_EN_W::new(self, 1)
55    }
56    #[doc = "Bits 18:19"]
57    #[inline(always)]
58    #[must_use]
59    pub fn gpdac_b_rng(&mut self) -> GPDAC_B_RNG_W<GPDAC_CONFIG_2_SPEC> {
60        GPDAC_B_RNG_W::new(self, 18)
61    }
62    #[doc = "Bits 20:22"]
63    #[inline(always)]
64    #[must_use]
65    pub fn gpdac_b_outmux(&mut self) -> GPDAC_B_OUTMUX_W<GPDAC_CONFIG_2_SPEC> {
66        GPDAC_B_OUTMUX_W::new(self, 20)
67    }
68    #[doc = r" Writes raw bits to the register."]
69    #[doc = r""]
70    #[doc = r" # Safety"]
71    #[doc = r""]
72    #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
73    #[inline(always)]
74    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
75        self.bits = bits;
76        self
77    }
78}
79#[doc = "General Purpose Digital-to-analog convert configuration 2\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`gpdac_config_2::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 [`gpdac_config_2::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
80pub struct GPDAC_CONFIG_2_SPEC;
81impl crate::RegisterSpec for GPDAC_CONFIG_2_SPEC {
82    type Ux = u32;
83}
84#[doc = "`read()` method returns [`gpdac_config_2::R`](R) reader structure"]
85impl crate::Readable for GPDAC_CONFIG_2_SPEC {}
86#[doc = "`write(|w| ..)` method takes [`gpdac_config_2::W`](W) writer structure"]
87impl crate::Writable for GPDAC_CONFIG_2_SPEC {
88    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
89    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
90}
91#[doc = "`reset()` method sets gpdac_config_2 to value 0"]
92impl crate::Resettable for GPDAC_CONFIG_2_SPEC {
93    const RESET_VALUE: Self::Ux = 0;
94}