efm32pg1b200_pac/cmu/
lfepresc0.rs

1#[doc = "Register `LFEPRESC0` reader"]
2pub struct R(crate::R<LFEPRESC0_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<LFEPRESC0_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<LFEPRESC0_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<LFEPRESC0_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `LFEPRESC0` writer"]
17pub struct W(crate::W<LFEPRESC0_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<LFEPRESC0_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<LFEPRESC0_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<LFEPRESC0_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Real-Time Counter and Calendar Prescaler\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39#[repr(u8)]
40pub enum RTCC_A {
41    #[doc = "0: LFECLKRTCC = LFECLK"]
42    DIV1 = 0,
43}
44impl From<RTCC_A> for u8 {
45    #[inline(always)]
46    fn from(variant: RTCC_A) -> Self {
47        variant as _
48    }
49}
50#[doc = "Field `RTCC` reader - Real-Time Counter and Calendar Prescaler"]
51pub type RTCC_R = crate::FieldReader<u8, RTCC_A>;
52impl RTCC_R {
53    #[doc = "Get enumerated values variant"]
54    #[inline(always)]
55    pub fn variant(&self) -> Option<RTCC_A> {
56        match self.bits {
57            0 => Some(RTCC_A::DIV1),
58            _ => None,
59        }
60    }
61    #[doc = "Checks if the value of the field is `DIV1`"]
62    #[inline(always)]
63    pub fn is_div1(&self) -> bool {
64        *self == RTCC_A::DIV1
65    }
66}
67impl R {
68    #[doc = "Bits 0:3 - Real-Time Counter and Calendar Prescaler"]
69    #[inline(always)]
70    pub fn rtcc(&self) -> RTCC_R {
71        RTCC_R::new((self.bits & 0x0f) as u8)
72    }
73}
74impl W {
75    #[doc = "Writes raw bits to the register."]
76    #[inline(always)]
77    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
78        self.0.bits(bits);
79        self
80    }
81}
82#[doc = "Low Frequency E Prescaler Register 0 (Async Reg)\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 [lfepresc0](index.html) module"]
83pub struct LFEPRESC0_SPEC;
84impl crate::RegisterSpec for LFEPRESC0_SPEC {
85    type Ux = u32;
86}
87#[doc = "`read()` method returns [lfepresc0::R](R) reader structure"]
88impl crate::Readable for LFEPRESC0_SPEC {
89    type Reader = R;
90}
91#[doc = "`write(|w| ..)` method takes [lfepresc0::W](W) writer structure"]
92impl crate::Writable for LFEPRESC0_SPEC {
93    type Writer = W;
94}
95#[doc = "`reset()` method sets LFEPRESC0 to value 0"]
96impl crate::Resettable for LFEPRESC0_SPEC {
97    #[inline(always)]
98    fn reset_value() -> Self::Ux {
99        0
100    }
101}