efm32pg22_pac/efm32pg22c200/gpio_ns/
gpiolockstatus.rs

1#[doc = "Register `GPIOLOCKSTATUS` reader"]
2pub struct R(crate::R<GPIOLOCKSTATUS_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<GPIOLOCKSTATUS_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<GPIOLOCKSTATUS_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<GPIOLOCKSTATUS_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Field `LOCK` reader - GPIO LOCK status"]
17pub type LOCK_R = crate::BitReader<LOCK_A>;
18#[doc = "GPIO LOCK status\n\nValue on reset: 0"]
19#[derive(Clone, Copy, Debug, PartialEq, Eq)]
20pub enum LOCK_A {
21    #[doc = "0: Registers are unlocked"]
22    UNLOCKED = 0,
23    #[doc = "1: Registers are locked"]
24    LOCKED = 1,
25}
26impl From<LOCK_A> for bool {
27    #[inline(always)]
28    fn from(variant: LOCK_A) -> Self {
29        variant as u8 != 0
30    }
31}
32impl LOCK_R {
33    #[doc = "Get enumerated values variant"]
34    #[inline(always)]
35    pub fn variant(&self) -> LOCK_A {
36        match self.bits {
37            false => LOCK_A::UNLOCKED,
38            true => LOCK_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 == LOCK_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 == LOCK_A::LOCKED
50    }
51}
52impl R {
53    #[doc = "Bit 0 - GPIO LOCK status"]
54    #[inline(always)]
55    pub fn lock(&self) -> LOCK_R {
56        LOCK_R::new((self.bits & 1) != 0)
57    }
58}
59#[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 [gpiolockstatus](index.html) module"]
60pub struct GPIOLOCKSTATUS_SPEC;
61impl crate::RegisterSpec for GPIOLOCKSTATUS_SPEC {
62    type Ux = u32;
63}
64#[doc = "`read()` method returns [gpiolockstatus::R](R) reader structure"]
65impl crate::Readable for GPIOLOCKSTATUS_SPEC {
66    type Reader = R;
67}
68#[doc = "`reset()` method sets GPIOLOCKSTATUS to value 0"]
69impl crate::Resettable for GPIOLOCKSTATUS_SPEC {
70    const RESET_VALUE: Self::Ux = 0;
71}