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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
#[doc = "Reader of register PRESETCTRL"]
pub type R = crate::R<u32, super::PRESETCTRL>;
#[doc = "Writer for register PRESETCTRL"]
pub type W = crate::W<u32, super::PRESETCTRL>;
#[doc = "Register PRESETCTRL `reset()`'s with value 0"]
impl crate::ResetValue for super::PRESETCTRL {
    type Type = u32;
    #[inline(always)]
    fn reset_value() -> Self::Type {
        0
    }
}
#[doc = "SPI0 reset control.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum SSP0_RST_N_A {
    #[doc = "0: Resets the SPI0 peripheral"]
    SPIO0RESET,
    #[doc = "1: SPI0 reset de-asserted"]
    SPIO0NORESET,
}
impl From<SSP0_RST_N_A> for bool {
    #[inline(always)]
    fn from(variant: SSP0_RST_N_A) -> Self {
        match variant {
            SSP0_RST_N_A::SPIO0RESET => false,
            SSP0_RST_N_A::SPIO0NORESET => true,
        }
    }
}
#[doc = "Reader of field `SSP0_RST_N`"]
pub type SSP0_RST_N_R = crate::R<bool, SSP0_RST_N_A>;
impl SSP0_RST_N_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> SSP0_RST_N_A {
        match self.bits {
            false => SSP0_RST_N_A::SPIO0RESET,
            true => SSP0_RST_N_A::SPIO0NORESET,
        }
    }
    #[doc = "Checks if the value of the field is `SPIO0RESET`"]
    #[inline(always)]
    pub fn is_spio0reset(&self) -> bool {
        *self == SSP0_RST_N_A::SPIO0RESET
    }
    #[doc = "Checks if the value of the field is `SPIO0NORESET`"]
    #[inline(always)]
    pub fn is_spio0noreset(&self) -> bool {
        *self == SSP0_RST_N_A::SPIO0NORESET
    }
}
#[doc = "Write proxy for field `SSP0_RST_N`"]
pub struct SSP0_RST_N_W<'a> {
    w: &'a mut W,
}
impl<'a> SSP0_RST_N_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: SSP0_RST_N_A) -> &'a mut W {
        {
            self.bit(variant.into())
        }
    }
    #[doc = "Resets the SPI0 peripheral"]
    #[inline(always)]
    pub fn spio0reset(self) -> &'a mut W {
        self.variant(SSP0_RST_N_A::SPIO0RESET)
    }
    #[doc = "SPI0 reset de-asserted"]
    #[inline(always)]
    pub fn spio0noreset(self) -> &'a mut W {
        self.variant(SSP0_RST_N_A::SPIO0NORESET)
    }
    #[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 = "I2C reset control.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum I2C_RST_N_A {
    #[doc = "0: Resets the I2C peripheral"]
    I2CRESET,
    #[doc = "1: I2C reset de-asserted"]
    I2CNORESET,
}
impl From<I2C_RST_N_A> for bool {
    #[inline(always)]
    fn from(variant: I2C_RST_N_A) -> Self {
        match variant {
            I2C_RST_N_A::I2CRESET => false,
            I2C_RST_N_A::I2CNORESET => true,
        }
    }
}
#[doc = "Reader of field `I2C_RST_N`"]
pub type I2C_RST_N_R = crate::R<bool, I2C_RST_N_A>;
impl I2C_RST_N_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> I2C_RST_N_A {
        match self.bits {
            false => I2C_RST_N_A::I2CRESET,
            true => I2C_RST_N_A::I2CNORESET,
        }
    }
    #[doc = "Checks if the value of the field is `I2CRESET`"]
    #[inline(always)]
    pub fn is_i2creset(&self) -> bool {
        *self == I2C_RST_N_A::I2CRESET
    }
    #[doc = "Checks if the value of the field is `I2CNORESET`"]
    #[inline(always)]
    pub fn is_i2cnoreset(&self) -> bool {
        *self == I2C_RST_N_A::I2CNORESET
    }
}
#[doc = "Write proxy for field `I2C_RST_N`"]
pub struct I2C_RST_N_W<'a> {
    w: &'a mut W,
}
impl<'a> I2C_RST_N_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: I2C_RST_N_A) -> &'a mut W {
        {
            self.bit(variant.into())
        }
    }
    #[doc = "Resets the I2C peripheral"]
    #[inline(always)]
    pub fn i2creset(self) -> &'a mut W {
        self.variant(I2C_RST_N_A::I2CRESET)
    }
    #[doc = "I2C reset de-asserted"]
    #[inline(always)]
    pub fn i2cnoreset(self) -> &'a mut W {
        self.variant(I2C_RST_N_A::I2CNORESET)
    }
    #[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 << 1)) | (((value as u32) & 0x01) << 1);
        self.w
    }
}
#[doc = "SPI1 reset control.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum SSP1_RST_N_A {
    #[doc = "0: Resets the SPI1 peripheral"]
    SPI1RESET,
    #[doc = "1: SPI1 reset de-asserted"]
    SPI2NORESET,
}
impl From<SSP1_RST_N_A> for bool {
    #[inline(always)]
    fn from(variant: SSP1_RST_N_A) -> Self {
        match variant {
            SSP1_RST_N_A::SPI1RESET => false,
            SSP1_RST_N_A::SPI2NORESET => true,
        }
    }
}
#[doc = "Reader of field `SSP1_RST_N`"]
pub type SSP1_RST_N_R = crate::R<bool, SSP1_RST_N_A>;
impl SSP1_RST_N_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> SSP1_RST_N_A {
        match self.bits {
            false => SSP1_RST_N_A::SPI1RESET,
            true => SSP1_RST_N_A::SPI2NORESET,
        }
    }
    #[doc = "Checks if the value of the field is `SPI1RESET`"]
    #[inline(always)]
    pub fn is_spi1reset(&self) -> bool {
        *self == SSP1_RST_N_A::SPI1RESET
    }
    #[doc = "Checks if the value of the field is `SPI2NORESET`"]
    #[inline(always)]
    pub fn is_spi2noreset(&self) -> bool {
        *self == SSP1_RST_N_A::SPI2NORESET
    }
}
#[doc = "Write proxy for field `SSP1_RST_N`"]
pub struct SSP1_RST_N_W<'a> {
    w: &'a mut W,
}
impl<'a> SSP1_RST_N_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: SSP1_RST_N_A) -> &'a mut W {
        {
            self.bit(variant.into())
        }
    }
    #[doc = "Resets the SPI1 peripheral"]
    #[inline(always)]
    pub fn spi1reset(self) -> &'a mut W {
        self.variant(SSP1_RST_N_A::SPI1RESET)
    }
    #[doc = "SPI1 reset de-asserted"]
    #[inline(always)]
    pub fn spi2noreset(self) -> &'a mut W {
        self.variant(SSP1_RST_N_A::SPI2NORESET)
    }
    #[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 << 2)) | (((value as u32) & 0x01) << 2);
        self.w
    }
}
#[doc = "C_CAN reset control. See Section 3.1 for part specific details.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum CAN_RST_N_A {
    #[doc = "0: Resets the C_CAN peripheral"]
    CANRESET,
    #[doc = "1: C_CAN reset de-asserted"]
    CANNORESET,
}
impl From<CAN_RST_N_A> for bool {
    #[inline(always)]
    fn from(variant: CAN_RST_N_A) -> Self {
        match variant {
            CAN_RST_N_A::CANRESET => false,
            CAN_RST_N_A::CANNORESET => true,
        }
    }
}
#[doc = "Reader of field `CAN_RST_N`"]
pub type CAN_RST_N_R = crate::R<bool, CAN_RST_N_A>;
impl CAN_RST_N_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> CAN_RST_N_A {
        match self.bits {
            false => CAN_RST_N_A::CANRESET,
            true => CAN_RST_N_A::CANNORESET,
        }
    }
    #[doc = "Checks if the value of the field is `CANRESET`"]
    #[inline(always)]
    pub fn is_canreset(&self) -> bool {
        *self == CAN_RST_N_A::CANRESET
    }
    #[doc = "Checks if the value of the field is `CANNORESET`"]
    #[inline(always)]
    pub fn is_cannoreset(&self) -> bool {
        *self == CAN_RST_N_A::CANNORESET
    }
}
#[doc = "Write proxy for field `CAN_RST_N`"]
pub struct CAN_RST_N_W<'a> {
    w: &'a mut W,
}
impl<'a> CAN_RST_N_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: CAN_RST_N_A) -> &'a mut W {
        {
            self.bit(variant.into())
        }
    }
    #[doc = "Resets the C_CAN peripheral"]
    #[inline(always)]
    pub fn canreset(self) -> &'a mut W {
        self.variant(CAN_RST_N_A::CANRESET)
    }
    #[doc = "C_CAN reset de-asserted"]
    #[inline(always)]
    pub fn cannoreset(self) -> &'a mut W {
        self.variant(CAN_RST_N_A::CANNORESET)
    }
    #[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 << 3)) | (((value as u32) & 0x01) << 3);
        self.w
    }
}
impl R {
    #[doc = "Bit 0 - SPI0 reset control."]
    #[inline(always)]
    pub fn ssp0_rst_n(&self) -> SSP0_RST_N_R {
        SSP0_RST_N_R::new((self.bits & 0x01) != 0)
    }
    #[doc = "Bit 1 - I2C reset control."]
    #[inline(always)]
    pub fn i2c_rst_n(&self) -> I2C_RST_N_R {
        I2C_RST_N_R::new(((self.bits >> 1) & 0x01) != 0)
    }
    #[doc = "Bit 2 - SPI1 reset control."]
    #[inline(always)]
    pub fn ssp1_rst_n(&self) -> SSP1_RST_N_R {
        SSP1_RST_N_R::new(((self.bits >> 2) & 0x01) != 0)
    }
    #[doc = "Bit 3 - C_CAN reset control. See Section 3.1 for part specific details."]
    #[inline(always)]
    pub fn can_rst_n(&self) -> CAN_RST_N_R {
        CAN_RST_N_R::new(((self.bits >> 3) & 0x01) != 0)
    }
}
impl W {
    #[doc = "Bit 0 - SPI0 reset control."]
    #[inline(always)]
    pub fn ssp0_rst_n(&mut self) -> SSP0_RST_N_W {
        SSP0_RST_N_W { w: self }
    }
    #[doc = "Bit 1 - I2C reset control."]
    #[inline(always)]
    pub fn i2c_rst_n(&mut self) -> I2C_RST_N_W {
        I2C_RST_N_W { w: self }
    }
    #[doc = "Bit 2 - SPI1 reset control."]
    #[inline(always)]
    pub fn ssp1_rst_n(&mut self) -> SSP1_RST_N_W {
        SSP1_RST_N_W { w: self }
    }
    #[doc = "Bit 3 - C_CAN reset control. See Section 3.1 for part specific details."]
    #[inline(always)]
    pub fn can_rst_n(&mut self) -> CAN_RST_N_W {
        CAN_RST_N_W { w: self }
    }
}