efm32gg11b420_pac/cmu/
hfperprescc.rs

1#[doc = "Register `HFPERPRESCC` reader"]
2pub struct R(crate::R<HFPERPRESCC_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<HFPERPRESCC_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<HFPERPRESCC_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<HFPERPRESCC_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `HFPERPRESCC` writer"]
17pub struct W(crate::W<HFPERPRESCC_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<HFPERPRESCC_SPEC>;
20    #[inline(always)]
21    fn deref(&self) -> &Self::Target {
22        &self.0
23    }
24}
25impl core::ops::DerefMut for W {
26    #[inline(always)]
27    fn deref_mut(&mut self) -> &mut Self::Target {
28        &mut self.0
29    }
30}
31impl From<crate::W<HFPERPRESCC_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<HFPERPRESCC_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "HFPERCLK Prescaler\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39#[repr(u16)]
40pub enum PRESC_A {
41    #[doc = "0: `0`"]
42    NODIVISION = 0,
43}
44impl From<PRESC_A> for u16 {
45    #[inline(always)]
46    fn from(variant: PRESC_A) -> Self {
47        variant as _
48    }
49}
50#[doc = "Field `PRESC` reader - HFPERCLK Prescaler"]
51pub type PRESC_R = crate::FieldReader<u16, PRESC_A>;
52impl PRESC_R {
53    #[doc = "Get enumerated values variant"]
54    #[inline(always)]
55    pub fn variant(&self) -> Option<PRESC_A> {
56        match self.bits {
57            0 => Some(PRESC_A::NODIVISION),
58            _ => None,
59        }
60    }
61    #[doc = "Checks if the value of the field is `NODIVISION`"]
62    #[inline(always)]
63    pub fn is_nodivision(&self) -> bool {
64        *self == PRESC_A::NODIVISION
65    }
66}
67#[doc = "Field `PRESC` writer - HFPERCLK Prescaler"]
68pub type PRESC_W<'a> = crate::FieldWriter<'a, u32, HFPERPRESCC_SPEC, u16, PRESC_A, 9, 8>;
69impl<'a> PRESC_W<'a> {
70    #[doc = "`0`"]
71    #[inline(always)]
72    pub fn nodivision(self) -> &'a mut W {
73        self.variant(PRESC_A::NODIVISION)
74    }
75}
76impl R {
77    #[doc = "Bits 8:16 - HFPERCLK Prescaler"]
78    #[inline(always)]
79    pub fn presc(&self) -> PRESC_R {
80        PRESC_R::new(((self.bits >> 8) & 0x01ff) as u16)
81    }
82}
83impl W {
84    #[doc = "Bits 8:16 - HFPERCLK Prescaler"]
85    #[inline(always)]
86    pub fn presc(&mut self) -> PRESC_W {
87        PRESC_W::new(self)
88    }
89    #[doc = "Writes raw bits to the register."]
90    #[inline(always)]
91    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
92        self.0.bits(bits);
93        self
94    }
95}
96#[doc = "High Frequency Peripheral Clock Prescaler C Register\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [hfperprescc](index.html) module"]
97pub struct HFPERPRESCC_SPEC;
98impl crate::RegisterSpec for HFPERPRESCC_SPEC {
99    type Ux = u32;
100}
101#[doc = "`read()` method returns [hfperprescc::R](R) reader structure"]
102impl crate::Readable for HFPERPRESCC_SPEC {
103    type Reader = R;
104}
105#[doc = "`write(|w| ..)` method takes [hfperprescc::W](W) writer structure"]
106impl crate::Writable for HFPERPRESCC_SPEC {
107    type Writer = W;
108}
109#[doc = "`reset()` method sets HFPERPRESCC to value 0"]
110impl crate::Resettable for HFPERPRESCC_SPEC {
111    #[inline(always)]
112    fn reset_value() -> Self::Ux {
113        0
114    }
115}