1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
#[doc = "Reader of register EWCTRL"]
pub type R = crate::R<u32, super::EWCTRL>;
#[doc = "Writer for register EWCTRL"]
pub type W = crate::W<u32, super::EWCTRL>;
#[doc = "Register EWCTRL `reset()`'s with value 0"]
impl crate::ResetValue for super::EWCTRL {
    type Type = u32;
    #[inline(always)]
    fn reset_value() -> Self::Type {
        0
    }
}
#[doc = "Possible values of the field `EWC0EN_STATUS`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum EWC0EN_STATUS_A {
    #[doc = "External Wakeup Controller 0 Enabled"]
    ENABLE,
    #[doc = "External Wakeup Controller 0 Disabled"]
    DISABLED,
}
impl From<EWC0EN_STATUS_A> for bool {
    #[inline(always)]
    fn from(variant: EWC0EN_STATUS_A) -> Self {
        match variant {
            EWC0EN_STATUS_A::ENABLE => true,
            EWC0EN_STATUS_A::DISABLED => false,
        }
    }
}
#[doc = "Reader of field `EWC0EN_STATUS`"]
pub type EWC0EN_STATUS_R = crate::R<bool, EWC0EN_STATUS_A>;
impl EWC0EN_STATUS_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> EWC0EN_STATUS_A {
        match self.bits {
            true => EWC0EN_STATUS_A::ENABLE,
            false => EWC0EN_STATUS_A::DISABLED,
        }
    }
    #[doc = "Checks if the value of the field is `ENABLE`"]
    #[inline(always)]
    pub fn is_enable(&self) -> bool {
        *self == EWC0EN_STATUS_A::ENABLE
    }
    #[doc = "Checks if the value of the field is `DISABLED`"]
    #[inline(always)]
    pub fn is_disabled(&self) -> bool {
        *self == EWC0EN_STATUS_A::DISABLED
    }
}
#[doc = "Possible values of the field `EWC1EN_STATUS`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum EWC1EN_STATUS_A {
    #[doc = "External Wakeup Controller 1 Enabled"]
    ENABLE,
    #[doc = "External Wakeup Controller 1 Disabled"]
    DISABLED,
}
impl From<EWC1EN_STATUS_A> for bool {
    #[inline(always)]
    fn from(variant: EWC1EN_STATUS_A) -> Self {
        match variant {
            EWC1EN_STATUS_A::ENABLE => true,
            EWC1EN_STATUS_A::DISABLED => false,
        }
    }
}
#[doc = "Reader of field `EWC1EN_STATUS`"]
pub type EWC1EN_STATUS_R = crate::R<bool, EWC1EN_STATUS_A>;
impl EWC1EN_STATUS_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> EWC1EN_STATUS_A {
        match self.bits {
            true => EWC1EN_STATUS_A::ENABLE,
            false => EWC1EN_STATUS_A::DISABLED,
        }
    }
    #[doc = "Checks if the value of the field is `ENABLE`"]
    #[inline(always)]
    pub fn is_enable(&self) -> bool {
        *self == EWC1EN_STATUS_A::ENABLE
    }
    #[doc = "Checks if the value of the field is `DISABLED`"]
    #[inline(always)]
    pub fn is_disabled(&self) -> bool {
        *self == EWC1EN_STATUS_A::DISABLED
    }
}
#[doc = "Write proxy for field `EWC0EN_SET`"]
pub struct EWC0EN_SET_W<'a> {
    w: &'a mut W,
}
impl<'a> EWC0EN_SET_W<'a> {
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W {
        self.bit(true)
    }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W {
        self.bit(false)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 4)) | (((value as u32) & 0x01) << 4);
        self.w
    }
}
#[doc = "Write proxy for field `EWC1EN_SET`"]
pub struct EWC1EN_SET_W<'a> {
    w: &'a mut W,
}
impl<'a> EWC1EN_SET_W<'a> {
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W {
        self.bit(true)
    }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W {
        self.bit(false)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 5)) | (((value as u32) & 0x01) << 5);
        self.w
    }
}
#[doc = "Write proxy for field `EWC0EN_CLR`"]
pub struct EWC0EN_CLR_W<'a> {
    w: &'a mut W,
}
impl<'a> EWC0EN_CLR_W<'a> {
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W {
        self.bit(true)
    }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W {
        self.bit(false)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 8)) | (((value as u32) & 0x01) << 8);
        self.w
    }
}
#[doc = "Write proxy for field `EWC1EN_CLR`"]
pub struct EWC1EN_CLR_W<'a> {
    w: &'a mut W,
}
impl<'a> EWC1EN_CLR_W<'a> {
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W {
        self.bit(true)
    }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W {
        self.bit(false)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 9)) | (((value as u32) & 0x01) << 9);
        self.w
    }
}
impl R {
    #[doc = "Bit 0 - External Wakeup Controller 0 Enable"]
    #[inline(always)]
    pub fn ewc0en_status(&self) -> EWC0EN_STATUS_R {
        EWC0EN_STATUS_R::new((self.bits & 0x01) != 0)
    }
    #[doc = "Bit 1 - External Wakeup Controller 1 Enable"]
    #[inline(always)]
    pub fn ewc1en_status(&self) -> EWC1EN_STATUS_R {
        EWC1EN_STATUS_R::new(((self.bits >> 1) & 0x01) != 0)
    }
}
impl W {
    #[doc = "Bit 4 - EHigh Active External Wakeup Controller 0 Set"]
    #[inline(always)]
    pub fn ewc0en_set(&mut self) -> EWC0EN_SET_W {
        EWC0EN_SET_W { w: self }
    }
    #[doc = "Bit 5 - High Active External Wakeup Controller 1 Set"]
    #[inline(always)]
    pub fn ewc1en_set(&mut self) -> EWC1EN_SET_W {
        EWC1EN_SET_W { w: self }
    }
    #[doc = "Bit 8 - High Active External Wakeup Controller 0 Clear"]
    #[inline(always)]
    pub fn ewc0en_clr(&mut self) -> EWC0EN_CLR_W {
        EWC0EN_CLR_W { w: self }
    }
    #[doc = "Bit 9 - High Active External Wakeup Controller 1 Clear"]
    #[inline(always)]
    pub fn ewc1en_clr(&mut self) -> EWC1EN_CLR_W {
        EWC1EN_CLR_W { w: self }
    }
}