efm32pg22_pac/efm32pg22c200/smu_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 `SMULOCK` reader - SMU Lock"]
17pub type SMULOCK_R = crate::BitReader<SMULOCK_A>;
18#[doc = "SMU Lock\n\nValue on reset: 0"]
19#[derive(Clone, Copy, Debug, PartialEq, Eq)]
20pub enum SMULOCK_A {
21    #[doc = "0: SMULOCK is Unlocked"]
22    UNLOCKED = 0,
23    #[doc = "1: SMULOCK is Locked"]
24    LOCKED = 1,
25}
26impl From<SMULOCK_A> for bool {
27    #[inline(always)]
28    fn from(variant: SMULOCK_A) -> Self {
29        variant as u8 != 0
30    }
31}
32impl SMULOCK_R {
33    #[doc = "Get enumerated values variant"]
34    #[inline(always)]
35    pub fn variant(&self) -> SMULOCK_A {
36        match self.bits {
37            false => SMULOCK_A::UNLOCKED,
38            true => SMULOCK_A::LOCKED,
39        }
40    }
41    #[doc = "Checks if the value of the field is `UNLOCKED`"]
42    #[inline(always)]
43    pub fn is_unlocked(&self) -> bool {
44        *self == SMULOCK_A::UNLOCKED
45    }
46    #[doc = "Checks if the value of the field is `LOCKED`"]
47    #[inline(always)]
48    pub fn is_locked(&self) -> bool {
49        *self == SMULOCK_A::LOCKED
50    }
51}
52#[doc = "Field `SMUPRGERR` reader - SMU Programming Error"]
53pub type SMUPRGERR_R = crate::BitReader<bool>;
54impl R {
55    #[doc = "Bit 0 - SMU Lock"]
56    #[inline(always)]
57    pub fn smulock(&self) -> SMULOCK_R {
58        SMULOCK_R::new((self.bits & 1) != 0)
59    }
60    #[doc = "Bit 1 - SMU Programming Error"]
61    #[inline(always)]
62    pub fn smuprgerr(&self) -> SMUPRGERR_R {
63        SMUPRGERR_R::new(((self.bits >> 1) & 1) != 0)
64    }
65}
66#[doc = "Read to get SMU status.\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}