gd32e5/gd32e508/uart3/
gdctl.rs

1#[doc = "Register `GDCTL` reader"]
2pub type R = crate::R<GdctlSpec>;
3#[doc = "Register `GDCTL` writer"]
4pub type W = crate::W<GdctlSpec>;
5#[doc = "Field `CDEN` reader - Collision detection enable"]
6pub type CdenR = crate::BitReader;
7#[doc = "Field `CDEN` writer - Collision detection enable"]
8pub type CdenW<'a, REG> = crate::BitWriter<'a, REG>;
9#[doc = "Field `CD` writer - Collision detected status"]
10pub type CdW<'a, REG> = crate::BitWriter<'a, REG>;
11#[doc = "Field `CDIE` reader - Collision detected interrupt enable"]
12pub type CdieR = crate::BitReader;
13#[doc = "Field `CDIE` writer - Collision detected interrupt enable"]
14pub type CdieW<'a, REG> = crate::BitWriter<'a, REG>;
15impl R {
16    #[doc = "Bit 1 - Collision detection enable"]
17    #[inline(always)]
18    pub fn cden(&self) -> CdenR {
19        CdenR::new(((self.bits >> 1) & 1) != 0)
20    }
21    #[doc = "Bit 16 - Collision detected interrupt enable"]
22    #[inline(always)]
23    pub fn cdie(&self) -> CdieR {
24        CdieR::new(((self.bits >> 16) & 1) != 0)
25    }
26}
27impl W {
28    #[doc = "Bit 1 - Collision detection enable"]
29    #[inline(always)]
30    #[must_use]
31    pub fn cden(&mut self) -> CdenW<GdctlSpec> {
32        CdenW::new(self, 1)
33    }
34    #[doc = "Bit 8 - Collision detected status"]
35    #[inline(always)]
36    #[must_use]
37    pub fn cd(&mut self) -> CdW<GdctlSpec> {
38        CdW::new(self, 8)
39    }
40    #[doc = "Bit 16 - Collision detected interrupt enable"]
41    #[inline(always)]
42    #[must_use]
43    pub fn cdie(&mut self) -> CdieW<GdctlSpec> {
44        CdieW::new(self, 16)
45    }
46}
47#[doc = "GD control register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`gdctl::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 [`gdctl::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
48pub struct GdctlSpec;
49impl crate::RegisterSpec for GdctlSpec {
50    type Ux = u32;
51}
52#[doc = "`read()` method returns [`gdctl::R`](R) reader structure"]
53impl crate::Readable for GdctlSpec {}
54#[doc = "`write(|w| ..)` method takes [`gdctl::W`](W) writer structure"]
55impl crate::Writable for GdctlSpec {
56    type Safety = crate::Unsafe;
57    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
58    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
59}
60#[doc = "`reset()` method sets GDCTL to value 0"]
61impl crate::Resettable for GdctlSpec {
62    const RESET_VALUE: u32 = 0;
63}