1#[doc = "Reader of register GPREG4"]
2pub type R = crate::R<u32, super::GPREG4>;
3#[doc = "Writer for register GPREG4"]
4pub type W = crate::W<u32, super::GPREG4>;
5#[doc = "Register GPREG4 `reset()`'s with value 0"]
6impl crate::ResetValue for super::GPREG4 {
7 type Type = u32;
8 #[inline(always)]
9 fn reset_value() -> Self::Type {
10 0
11 }
12}
13#[doc = "WAKEUP pin hysteresis enable.\n\nValue on reset: 0"]
14#[derive(Clone, Copy, Debug, PartialEq)]
15pub enum WAKEUPHYS_A {
16 #[doc = "1: Hysteresis for WAKEUP pin enabled"]
17 ENABLED,
18 #[doc = "0: Hysteresis for WAKUP pin disabled"]
19 DISABLED,
20}
21impl From<WAKEUPHYS_A> for bool {
22 #[inline(always)]
23 fn from(variant: WAKEUPHYS_A) -> Self {
24 match variant {
25 WAKEUPHYS_A::ENABLED => true,
26 WAKEUPHYS_A::DISABLED => false,
27 }
28 }
29}
30#[doc = "Reader of field `WAKEUPHYS`"]
31pub type WAKEUPHYS_R = crate::R<bool, WAKEUPHYS_A>;
32impl WAKEUPHYS_R {
33 #[doc = r"Get enumerated values variant"]
34 #[inline(always)]
35 pub fn variant(&self) -> WAKEUPHYS_A {
36 match self.bits {
37 true => WAKEUPHYS_A::ENABLED,
38 false => WAKEUPHYS_A::DISABLED,
39 }
40 }
41 #[doc = "Checks if the value of the field is `ENABLED`"]
42 #[inline(always)]
43 pub fn is_enabled(&self) -> bool {
44 *self == WAKEUPHYS_A::ENABLED
45 }
46 #[doc = "Checks if the value of the field is `DISABLED`"]
47 #[inline(always)]
48 pub fn is_disabled(&self) -> bool {
49 *self == WAKEUPHYS_A::DISABLED
50 }
51}
52#[doc = "Write proxy for field `WAKEUPHYS`"]
53pub struct WAKEUPHYS_W<'a> {
54 w: &'a mut W,
55}
56impl<'a> WAKEUPHYS_W<'a> {
57 #[doc = r"Writes `variant` to the field"]
58 #[inline(always)]
59 pub fn variant(self, variant: WAKEUPHYS_A) -> &'a mut W {
60 {
61 self.bit(variant.into())
62 }
63 }
64 #[doc = "Hysteresis for WAKEUP pin enabled"]
65 #[inline(always)]
66 pub fn enabled(self) -> &'a mut W {
67 self.variant(WAKEUPHYS_A::ENABLED)
68 }
69 #[doc = "Hysteresis for WAKUP pin disabled"]
70 #[inline(always)]
71 pub fn disabled(self) -> &'a mut W {
72 self.variant(WAKEUPHYS_A::DISABLED)
73 }
74 #[doc = r"Sets the field bit"]
75 #[inline(always)]
76 pub fn set_bit(self) -> &'a mut W {
77 self.bit(true)
78 }
79 #[doc = r"Clears the field bit"]
80 #[inline(always)]
81 pub fn clear_bit(self) -> &'a mut W {
82 self.bit(false)
83 }
84 #[doc = r"Writes raw bits to the field"]
85 #[inline(always)]
86 pub fn bit(self, value: bool) -> &'a mut W {
87 self.w.bits = (self.w.bits & !(0x01 << 10)) | (((value as u32) & 0x01) << 10);
88 self.w
89 }
90}
91#[doc = "Reader of field `GPDATA`"]
92pub type GPDATA_R = crate::R<u32, u32>;
93#[doc = "Write proxy for field `GPDATA`"]
94pub struct GPDATA_W<'a> {
95 w: &'a mut W,
96}
97impl<'a> GPDATA_W<'a> {
98 #[doc = r"Writes raw bits to the field"]
99 #[inline(always)]
100 pub unsafe fn bits(self, value: u32) -> &'a mut W {
101 self.w.bits = (self.w.bits & !(0x001f_ffff << 11)) | (((value as u32) & 0x001f_ffff) << 11);
102 self.w
103 }
104}
105impl R {
106 #[doc = "Bit 10 - WAKEUP pin hysteresis enable."]
107 #[inline(always)]
108 pub fn wakeuphys(&self) -> WAKEUPHYS_R {
109 WAKEUPHYS_R::new(((self.bits >> 10) & 0x01) != 0)
110 }
111 #[doc = "Bits 11:31 - Data retained during Deep power-down mode."]
112 #[inline(always)]
113 pub fn gpdata(&self) -> GPDATA_R {
114 GPDATA_R::new(((self.bits >> 11) & 0x001f_ffff) as u32)
115 }
116}
117impl W {
118 #[doc = "Bit 10 - WAKEUP pin hysteresis enable."]
119 #[inline(always)]
120 pub fn wakeuphys(&mut self) -> WAKEUPHYS_W {
121 WAKEUPHYS_W { w: self }
122 }
123 #[doc = "Bits 11:31 - Data retained during Deep power-down mode."]
124 #[inline(always)]
125 pub fn gpdata(&mut self) -> GPDATA_W {
126 GPDATA_W { w: self }
127 }
128}