efm32jg12b_pac/efm32jg12b500/cmu/
hfperpresc.rs1#[doc = "Register `HFPERPRESC` reader"]
2pub struct R(crate::R<HFPERPRESC_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<HFPERPRESC_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<HFPERPRESC_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<HFPERPRESC_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `HFPERPRESC` writer"]
17pub struct W(crate::W<HFPERPRESC_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<HFPERPRESC_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<HFPERPRESC_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<HFPERPRESC_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `PRESC` reader - HFPERCLK Prescaler"]
38pub type PRESC_R = crate::FieldReader<u16, PRESC_A>;
39#[doc = "HFPERCLK Prescaler\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u16)]
42pub enum PRESC_A {
43 #[doc = "0: `0`"]
44 NODIVISION = 0,
45}
46impl From<PRESC_A> for u16 {
47 #[inline(always)]
48 fn from(variant: PRESC_A) -> Self {
49 variant as _
50 }
51}
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, const O: u8> =
69 crate::FieldWriter<'a, u32, HFPERPRESC_SPEC, u16, PRESC_A, 9, O>;
70impl<'a, const O: u8> PRESC_W<'a, O> {
71 #[doc = "`0`"]
72 #[inline(always)]
73 pub fn nodivision(self) -> &'a mut W {
74 self.variant(PRESC_A::NODIVISION)
75 }
76}
77impl R {
78 #[doc = "Bits 8:16 - HFPERCLK Prescaler"]
79 #[inline(always)]
80 pub fn presc(&self) -> PRESC_R {
81 PRESC_R::new(((self.bits >> 8) & 0x01ff) as u16)
82 }
83}
84impl W {
85 #[doc = "Bits 8:16 - HFPERCLK Prescaler"]
86 #[inline(always)]
87 #[must_use]
88 pub fn presc(&mut self) -> PRESC_W<8> {
89 PRESC_W::new(self)
90 }
91 #[doc = "Writes raw bits to the register."]
92 #[inline(always)]
93 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
94 self.0.bits(bits);
95 self
96 }
97}
98#[doc = "High Frequency Peripheral Clock Prescaler 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 [hfperpresc](index.html) module"]
99pub struct HFPERPRESC_SPEC;
100impl crate::RegisterSpec for HFPERPRESC_SPEC {
101 type Ux = u32;
102}
103#[doc = "`read()` method returns [hfperpresc::R](R) reader structure"]
104impl crate::Readable for HFPERPRESC_SPEC {
105 type Reader = R;
106}
107#[doc = "`write(|w| ..)` method takes [hfperpresc::W](W) writer structure"]
108impl crate::Writable for HFPERPRESC_SPEC {
109 type Writer = W;
110 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
111 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
112}
113#[doc = "`reset()` method sets HFPERPRESC to value 0"]
114impl crate::Resettable for HFPERPRESC_SPEC {
115 const RESET_VALUE: Self::Ux = 0;
116}