xmc4500/wdt/
ctr.rs

1#[doc = "Register `CTR` reader"]
2pub type R = crate::R<CTR_SPEC>;
3#[doc = "Register `CTR` writer"]
4pub type W = crate::W<CTR_SPEC>;
5#[doc = "Field `ENB` reader - Enable"]
6pub type ENB_R = crate::BitReader;
7#[doc = "Field `ENB` writer - Enable"]
8pub type ENB_W<'a, REG> = crate::BitWriter<'a, REG>;
9#[doc = "Field `PRE` reader - Pre-warning"]
10pub type PRE_R = crate::BitReader;
11#[doc = "Field `PRE` writer - Pre-warning"]
12pub type PRE_W<'a, REG> = crate::BitWriter<'a, REG>;
13#[doc = "Field `DSP` reader - Debug Suspend"]
14pub type DSP_R = crate::BitReader;
15#[doc = "Field `DSP` writer - Debug Suspend"]
16pub type DSP_W<'a, REG> = crate::BitWriter<'a, REG>;
17#[doc = "Field `SPW` reader - Service Indication Pulse Width"]
18pub type SPW_R = crate::FieldReader;
19#[doc = "Field `SPW` writer - Service Indication Pulse Width"]
20pub type SPW_W<'a, REG> = crate::FieldWriter<'a, REG, 8>;
21impl R {
22    #[doc = "Bit 0 - Enable"]
23    #[inline(always)]
24    pub fn enb(&self) -> ENB_R {
25        ENB_R::new((self.bits & 1) != 0)
26    }
27    #[doc = "Bit 1 - Pre-warning"]
28    #[inline(always)]
29    pub fn pre(&self) -> PRE_R {
30        PRE_R::new(((self.bits >> 1) & 1) != 0)
31    }
32    #[doc = "Bit 4 - Debug Suspend"]
33    #[inline(always)]
34    pub fn dsp(&self) -> DSP_R {
35        DSP_R::new(((self.bits >> 4) & 1) != 0)
36    }
37    #[doc = "Bits 8:15 - Service Indication Pulse Width"]
38    #[inline(always)]
39    pub fn spw(&self) -> SPW_R {
40        SPW_R::new(((self.bits >> 8) & 0xff) as u8)
41    }
42}
43impl W {
44    #[doc = "Bit 0 - Enable"]
45    #[inline(always)]
46    pub fn enb(&mut self) -> ENB_W<CTR_SPEC> {
47        ENB_W::new(self, 0)
48    }
49    #[doc = "Bit 1 - Pre-warning"]
50    #[inline(always)]
51    pub fn pre(&mut self) -> PRE_W<CTR_SPEC> {
52        PRE_W::new(self, 1)
53    }
54    #[doc = "Bit 4 - Debug Suspend"]
55    #[inline(always)]
56    pub fn dsp(&mut self) -> DSP_W<CTR_SPEC> {
57        DSP_W::new(self, 4)
58    }
59    #[doc = "Bits 8:15 - Service Indication Pulse Width"]
60    #[inline(always)]
61    pub fn spw(&mut self) -> SPW_W<CTR_SPEC> {
62        SPW_W::new(self, 8)
63    }
64}
65#[doc = "WDT Control Register\n\nYou can [`read`](crate::Reg::read) this register and get [`ctr::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`ctr::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
66pub struct CTR_SPEC;
67impl crate::RegisterSpec for CTR_SPEC {
68    type Ux = u32;
69}
70#[doc = "`read()` method returns [`ctr::R`](R) reader structure"]
71impl crate::Readable for CTR_SPEC {}
72#[doc = "`write(|w| ..)` method takes [`ctr::W`](W) writer structure"]
73impl crate::Writable for CTR_SPEC {
74    type Safety = crate::Unsafe;
75    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
76    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
77}
78#[doc = "`reset()` method sets CTR to value 0"]
79impl crate::Resettable for CTR_SPEC {
80    const RESET_VALUE: u32 = 0;
81}