atsamd11c/gclk/
gendiv.rs

1#[doc = "Register `GENDIV` reader"]
2pub type R = crate::R<GendivSpec>;
3#[doc = "Register `GENDIV` writer"]
4pub type W = crate::W<GendivSpec>;
5#[doc = "Field `ID` reader - Generic Clock Generator Selection"]
6pub type IdR = crate::FieldReader;
7#[doc = "Field `ID` writer - Generic Clock Generator Selection"]
8pub type IdW<'a, REG> = crate::FieldWriter<'a, REG, 4>;
9#[doc = "Field `DIV` reader - Division Factor"]
10pub type DivR = crate::FieldReader<u16>;
11#[doc = "Field `DIV` writer - Division Factor"]
12pub type DivW<'a, REG> = crate::FieldWriter<'a, REG, 16, u16>;
13impl R {
14    #[doc = "Bits 0:3 - Generic Clock Generator Selection"]
15    #[inline(always)]
16    pub fn id(&self) -> IdR {
17        IdR::new((self.bits & 0x0f) as u8)
18    }
19    #[doc = "Bits 8:23 - Division Factor"]
20    #[inline(always)]
21    pub fn div(&self) -> DivR {
22        DivR::new(((self.bits >> 8) & 0xffff) as u16)
23    }
24}
25impl W {
26    #[doc = "Bits 0:3 - Generic Clock Generator Selection"]
27    #[inline(always)]
28    #[must_use]
29    pub fn id(&mut self) -> IdW<GendivSpec> {
30        IdW::new(self, 0)
31    }
32    #[doc = "Bits 8:23 - Division Factor"]
33    #[inline(always)]
34    #[must_use]
35    pub fn div(&mut self) -> DivW<GendivSpec> {
36        DivW::new(self, 8)
37    }
38}
39#[doc = "Generic Clock Generator Division\n\nYou can [`read`](crate::Reg::read) this register and get [`gendiv::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`gendiv::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
40pub struct GendivSpec;
41impl crate::RegisterSpec for GendivSpec {
42    type Ux = u32;
43}
44#[doc = "`read()` method returns [`gendiv::R`](R) reader structure"]
45impl crate::Readable for GendivSpec {}
46#[doc = "`write(|w| ..)` method takes [`gendiv::W`](W) writer structure"]
47impl crate::Writable for GendivSpec {
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 GENDIV to value 0"]
53impl crate::Resettable for GendivSpec {
54    const RESET_VALUE: u32 = 0;
55}