efm32wg230_pac/gpio/
em4wucause.rs1#[doc = "Register `EM4WUCAUSE` reader"]
2pub struct R(crate::R<EM4WUCAUSE_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<EM4WUCAUSE_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<EM4WUCAUSE_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<EM4WUCAUSE_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "EM4 wake-up cause\n\nValue on reset: 0"]
17#[derive(Clone, Copy, Debug, PartialEq)]
18#[repr(u8)]
19pub enum EM4WUCAUSE_A {
20 #[doc = "1: This bit indicates an em4 wake-up request occurred on pin A0"]
21 A0 = 1,
22 #[doc = "2: This bit indicates an em4 wake-up request occurred on pin A6"]
23 A6 = 2,
24 #[doc = "4: This bit indicates an em4 wake-up request occurred on pin C9"]
25 C9 = 4,
26 #[doc = "8: This bit indicates an em4 wake-up request occurred on pin F1"]
27 F1 = 8,
28 #[doc = "16: This bit indicates an em4 wake-up request occurred on pin F2"]
29 F2 = 16,
30 #[doc = "32: This bit indicates an em4 wake-up request occurred on pin E13"]
31 E13 = 32,
32}
33impl From<EM4WUCAUSE_A> for u8 {
34 #[inline(always)]
35 fn from(variant: EM4WUCAUSE_A) -> Self {
36 variant as _
37 }
38}
39#[doc = "Field `EM4WUCAUSE` reader - EM4 wake-up cause"]
40pub type EM4WUCAUSE_R = crate::FieldReader<u8, EM4WUCAUSE_A>;
41impl EM4WUCAUSE_R {
42 #[doc = "Get enumerated values variant"]
43 #[inline(always)]
44 pub fn variant(&self) -> Option<EM4WUCAUSE_A> {
45 match self.bits {
46 1 => Some(EM4WUCAUSE_A::A0),
47 2 => Some(EM4WUCAUSE_A::A6),
48 4 => Some(EM4WUCAUSE_A::C9),
49 8 => Some(EM4WUCAUSE_A::F1),
50 16 => Some(EM4WUCAUSE_A::F2),
51 32 => Some(EM4WUCAUSE_A::E13),
52 _ => None,
53 }
54 }
55 #[doc = "Checks if the value of the field is `A0`"]
56 #[inline(always)]
57 pub fn is_a0(&self) -> bool {
58 *self == EM4WUCAUSE_A::A0
59 }
60 #[doc = "Checks if the value of the field is `A6`"]
61 #[inline(always)]
62 pub fn is_a6(&self) -> bool {
63 *self == EM4WUCAUSE_A::A6
64 }
65 #[doc = "Checks if the value of the field is `C9`"]
66 #[inline(always)]
67 pub fn is_c9(&self) -> bool {
68 *self == EM4WUCAUSE_A::C9
69 }
70 #[doc = "Checks if the value of the field is `F1`"]
71 #[inline(always)]
72 pub fn is_f1(&self) -> bool {
73 *self == EM4WUCAUSE_A::F1
74 }
75 #[doc = "Checks if the value of the field is `F2`"]
76 #[inline(always)]
77 pub fn is_f2(&self) -> bool {
78 *self == EM4WUCAUSE_A::F2
79 }
80 #[doc = "Checks if the value of the field is `E13`"]
81 #[inline(always)]
82 pub fn is_e13(&self) -> bool {
83 *self == EM4WUCAUSE_A::E13
84 }
85}
86impl R {
87 #[doc = "Bits 0:5 - EM4 wake-up cause"]
88 #[inline(always)]
89 pub fn em4wucause(&self) -> EM4WUCAUSE_R {
90 EM4WUCAUSE_R::new((self.bits & 0x3f) as u8)
91 }
92}
93#[doc = "EM4 Wake-up Cause 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 [em4wucause](index.html) module"]
94pub struct EM4WUCAUSE_SPEC;
95impl crate::RegisterSpec for EM4WUCAUSE_SPEC {
96 type Ux = u32;
97}
98#[doc = "`read()` method returns [em4wucause::R](R) reader structure"]
99impl crate::Readable for EM4WUCAUSE_SPEC {
100 type Reader = R;
101}
102#[doc = "`reset()` method sets EM4WUCAUSE to value 0"]
103impl crate::Resettable for EM4WUCAUSE_SPEC {
104 #[inline(always)]
105 fn reset_value() -> Self::Ux {
106 0
107 }
108}