rp2040_pac/pwm/ch/
div.rs

1#[doc = "Register `DIV` reader"]
2pub type R = crate::R<DIV_SPEC>;
3#[doc = "Register `DIV` writer"]
4pub type W = crate::W<DIV_SPEC>;
5#[doc = "Field `FRAC` reader - "]
6pub type FRAC_R = crate::FieldReader;
7#[doc = "Field `FRAC` writer - "]
8pub type FRAC_W<'a, REG> = crate::FieldWriter<'a, REG, 4>;
9#[doc = "Field `INT` reader - "]
10pub type INT_R = crate::FieldReader;
11#[doc = "Field `INT` writer - "]
12pub type INT_W<'a, REG> = crate::FieldWriter<'a, REG, 8>;
13impl R {
14    #[doc = "Bits 0:3"]
15    #[inline(always)]
16    pub fn frac(&self) -> FRAC_R {
17        FRAC_R::new((self.bits & 0x0f) as u8)
18    }
19    #[doc = "Bits 4:11"]
20    #[inline(always)]
21    pub fn int(&self) -> INT_R {
22        INT_R::new(((self.bits >> 4) & 0xff) as u8)
23    }
24}
25impl W {
26    #[doc = "Bits 0:3"]
27    #[inline(always)]
28    #[must_use]
29    pub fn frac(&mut self) -> FRAC_W<DIV_SPEC> {
30        FRAC_W::new(self, 0)
31    }
32    #[doc = "Bits 4:11"]
33    #[inline(always)]
34    #[must_use]
35    pub fn int(&mut self) -> INT_W<DIV_SPEC> {
36        INT_W::new(self, 4)
37    }
38    #[doc = r" Writes raw bits to the register."]
39    #[doc = r""]
40    #[doc = r" # Safety"]
41    #[doc = r""]
42    #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
43    #[inline(always)]
44    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
45        self.bits = bits;
46        self
47    }
48}
49#[doc = "INT and FRAC form a fixed-point fractional number.  
50 Counting rate is system clock frequency divided by this number.  
51 Fractional division uses simple 1st-order sigma-delta.  
52
53You can [`read`](crate::generic::Reg::read) this register and get [`div::R`](R).  You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`div::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
54pub struct DIV_SPEC;
55impl crate::RegisterSpec for DIV_SPEC {
56    type Ux = u32;
57}
58#[doc = "`read()` method returns [`div::R`](R) reader structure"]
59impl crate::Readable for DIV_SPEC {}
60#[doc = "`write(|w| ..)` method takes [`div::W`](W) writer structure"]
61impl crate::Writable for DIV_SPEC {
62    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
63    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
64}
65#[doc = "`reset()` method sets DIV to value 0x10"]
66impl crate::Resettable for DIV_SPEC {
67    const RESET_VALUE: u32 = 0x10;
68}