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
#[doc = "Reader of register EXTIFCTRL"]
pub type R = crate::R<u32, super::EXTIFCTRL>;
#[doc = "Writer for register EXTIFCTRL"]
pub type W = crate::W<u32, super::EXTIFCTRL>;
#[doc = "Register EXTIFCTRL `reset()`'s with value 0"]
impl crate::ResetValue for super::EXTIFCTRL {
    type Type = u32;
    #[inline(always)]
    fn reset_value() -> Self::Type { 0 }
}
#[doc = "Reader of field `EN`"]
pub type EN_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `EN`"]
pub struct EN_W<'a> {
    w: &'a mut W,
}
impl<'a> EN_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) | ((value as u32) & 0x01);
        self.w
    }
}
#[doc = "APORT Selection for External Interface\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum APORTSEL_A {
    #[doc = "0: APORT0X used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT0XCH0."]
    APORT0X = 0,
    #[doc = "1: APORT0Y used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT0YCH0."]
    APORT0Y = 1,
    #[doc = "2: APORT1X used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT1XCH0."]
    APORT1X = 2,
    #[doc = "3: APORT1Y used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT1XCH0."]
    APORT1Y = 3,
    #[doc = "4: APORT1X/Y used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT1XCH0."]
    APORT1XY = 4,
    #[doc = "5: APORT2X used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT2YCH0."]
    APORT2X = 5,
    #[doc = "6: APORT2Y used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT2YCH0."]
    APORT2Y = 6,
    #[doc = "7: APORT2Y/X used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT2YCH0."]
    APORT2YX = 7,
    #[doc = "8: APORT3X used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT3XCH0."]
    APORT3X = 8,
    #[doc = "9: APORT3Y used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT3XCH0."]
    APORT3Y = 9,
    #[doc = "10: APORT3X/Y used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT3XCH0."]
    APORT3XY = 10,
    #[doc = "11: APORT4X used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT4YCH0."]
    APORT4X = 11,
    #[doc = "12: APORT4Y used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT4YCH0."]
    APORT4Y = 12,
    #[doc = "13: APORT4Y/X used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT4YCH0."]
    APORT4YX = 13,
}
impl From<APORTSEL_A> for u8 {
    #[inline(always)]
    fn from(variant: APORTSEL_A) -> Self { variant as _ }
}
#[doc = "Reader of field `APORTSEL`"]
pub type APORTSEL_R = crate::R<u8, APORTSEL_A>;
impl APORTSEL_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> crate::Variant<u8, APORTSEL_A> {
        use crate::Variant::*;
        match self.bits {
            0 => Val(APORTSEL_A::APORT0X),
            1 => Val(APORTSEL_A::APORT0Y),
            2 => Val(APORTSEL_A::APORT1X),
            3 => Val(APORTSEL_A::APORT1Y),
            4 => Val(APORTSEL_A::APORT1XY),
            5 => Val(APORTSEL_A::APORT2X),
            6 => Val(APORTSEL_A::APORT2Y),
            7 => Val(APORTSEL_A::APORT2YX),
            8 => Val(APORTSEL_A::APORT3X),
            9 => Val(APORTSEL_A::APORT3Y),
            10 => Val(APORTSEL_A::APORT3XY),
            11 => Val(APORTSEL_A::APORT4X),
            12 => Val(APORTSEL_A::APORT4Y),
            13 => Val(APORTSEL_A::APORT4YX),
            i => Res(i),
        }
    }
    #[doc = "Checks if the value of the field is `APORT0X`"]
    #[inline(always)]
    pub fn is_aport0x(&self) -> bool { *self == APORTSEL_A::APORT0X }
    #[doc = "Checks if the value of the field is `APORT0Y`"]
    #[inline(always)]
    pub fn is_aport0y(&self) -> bool { *self == APORTSEL_A::APORT0Y }
    #[doc = "Checks if the value of the field is `APORT1X`"]
    #[inline(always)]
    pub fn is_aport1x(&self) -> bool { *self == APORTSEL_A::APORT1X }
    #[doc = "Checks if the value of the field is `APORT1Y`"]
    #[inline(always)]
    pub fn is_aport1y(&self) -> bool { *self == APORTSEL_A::APORT1Y }
    #[doc = "Checks if the value of the field is `APORT1XY`"]
    #[inline(always)]
    pub fn is_aport1xy(&self) -> bool { *self == APORTSEL_A::APORT1XY }
    #[doc = "Checks if the value of the field is `APORT2X`"]
    #[inline(always)]
    pub fn is_aport2x(&self) -> bool { *self == APORTSEL_A::APORT2X }
    #[doc = "Checks if the value of the field is `APORT2Y`"]
    #[inline(always)]
    pub fn is_aport2y(&self) -> bool { *self == APORTSEL_A::APORT2Y }
    #[doc = "Checks if the value of the field is `APORT2YX`"]
    #[inline(always)]
    pub fn is_aport2yx(&self) -> bool { *self == APORTSEL_A::APORT2YX }
    #[doc = "Checks if the value of the field is `APORT3X`"]
    #[inline(always)]
    pub fn is_aport3x(&self) -> bool { *self == APORTSEL_A::APORT3X }
    #[doc = "Checks if the value of the field is `APORT3Y`"]
    #[inline(always)]
    pub fn is_aport3y(&self) -> bool { *self == APORTSEL_A::APORT3Y }
    #[doc = "Checks if the value of the field is `APORT3XY`"]
    #[inline(always)]
    pub fn is_aport3xy(&self) -> bool { *self == APORTSEL_A::APORT3XY }
    #[doc = "Checks if the value of the field is `APORT4X`"]
    #[inline(always)]
    pub fn is_aport4x(&self) -> bool { *self == APORTSEL_A::APORT4X }
    #[doc = "Checks if the value of the field is `APORT4Y`"]
    #[inline(always)]
    pub fn is_aport4y(&self) -> bool { *self == APORTSEL_A::APORT4Y }
    #[doc = "Checks if the value of the field is `APORT4YX`"]
    #[inline(always)]
    pub fn is_aport4yx(&self) -> bool { *self == APORTSEL_A::APORT4YX }
}
#[doc = "Write proxy for field `APORTSEL`"]
pub struct APORTSEL_W<'a> {
    w: &'a mut W,
}
impl<'a> APORTSEL_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: APORTSEL_A) -> &'a mut W { unsafe { self.bits(variant.into()) } }
    #[doc = "APORT0X used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT0XCH0."]
    #[inline(always)]
    pub fn aport0x(self) -> &'a mut W { self.variant(APORTSEL_A::APORT0X) }
    #[doc = "APORT0Y used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT0YCH0."]
    #[inline(always)]
    pub fn aport0y(self) -> &'a mut W { self.variant(APORTSEL_A::APORT0Y) }
    #[doc = "APORT1X used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT1XCH0."]
    #[inline(always)]
    pub fn aport1x(self) -> &'a mut W { self.variant(APORTSEL_A::APORT1X) }
    #[doc = "APORT1Y used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT1XCH0."]
    #[inline(always)]
    pub fn aport1y(self) -> &'a mut W { self.variant(APORTSEL_A::APORT1Y) }
    #[doc = "APORT1X/Y used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT1XCH0."]
    #[inline(always)]
    pub fn aport1xy(self) -> &'a mut W { self.variant(APORTSEL_A::APORT1XY) }
    #[doc = "APORT2X used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT2YCH0."]
    #[inline(always)]
    pub fn aport2x(self) -> &'a mut W { self.variant(APORTSEL_A::APORT2X) }
    #[doc = "APORT2Y used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT2YCH0."]
    #[inline(always)]
    pub fn aport2y(self) -> &'a mut W { self.variant(APORTSEL_A::APORT2Y) }
    #[doc = "APORT2Y/X used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT2YCH0."]
    #[inline(always)]
    pub fn aport2yx(self) -> &'a mut W { self.variant(APORTSEL_A::APORT2YX) }
    #[doc = "APORT3X used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT3XCH0."]
    #[inline(always)]
    pub fn aport3x(self) -> &'a mut W { self.variant(APORTSEL_A::APORT3X) }
    #[doc = "APORT3Y used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT3XCH0."]
    #[inline(always)]
    pub fn aport3y(self) -> &'a mut W { self.variant(APORTSEL_A::APORT3Y) }
    #[doc = "APORT3X/Y used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT3XCH0."]
    #[inline(always)]
    pub fn aport3xy(self) -> &'a mut W { self.variant(APORTSEL_A::APORT3XY) }
    #[doc = "APORT4X used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT4YCH0."]
    #[inline(always)]
    pub fn aport4x(self) -> &'a mut W { self.variant(APORTSEL_A::APORT4X) }
    #[doc = "APORT4Y used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT4YCH0."]
    #[inline(always)]
    pub fn aport4y(self) -> &'a mut W { self.variant(APORTSEL_A::APORT4Y) }
    #[doc = "APORT4Y/X used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT4YCH0."]
    #[inline(always)]
    pub fn aport4yx(self) -> &'a mut W { self.variant(APORTSEL_A::APORT4YX) }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub unsafe fn bits(self, value: u8) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x0f << 4)) | (((value as u32) & 0x0f) << 4);
        self.w
    }
}
impl R {
    #[doc = "Bit 0 - Enable External Interface"]
    #[inline(always)]
    pub fn en(&self) -> EN_R { EN_R::new((self.bits & 0x01) != 0) }
    #[doc = "Bits 4:7 - APORT Selection for External Interface"]
    #[inline(always)]
    pub fn aportsel(&self) -> APORTSEL_R { APORTSEL_R::new(((self.bits >> 4) & 0x0f) as u8) }
}
impl W {
    #[doc = "Bit 0 - Enable External Interface"]
    #[inline(always)]
    pub fn en(&mut self) -> EN_W { EN_W { w: self } }
    #[doc = "Bits 4:7 - APORT Selection for External Interface"]
    #[inline(always)]
    pub fn aportsel(&mut self) -> APORTSEL_W { APORTSEL_W { w: self } }
}