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