atsamd51n/tcc0/
cc_dith4_mode.rs
1#[doc = "Register `CC_DITH4_MODE[%s]` reader"]
2pub type R = crate::R<CcDith4ModeSpec>;
3#[doc = "Register `CC_DITH4_MODE[%s]` writer"]
4pub type W = crate::W<CcDith4ModeSpec>;
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, 4>;
9#[doc = "Field `CC` reader - Channel Compare/Capture Value"]
10pub type CcR = crate::FieldReader<u32>;
11#[doc = "Field `CC` writer - Channel Compare/Capture Value"]
12pub type CcW<'a, REG> = crate::FieldWriter<'a, REG, 20, u32>;
13impl R {
14 #[doc = "Bits 0:3 - Dithering Cycle Number"]
15 #[inline(always)]
16 pub fn dither(&self) -> DitherR {
17 DitherR::new((self.bits & 0x0f) as u8)
18 }
19 #[doc = "Bits 4:23 - Channel Compare/Capture Value"]
20 #[inline(always)]
21 pub fn cc(&self) -> CcR {
22 CcR::new((self.bits >> 4) & 0x000f_ffff)
23 }
24}
25impl W {
26 #[doc = "Bits 0:3 - Dithering Cycle Number"]
27 #[inline(always)]
28 #[must_use]
29 pub fn dither(&mut self) -> DitherW<CcDith4ModeSpec> {
30 DitherW::new(self, 0)
31 }
32 #[doc = "Bits 4:23 - Channel Compare/Capture Value"]
33 #[inline(always)]
34 #[must_use]
35 pub fn cc(&mut self) -> CcW<CcDith4ModeSpec> {
36 CcW::new(self, 4)
37 }
38}
39#[doc = "Compare and Capture\n\nYou can [`read`](crate::Reg::read) this register and get [`cc_dith4_mode::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`cc_dith4_mode::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
40pub struct CcDith4ModeSpec;
41impl crate::RegisterSpec for CcDith4ModeSpec {
42 type Ux = u32;
43}
44#[doc = "`read()` method returns [`cc_dith4_mode::R`](R) reader structure"]
45impl crate::Readable for CcDith4ModeSpec {}
46#[doc = "`write(|w| ..)` method takes [`cc_dith4_mode::W`](W) writer structure"]
47impl crate::Writable for CcDith4ModeSpec {
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 CC_DITH4_MODE[%s]
53to value 0"]
54impl crate::Resettable for CcDith4ModeSpec {
55 const RESET_VALUE: u32 = 0;
56}