atsamd51g/tcc0/
per_dith5_mode.rs
1#[doc = "Register `PER_DITH5_MODE` reader"]
2pub type R = crate::R<PerDith5ModeSpec>;
3#[doc = "Register `PER_DITH5_MODE` writer"]
4pub type W = crate::W<PerDith5ModeSpec>;
5#[doc = "Field `DITHER` reader - Dithering Cycle Number"]
6pub type DitherR = crate::FieldReader;
7#[doc = "Field `DITHER` writer - Dithering Cycle Number"]
8pub type DitherW<'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 dither(&self) -> DitherR {
17 DitherR::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 dither(&mut self) -> DitherW<PerDith5ModeSpec> {
30 DitherW::new(self, 0)
31 }
32 #[doc = "Bits 5:23 - Period Value"]
33 #[inline(always)]
34 #[must_use]
35 pub fn per(&mut self) -> PerW<PerDith5ModeSpec> {
36 PerW::new(self, 5)
37 }
38}
39#[doc = "Period\n\nYou can [`read`](crate::Reg::read) this register and get [`per_dith5_mode::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_mode::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
40pub struct PerDith5ModeSpec;
41impl crate::RegisterSpec for PerDith5ModeSpec {
42 type Ux = u32;
43}
44#[doc = "`read()` method returns [`per_dith5_mode::R`](R) reader structure"]
45impl crate::Readable for PerDith5ModeSpec {}
46#[doc = "`write(|w| ..)` method takes [`per_dith5_mode::W`](W) writer structure"]
47impl crate::Writable for PerDith5ModeSpec {
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_MODE to value 0xffff_ffff"]
53impl crate::Resettable for PerDith5ModeSpec {
54 const RESET_VALUE: u32 = 0xffff_ffff;
55}