atsamd21g/tcc0/
per_dith5.rs

1#[doc = "Register `PER_DITH5` reader"]
2pub type R = crate::R<PerDith5Spec>;
3#[doc = "Register `PER_DITH5` writer"]
4pub type W = crate::W<PerDith5Spec>;
5#[doc = "Field `DITHERCY` reader - Dithering Cycle Number"]
6pub type DithercyR = crate::FieldReader;
7#[doc = "Field `DITHERCY` writer - Dithering Cycle Number"]
8pub type DithercyW<'a, REG> = crate::FieldWriter<'a, REG, 5>;
9#[doc = "Field `PER` reader - Period Value"]
10pub type PerR = crate::FieldReader<u32>;
11#[doc = "Field `PER` writer - Period Value"]
12pub type PerW<'a, REG> = crate::FieldWriter<'a, REG, 19, u32>;
13impl R {
14    #[doc = "Bits 0:4 - Dithering Cycle Number"]
15    #[inline(always)]
16    pub fn dithercy(&self) -> DithercyR {
17        DithercyR::new((self.bits & 0x1f) as u8)
18    }
19    #[doc = "Bits 5:23 - Period Value"]
20    #[inline(always)]
21    pub fn per(&self) -> PerR {
22        PerR::new((self.bits >> 5) & 0x0007_ffff)
23    }
24}
25impl W {
26    #[doc = "Bits 0:4 - Dithering Cycle Number"]
27    #[inline(always)]
28    #[must_use]
29    pub fn dithercy(&mut self) -> DithercyW<PerDith5Spec> {
30        DithercyW::new(self, 0)
31    }
32    #[doc = "Bits 5:23 - Period Value"]
33    #[inline(always)]
34    #[must_use]
35    pub fn per(&mut self) -> PerW<PerDith5Spec> {
36        PerW::new(self, 5)
37    }
38}
39#[doc = "Period\n\nYou can [`read`](crate::Reg::read) this register and get [`per_dith5::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`per_dith5::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
40pub struct PerDith5Spec;
41impl crate::RegisterSpec for PerDith5Spec {
42    type Ux = u32;
43}
44#[doc = "`read()` method returns [`per_dith5::R`](R) reader structure"]
45impl crate::Readable for PerDith5Spec {}
46#[doc = "`write(|w| ..)` method takes [`per_dith5::W`](W) writer structure"]
47impl crate::Writable for PerDith5Spec {
48    type Safety = crate::Unsafe;
49    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
50    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
51}
52#[doc = "`reset()` method sets PER_DITH5 to value 0xffff_ffff"]
53impl crate::Resettable for PerDith5Spec {
54    const RESET_VALUE: u32 = 0xffff_ffff;
55}