xmc4500/gpdma1/
dmacfgreg.rs

1#[doc = "Register `DMACFGREG` reader"]
2pub type R = crate::R<DMACFGREG_SPEC>;
3#[doc = "Register `DMACFGREG` writer"]
4pub type W = crate::W<DMACFGREG_SPEC>;
5#[doc = "GPDMA Enable bit.\n\nValue on reset: 0"]
6#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7pub enum DMA_EN_A {
8    #[doc = "0: GPDMA Disabled"]
9    VALUE1 = 0,
10    #[doc = "1: GPDMA Enabled."]
11    VALUE2 = 1,
12}
13impl From<DMA_EN_A> for bool {
14    #[inline(always)]
15    fn from(variant: DMA_EN_A) -> Self {
16        variant as u8 != 0
17    }
18}
19#[doc = "Field `DMA_EN` reader - GPDMA Enable bit."]
20pub type DMA_EN_R = crate::BitReader<DMA_EN_A>;
21impl DMA_EN_R {
22    #[doc = "Get enumerated values variant"]
23    #[inline(always)]
24    pub const fn variant(&self) -> DMA_EN_A {
25        match self.bits {
26            false => DMA_EN_A::VALUE1,
27            true => DMA_EN_A::VALUE2,
28        }
29    }
30    #[doc = "GPDMA Disabled"]
31    #[inline(always)]
32    pub fn is_value1(&self) -> bool {
33        *self == DMA_EN_A::VALUE1
34    }
35    #[doc = "GPDMA Enabled."]
36    #[inline(always)]
37    pub fn is_value2(&self) -> bool {
38        *self == DMA_EN_A::VALUE2
39    }
40}
41#[doc = "Field `DMA_EN` writer - GPDMA Enable bit."]
42pub type DMA_EN_W<'a, REG> = crate::BitWriter<'a, REG, DMA_EN_A>;
43impl<'a, REG> DMA_EN_W<'a, REG>
44where
45    REG: crate::Writable + crate::RegisterSpec,
46{
47    #[doc = "GPDMA Disabled"]
48    #[inline(always)]
49    pub fn value1(self) -> &'a mut crate::W<REG> {
50        self.variant(DMA_EN_A::VALUE1)
51    }
52    #[doc = "GPDMA Enabled."]
53    #[inline(always)]
54    pub fn value2(self) -> &'a mut crate::W<REG> {
55        self.variant(DMA_EN_A::VALUE2)
56    }
57}
58impl R {
59    #[doc = "Bit 0 - GPDMA Enable bit."]
60    #[inline(always)]
61    pub fn dma_en(&self) -> DMA_EN_R {
62        DMA_EN_R::new((self.bits & 1) != 0)
63    }
64}
65impl W {
66    #[doc = "Bit 0 - GPDMA Enable bit."]
67    #[inline(always)]
68    pub fn dma_en(&mut self) -> DMA_EN_W<DMACFGREG_SPEC> {
69        DMA_EN_W::new(self, 0)
70    }
71}
72#[doc = "GPDMA Configuration Register\n\nYou can [`read`](crate::Reg::read) this register and get [`dmacfgreg::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`dmacfgreg::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
73pub struct DMACFGREG_SPEC;
74impl crate::RegisterSpec for DMACFGREG_SPEC {
75    type Ux = u32;
76}
77#[doc = "`read()` method returns [`dmacfgreg::R`](R) reader structure"]
78impl crate::Readable for DMACFGREG_SPEC {}
79#[doc = "`write(|w| ..)` method takes [`dmacfgreg::W`](W) writer structure"]
80impl crate::Writable for DMACFGREG_SPEC {
81    type Safety = crate::Unsafe;
82    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
83    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
84}
85#[doc = "`reset()` method sets DMACFGREG to value 0"]
86impl crate::Resettable for DMACFGREG_SPEC {
87    const RESET_VALUE: u32 = 0;
88}