efm32pg22_pac/efm32pg22c200/lfrco_s/
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 Status"]
17pub type RDY_R = crate::BitReader<bool>;
18#[doc = "Field `ENS` reader - Enabled Status"]
19pub type ENS_R = crate::BitReader<bool>;
20#[doc = "Field `LOCK` reader - Lock Status"]
21pub type LOCK_R = crate::BitReader<LOCK_A>;
22#[doc = "Lock Status\n\nValue on reset: 0"]
23#[derive(Clone, Copy, Debug, PartialEq, Eq)]
24pub enum LOCK_A {
25    #[doc = "0: Access to configuration registers not locked"]
26    UNLOCKED = 0,
27    #[doc = "1: Access to configuration registers locked"]
28    LOCKED = 1,
29}
30impl From<LOCK_A> for bool {
31    #[inline(always)]
32    fn from(variant: LOCK_A) -> Self {
33        variant as u8 != 0
34    }
35}
36impl LOCK_R {
37    #[doc = "Get enumerated values variant"]
38    #[inline(always)]
39    pub fn variant(&self) -> LOCK_A {
40        match self.bits {
41            false => LOCK_A::UNLOCKED,
42            true => LOCK_A::LOCKED,
43        }
44    }
45    #[doc = "Checks if the value of the field is `UNLOCKED`"]
46    #[inline(always)]
47    pub fn is_unlocked(&self) -> bool {
48        *self == LOCK_A::UNLOCKED
49    }
50    #[doc = "Checks if the value of the field is `LOCKED`"]
51    #[inline(always)]
52    pub fn is_locked(&self) -> bool {
53        *self == LOCK_A::LOCKED
54    }
55}
56impl R {
57    #[doc = "Bit 0 - Ready Status"]
58    #[inline(always)]
59    pub fn rdy(&self) -> RDY_R {
60        RDY_R::new((self.bits & 1) != 0)
61    }
62    #[doc = "Bit 16 - Enabled Status"]
63    #[inline(always)]
64    pub fn ens(&self) -> ENS_R {
65        ENS_R::new(((self.bits >> 16) & 1) != 0)
66    }
67    #[doc = "Bit 31 - Lock Status"]
68    #[inline(always)]
69    pub fn lock(&self) -> LOCK_R {
70        LOCK_R::new(((self.bits >> 31) & 1) != 0)
71    }
72}
73#[doc = "Status register\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"]
74pub struct STATUS_SPEC;
75impl crate::RegisterSpec for STATUS_SPEC {
76    type Ux = u32;
77}
78#[doc = "`read()` method returns [status::R](R) reader structure"]
79impl crate::Readable for STATUS_SPEC {
80    type Reader = R;
81}
82#[doc = "`reset()` method sets STATUS to value 0"]
83impl crate::Resettable for STATUS_SPEC {
84    const RESET_VALUE: Self::Ux = 0;
85}