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
#[doc = "Reader of register FCTRL0"]
pub type R = crate::R<u16, super::FCTRL0>;
#[doc = "Writer for register FCTRL0"]
pub type W = crate::W<u16, super::FCTRL0>;
#[doc = "Register FCTRL0 `reset()`'s with value 0"]
impl crate::ResetValue for super::FCTRL0 {
    type Type = u16;
    #[inline(always)]
    fn reset_value() -> Self::Type {
        0
    }
}
#[doc = "Fault Interrupt Enables\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum FIE_A {
    #[doc = "0: FAULTx CPU interrupt requests disabled."]
    FIE_0 = 0,
    #[doc = "1: FAULTx CPU interrupt requests enabled."]
    FIE_1 = 1,
}
impl From<FIE_A> for u8 {
    #[inline(always)]
    fn from(variant: FIE_A) -> Self {
        variant as _
    }
}
#[doc = "Reader of field `FIE`"]
pub type FIE_R = crate::R<u8, FIE_A>;
impl FIE_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> crate::Variant<u8, FIE_A> {
        use crate::Variant::*;
        match self.bits {
            0 => Val(FIE_A::FIE_0),
            1 => Val(FIE_A::FIE_1),
            i => Res(i),
        }
    }
    #[doc = "Checks if the value of the field is `FIE_0`"]
    #[inline(always)]
    pub fn is_fie_0(&self) -> bool {
        *self == FIE_A::FIE_0
    }
    #[doc = "Checks if the value of the field is `FIE_1`"]
    #[inline(always)]
    pub fn is_fie_1(&self) -> bool {
        *self == FIE_A::FIE_1
    }
}
#[doc = "Write proxy for field `FIE`"]
pub struct FIE_W<'a> {
    w: &'a mut W,
}
impl<'a> FIE_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: FIE_A) -> &'a mut W {
        unsafe { self.bits(variant.into()) }
    }
    #[doc = "FAULTx CPU interrupt requests disabled."]
    #[inline(always)]
    pub fn fie_0(self) -> &'a mut W {
        self.variant(FIE_A::FIE_0)
    }
    #[doc = "FAULTx CPU interrupt requests enabled."]
    #[inline(always)]
    pub fn fie_1(self) -> &'a mut W {
        self.variant(FIE_A::FIE_1)
    }
    #[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) | ((value as u16) & 0x0f);
        self.w
    }
}
#[doc = "Fault Safety Mode\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum FSAFE_A {
    #[doc = "0: Normal mode. PWM outputs disabled by this fault are not enabled until FSTS\\[FFLAGx\\]
is clear at the start of a half cycle or full cycle depending on the state of FSTS\\[FFULL\\]
without regard to the state of FSTS\\[FFPINx\\]. The PWM outputs disabled by this fault input will not be re-enabled until the actual FAULTx input signal de-asserts since the fault input will combinationally disable the PWM outputs (as programmed in DISMAPn)."]
    FSAFE_0 = 0,
    #[doc = "1: Safe mode. PWM outputs disabled by this fault are not enabled until FSTS\\[FFLAGx\\]
is clear and FSTS\\[FFPINx\\]
is clear at the start of a half cycle or full cycle depending on the state of FSTS\\[FFULL\\]."]
    FSAFE_1 = 1,
}
impl From<FSAFE_A> for u8 {
    #[inline(always)]
    fn from(variant: FSAFE_A) -> Self {
        variant as _
    }
}
#[doc = "Reader of field `FSAFE`"]
pub type FSAFE_R = crate::R<u8, FSAFE_A>;
impl FSAFE_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> crate::Variant<u8, FSAFE_A> {
        use crate::Variant::*;
        match self.bits {
            0 => Val(FSAFE_A::FSAFE_0),
            1 => Val(FSAFE_A::FSAFE_1),
            i => Res(i),
        }
    }
    #[doc = "Checks if the value of the field is `FSAFE_0`"]
    #[inline(always)]
    pub fn is_fsafe_0(&self) -> bool {
        *self == FSAFE_A::FSAFE_0
    }
    #[doc = "Checks if the value of the field is `FSAFE_1`"]
    #[inline(always)]
    pub fn is_fsafe_1(&self) -> bool {
        *self == FSAFE_A::FSAFE_1
    }
}
#[doc = "Write proxy for field `FSAFE`"]
pub struct FSAFE_W<'a> {
    w: &'a mut W,
}
impl<'a> FSAFE_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: FSAFE_A) -> &'a mut W {
        unsafe { self.bits(variant.into()) }
    }
    #[doc = "Normal mode. PWM outputs disabled by this fault are not enabled until FSTS\\[FFLAGx\\]
is clear at the start of a half cycle or full cycle depending on the state of FSTS\\[FFULL\\]
without regard to the state of FSTS\\[FFPINx\\]. The PWM outputs disabled by this fault input will not be re-enabled until the actual FAULTx input signal de-asserts since the fault input will combinationally disable the PWM outputs (as programmed in DISMAPn)."]
    #[inline(always)]
    pub fn fsafe_0(self) -> &'a mut W {
        self.variant(FSAFE_A::FSAFE_0)
    }
    #[doc = "Safe mode. PWM outputs disabled by this fault are not enabled until FSTS\\[FFLAGx\\]
is clear and FSTS\\[FFPINx\\]
is clear at the start of a half cycle or full cycle depending on the state of FSTS\\[FFULL\\]."]
    #[inline(always)]
    pub fn fsafe_1(self) -> &'a mut W {
        self.variant(FSAFE_A::FSAFE_1)
    }
    #[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 u16) & 0x0f) << 4);
        self.w
    }
}
#[doc = "Automatic Fault Clearing\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum FAUTO_A {
    #[doc = "0: Manual fault clearing. PWM outputs disabled by this fault are not enabled until FSTS\\[FFLAGx\\]
is clear at the start of a half cycle or full cycle depending the state of FSTS\\[FFULL\\]. This is further controlled by FCTRL\\[FSAFE\\]."]
    FAUTO_0 = 0,
    #[doc = "1: Automatic fault clearing. PWM outputs disabled by this fault are enabled when FSTS\\[FFPINx\\]
is clear at the start of a half cycle or full cycle depending on the state of FSTS\\[FFULL\\]
without regard to the state of FSTS\\[FFLAGx\\]."]
    FAUTO_1 = 1,
}
impl From<FAUTO_A> for u8 {
    #[inline(always)]
    fn from(variant: FAUTO_A) -> Self {
        variant as _
    }
}
#[doc = "Reader of field `FAUTO`"]
pub type FAUTO_R = crate::R<u8, FAUTO_A>;
impl FAUTO_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> crate::Variant<u8, FAUTO_A> {
        use crate::Variant::*;
        match self.bits {
            0 => Val(FAUTO_A::FAUTO_0),
            1 => Val(FAUTO_A::FAUTO_1),
            i => Res(i),
        }
    }
    #[doc = "Checks if the value of the field is `FAUTO_0`"]
    #[inline(always)]
    pub fn is_fauto_0(&self) -> bool {
        *self == FAUTO_A::FAUTO_0
    }
    #[doc = "Checks if the value of the field is `FAUTO_1`"]
    #[inline(always)]
    pub fn is_fauto_1(&self) -> bool {
        *self == FAUTO_A::FAUTO_1
    }
}
#[doc = "Write proxy for field `FAUTO`"]
pub struct FAUTO_W<'a> {
    w: &'a mut W,
}
impl<'a> FAUTO_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: FAUTO_A) -> &'a mut W {
        unsafe { self.bits(variant.into()) }
    }
    #[doc = "Manual fault clearing. PWM outputs disabled by this fault are not enabled until FSTS\\[FFLAGx\\]
is clear at the start of a half cycle or full cycle depending the state of FSTS\\[FFULL\\]. This is further controlled by FCTRL\\[FSAFE\\]."]
    #[inline(always)]
    pub fn fauto_0(self) -> &'a mut W {
        self.variant(FAUTO_A::FAUTO_0)
    }
    #[doc = "Automatic fault clearing. PWM outputs disabled by this fault are enabled when FSTS\\[FFPINx\\]
is clear at the start of a half cycle or full cycle depending on the state of FSTS\\[FFULL\\]
without regard to the state of FSTS\\[FFLAGx\\]."]
    #[inline(always)]
    pub fn fauto_1(self) -> &'a mut W {
        self.variant(FAUTO_A::FAUTO_1)
    }
    #[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 << 8)) | (((value as u16) & 0x0f) << 8);
        self.w
    }
}
#[doc = "Fault Level\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum FLVL_A {
    #[doc = "0: A logic 0 on the fault input indicates a fault condition."]
    FLVL_0 = 0,
    #[doc = "1: A logic 1 on the fault input indicates a fault condition."]
    FLVL_1 = 1,
}
impl From<FLVL_A> for u8 {
    #[inline(always)]
    fn from(variant: FLVL_A) -> Self {
        variant as _
    }
}
#[doc = "Reader of field `FLVL`"]
pub type FLVL_R = crate::R<u8, FLVL_A>;
impl FLVL_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> crate::Variant<u8, FLVL_A> {
        use crate::Variant::*;
        match self.bits {
            0 => Val(FLVL_A::FLVL_0),
            1 => Val(FLVL_A::FLVL_1),
            i => Res(i),
        }
    }
    #[doc = "Checks if the value of the field is `FLVL_0`"]
    #[inline(always)]
    pub fn is_flvl_0(&self) -> bool {
        *self == FLVL_A::FLVL_0
    }
    #[doc = "Checks if the value of the field is `FLVL_1`"]
    #[inline(always)]
    pub fn is_flvl_1(&self) -> bool {
        *self == FLVL_A::FLVL_1
    }
}
#[doc = "Write proxy for field `FLVL`"]
pub struct FLVL_W<'a> {
    w: &'a mut W,
}
impl<'a> FLVL_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: FLVL_A) -> &'a mut W {
        unsafe { self.bits(variant.into()) }
    }
    #[doc = "A logic 0 on the fault input indicates a fault condition."]
    #[inline(always)]
    pub fn flvl_0(self) -> &'a mut W {
        self.variant(FLVL_A::FLVL_0)
    }
    #[doc = "A logic 1 on the fault input indicates a fault condition."]
    #[inline(always)]
    pub fn flvl_1(self) -> &'a mut W {
        self.variant(FLVL_A::FLVL_1)
    }
    #[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 << 12)) | (((value as u16) & 0x0f) << 12);
        self.w
    }
}
impl R {
    #[doc = "Bits 0:3 - Fault Interrupt Enables"]
    #[inline(always)]
    pub fn fie(&self) -> FIE_R {
        FIE_R::new((self.bits & 0x0f) as u8)
    }
    #[doc = "Bits 4:7 - Fault Safety Mode"]
    #[inline(always)]
    pub fn fsafe(&self) -> FSAFE_R {
        FSAFE_R::new(((self.bits >> 4) & 0x0f) as u8)
    }
    #[doc = "Bits 8:11 - Automatic Fault Clearing"]
    #[inline(always)]
    pub fn fauto(&self) -> FAUTO_R {
        FAUTO_R::new(((self.bits >> 8) & 0x0f) as u8)
    }
    #[doc = "Bits 12:15 - Fault Level"]
    #[inline(always)]
    pub fn flvl(&self) -> FLVL_R {
        FLVL_R::new(((self.bits >> 12) & 0x0f) as u8)
    }
}
impl W {
    #[doc = "Bits 0:3 - Fault Interrupt Enables"]
    #[inline(always)]
    pub fn fie(&mut self) -> FIE_W {
        FIE_W { w: self }
    }
    #[doc = "Bits 4:7 - Fault Safety Mode"]
    #[inline(always)]
    pub fn fsafe(&mut self) -> FSAFE_W {
        FSAFE_W { w: self }
    }
    #[doc = "Bits 8:11 - Automatic Fault Clearing"]
    #[inline(always)]
    pub fn fauto(&mut self) -> FAUTO_W {
        FAUTO_W { w: self }
    }
    #[doc = "Bits 12:15 - Fault Level"]
    #[inline(always)]
    pub fn flvl(&mut self) -> FLVL_W {
        FLVL_W { w: self }
    }
}