efm32pg22_pac/efm32pg22c200/hfrco0_ns/
status.rs

1#[doc = "Register `STATUS` reader"]
2pub struct R(crate::R<STATUS_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<STATUS_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<STATUS_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<STATUS_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Field `RDY` reader - Ready"]
17pub type RDY_R = crate::BitReader<bool>;
18#[doc = "Field `FREQBSY` reader - Frequency Updating Busy"]
19pub type FREQBSY_R = crate::BitReader<bool>;
20#[doc = "Field `SYNCBUSY` reader - Synchronization Busy"]
21pub type SYNCBUSY_R = crate::BitReader<bool>;
22#[doc = "Field `ENS` reader - Enable Status"]
23pub type ENS_R = crate::BitReader<bool>;
24#[doc = "Field `LOCK` reader - Lock Status"]
25pub type LOCK_R = crate::BitReader<LOCK_A>;
26#[doc = "Lock Status\n\nValue on reset: 0"]
27#[derive(Clone, Copy, Debug, PartialEq, Eq)]
28pub enum LOCK_A {
29    #[doc = "0: HFRCO is unlocked"]
30    UNLOCKED = 0,
31    #[doc = "1: HFRCO is locked"]
32    LOCKED = 1,
33}
34impl From<LOCK_A> for bool {
35    #[inline(always)]
36    fn from(variant: LOCK_A) -> Self {
37        variant as u8 != 0
38    }
39}
40impl LOCK_R {
41    #[doc = "Get enumerated values variant"]
42    #[inline(always)]
43    pub fn variant(&self) -> LOCK_A {
44        match self.bits {
45            false => LOCK_A::UNLOCKED,
46            true => LOCK_A::LOCKED,
47        }
48    }
49    #[doc = "Checks if the value of the field is `UNLOCKED`"]
50    #[inline(always)]
51    pub fn is_unlocked(&self) -> bool {
52        *self == LOCK_A::UNLOCKED
53    }
54    #[doc = "Checks if the value of the field is `LOCKED`"]
55    #[inline(always)]
56    pub fn is_locked(&self) -> bool {
57        *self == LOCK_A::LOCKED
58    }
59}
60impl R {
61    #[doc = "Bit 0 - Ready"]
62    #[inline(always)]
63    pub fn rdy(&self) -> RDY_R {
64        RDY_R::new((self.bits & 1) != 0)
65    }
66    #[doc = "Bit 1 - Frequency Updating Busy"]
67    #[inline(always)]
68    pub fn freqbsy(&self) -> FREQBSY_R {
69        FREQBSY_R::new(((self.bits >> 1) & 1) != 0)
70    }
71    #[doc = "Bit 2 - Synchronization Busy"]
72    #[inline(always)]
73    pub fn syncbusy(&self) -> SYNCBUSY_R {
74        SYNCBUSY_R::new(((self.bits >> 2) & 1) != 0)
75    }
76    #[doc = "Bit 16 - Enable Status"]
77    #[inline(always)]
78    pub fn ens(&self) -> ENS_R {
79        ENS_R::new(((self.bits >> 16) & 1) != 0)
80    }
81    #[doc = "Bit 31 - Lock Status"]
82    #[inline(always)]
83    pub fn lock(&self) -> LOCK_R {
84        LOCK_R::new(((self.bits >> 31) & 1) != 0)
85    }
86}
87#[doc = "No Description\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [status](index.html) module"]
88pub struct STATUS_SPEC;
89impl crate::RegisterSpec for STATUS_SPEC {
90    type Ux = u32;
91}
92#[doc = "`read()` method returns [status::R](R) reader structure"]
93impl crate::Readable for STATUS_SPEC {
94    type Reader = R;
95}
96#[doc = "`reset()` method sets STATUS to value 0"]
97impl crate::Resettable for STATUS_SPEC {
98    const RESET_VALUE: Self::Ux = 0;
99}