xmc4700/dsd/
globcfg.rs

1#[doc = "Register `GLOBCFG` reader"]
2pub type R = crate::R<GLOBCFG_SPEC>;
3#[doc = "Register `GLOBCFG` writer"]
4pub type W = crate::W<GLOBCFG_SPEC>;
5#[doc = "Modulator Clock Select\n\nValue on reset: 0"]
6#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7#[repr(u8)]
8pub enum MCSEL_A {
9    #[doc = "0: Internal clock off, no source selected"]
10    VALUE1 = 0,
11    #[doc = "1: fDSD"]
12    VALUE2 = 1,
13}
14impl From<MCSEL_A> for u8 {
15    #[inline(always)]
16    fn from(variant: MCSEL_A) -> Self {
17        variant as _
18    }
19}
20impl crate::FieldSpec for MCSEL_A {
21    type Ux = u8;
22}
23impl crate::IsEnum for MCSEL_A {}
24#[doc = "Field `MCSEL` reader - Modulator Clock Select"]
25pub type MCSEL_R = crate::FieldReader<MCSEL_A>;
26impl MCSEL_R {
27    #[doc = "Get enumerated values variant"]
28    #[inline(always)]
29    pub const fn variant(&self) -> Option<MCSEL_A> {
30        match self.bits {
31            0 => Some(MCSEL_A::VALUE1),
32            1 => Some(MCSEL_A::VALUE2),
33            _ => None,
34        }
35    }
36    #[doc = "Internal clock off, no source selected"]
37    #[inline(always)]
38    pub fn is_value1(&self) -> bool {
39        *self == MCSEL_A::VALUE1
40    }
41    #[doc = "fDSD"]
42    #[inline(always)]
43    pub fn is_value2(&self) -> bool {
44        *self == MCSEL_A::VALUE2
45    }
46}
47#[doc = "Field `MCSEL` writer - Modulator Clock Select"]
48pub type MCSEL_W<'a, REG> = crate::FieldWriter<'a, REG, 3, MCSEL_A>;
49impl<'a, REG> MCSEL_W<'a, REG>
50where
51    REG: crate::Writable + crate::RegisterSpec,
52    REG::Ux: From<u8>,
53{
54    #[doc = "Internal clock off, no source selected"]
55    #[inline(always)]
56    pub fn value1(self) -> &'a mut crate::W<REG> {
57        self.variant(MCSEL_A::VALUE1)
58    }
59    #[doc = "fDSD"]
60    #[inline(always)]
61    pub fn value2(self) -> &'a mut crate::W<REG> {
62        self.variant(MCSEL_A::VALUE2)
63    }
64}
65impl R {
66    #[doc = "Bits 0:2 - Modulator Clock Select"]
67    #[inline(always)]
68    pub fn mcsel(&self) -> MCSEL_R {
69        MCSEL_R::new((self.bits & 7) as u8)
70    }
71}
72impl W {
73    #[doc = "Bits 0:2 - Modulator Clock Select"]
74    #[inline(always)]
75    pub fn mcsel(&mut self) -> MCSEL_W<GLOBCFG_SPEC> {
76        MCSEL_W::new(self, 0)
77    }
78}
79#[doc = "Global Configuration Register\n\nYou can [`read`](crate::Reg::read) this register and get [`globcfg::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`globcfg::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
80pub struct GLOBCFG_SPEC;
81impl crate::RegisterSpec for GLOBCFG_SPEC {
82    type Ux = u32;
83}
84#[doc = "`read()` method returns [`globcfg::R`](R) reader structure"]
85impl crate::Readable for GLOBCFG_SPEC {}
86#[doc = "`write(|w| ..)` method takes [`globcfg::W`](W) writer structure"]
87impl crate::Writable for GLOBCFG_SPEC {
88    type Safety = crate::Unsafe;
89    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
90    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
91}
92#[doc = "`reset()` method sets GLOBCFG to value 0"]
93impl crate::Resettable for GLOBCFG_SPEC {
94    const RESET_VALUE: u32 = 0;
95}