esp32p4/mcpwm0/
fault_detect.rs

1#[doc = "Register `FAULT_DETECT` reader"]
2pub type R = crate::R<FAULT_DETECT_SPEC>;
3#[doc = "Register `FAULT_DETECT` writer"]
4pub type W = crate::W<FAULT_DETECT_SPEC>;
5#[doc = "Field `F0_EN` reader - Configures whether or not to enable event_f0 generation.\\\\0: Disable\\\\1: Enable"]
6pub type F0_EN_R = crate::BitReader;
7#[doc = "Field `F0_EN` writer - Configures whether or not to enable event_f0 generation.\\\\0: Disable\\\\1: Enable"]
8pub type F0_EN_W<'a, REG> = crate::BitWriter<'a, REG>;
9#[doc = "Field `F1_EN` reader - Configures whether or not to enable event_f1 generation.\\\\0: Disable\\\\1: Enable"]
10pub type F1_EN_R = crate::BitReader;
11#[doc = "Field `F1_EN` writer - Configures whether or not to enable event_f1 generation.\\\\0: Disable\\\\1: Enable"]
12pub type F1_EN_W<'a, REG> = crate::BitWriter<'a, REG>;
13#[doc = "Field `F2_EN` reader - Configures whether or not to enable event_f2 generation.\\\\0: Disable\\\\1: Enable"]
14pub type F2_EN_R = crate::BitReader;
15#[doc = "Field `F2_EN` writer - Configures whether or not to enable event_f2 generation.\\\\0: Disable\\\\1: Enable"]
16pub type F2_EN_W<'a, REG> = crate::BitWriter<'a, REG>;
17#[doc = "Field `F0_POLE` reader - Configures event_f0 trigger polarity on FAULT0 source from GPIO matrix.\\\\0: Level low\\\\1: Level high"]
18pub type F0_POLE_R = crate::BitReader;
19#[doc = "Field `F0_POLE` writer - Configures event_f0 trigger polarity on FAULT0 source from GPIO matrix.\\\\0: Level low\\\\1: Level high"]
20pub type F0_POLE_W<'a, REG> = crate::BitWriter<'a, REG>;
21#[doc = "Field `F1_POLE` reader - Configures event_f1 trigger polarity on FAULT1 source from GPIO matrix.\\\\0: Level low\\\\1: Level high"]
22pub type F1_POLE_R = crate::BitReader;
23#[doc = "Field `F1_POLE` writer - Configures event_f1 trigger polarity on FAULT1 source from GPIO matrix.\\\\0: Level low\\\\1: Level high"]
24pub type F1_POLE_W<'a, REG> = crate::BitWriter<'a, REG>;
25#[doc = "Field `F2_POLE` reader - Configures event_f2 trigger polarity on FAULT2 source from GPIO matrix.\\\\0: Level low\\\\1: Level high"]
26pub type F2_POLE_R = crate::BitReader;
27#[doc = "Field `F2_POLE` writer - Configures event_f2 trigger polarity on FAULT2 source from GPIO matrix.\\\\0: Level low\\\\1: Level high"]
28pub type F2_POLE_W<'a, REG> = crate::BitWriter<'a, REG>;
29#[doc = "Field `EVENT_F0` reader - Represents whether or not an event_f0 is on going.\\\\0: No action\\\\1: On going"]
30pub type EVENT_F0_R = crate::BitReader;
31#[doc = "Field `EVENT_F1` reader - Represents whether or not an event_f1 is on going.\\\\0: No action\\\\1: On going"]
32pub type EVENT_F1_R = crate::BitReader;
33#[doc = "Field `EVENT_F2` reader - Represents whether or not an event_f2 is on going.\\\\0: No action\\\\1: On going"]
34pub type EVENT_F2_R = crate::BitReader;
35impl R {
36    #[doc = "Bit 0 - Configures whether or not to enable event_f0 generation.\\\\0: Disable\\\\1: Enable"]
37    #[inline(always)]
38    pub fn f0_en(&self) -> F0_EN_R {
39        F0_EN_R::new((self.bits & 1) != 0)
40    }
41    #[doc = "Bit 1 - Configures whether or not to enable event_f1 generation.\\\\0: Disable\\\\1: Enable"]
42    #[inline(always)]
43    pub fn f1_en(&self) -> F1_EN_R {
44        F1_EN_R::new(((self.bits >> 1) & 1) != 0)
45    }
46    #[doc = "Bit 2 - Configures whether or not to enable event_f2 generation.\\\\0: Disable\\\\1: Enable"]
47    #[inline(always)]
48    pub fn f2_en(&self) -> F2_EN_R {
49        F2_EN_R::new(((self.bits >> 2) & 1) != 0)
50    }
51    #[doc = "Bit 3 - Configures event_f0 trigger polarity on FAULT0 source from GPIO matrix.\\\\0: Level low\\\\1: Level high"]
52    #[inline(always)]
53    pub fn f0_pole(&self) -> F0_POLE_R {
54        F0_POLE_R::new(((self.bits >> 3) & 1) != 0)
55    }
56    #[doc = "Bit 4 - Configures event_f1 trigger polarity on FAULT1 source from GPIO matrix.\\\\0: Level low\\\\1: Level high"]
57    #[inline(always)]
58    pub fn f1_pole(&self) -> F1_POLE_R {
59        F1_POLE_R::new(((self.bits >> 4) & 1) != 0)
60    }
61    #[doc = "Bit 5 - Configures event_f2 trigger polarity on FAULT2 source from GPIO matrix.\\\\0: Level low\\\\1: Level high"]
62    #[inline(always)]
63    pub fn f2_pole(&self) -> F2_POLE_R {
64        F2_POLE_R::new(((self.bits >> 5) & 1) != 0)
65    }
66    #[doc = "Bit 6 - Represents whether or not an event_f0 is on going.\\\\0: No action\\\\1: On going"]
67    #[inline(always)]
68    pub fn event_f0(&self) -> EVENT_F0_R {
69        EVENT_F0_R::new(((self.bits >> 6) & 1) != 0)
70    }
71    #[doc = "Bit 7 - Represents whether or not an event_f1 is on going.\\\\0: No action\\\\1: On going"]
72    #[inline(always)]
73    pub fn event_f1(&self) -> EVENT_F1_R {
74        EVENT_F1_R::new(((self.bits >> 7) & 1) != 0)
75    }
76    #[doc = "Bit 8 - Represents whether or not an event_f2 is on going.\\\\0: No action\\\\1: On going"]
77    #[inline(always)]
78    pub fn event_f2(&self) -> EVENT_F2_R {
79        EVENT_F2_R::new(((self.bits >> 8) & 1) != 0)
80    }
81}
82#[cfg(feature = "impl-register-debug")]
83impl core::fmt::Debug for R {
84    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
85        f.debug_struct("FAULT_DETECT")
86            .field("f0_en", &format_args!("{}", self.f0_en().bit()))
87            .field("f1_en", &format_args!("{}", self.f1_en().bit()))
88            .field("f2_en", &format_args!("{}", self.f2_en().bit()))
89            .field("f0_pole", &format_args!("{}", self.f0_pole().bit()))
90            .field("f1_pole", &format_args!("{}", self.f1_pole().bit()))
91            .field("f2_pole", &format_args!("{}", self.f2_pole().bit()))
92            .field("event_f0", &format_args!("{}", self.event_f0().bit()))
93            .field("event_f1", &format_args!("{}", self.event_f1().bit()))
94            .field("event_f2", &format_args!("{}", self.event_f2().bit()))
95            .finish()
96    }
97}
98#[cfg(feature = "impl-register-debug")]
99impl core::fmt::Debug for crate::generic::Reg<FAULT_DETECT_SPEC> {
100    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
101        core::fmt::Debug::fmt(&self.read(), f)
102    }
103}
104impl W {
105    #[doc = "Bit 0 - Configures whether or not to enable event_f0 generation.\\\\0: Disable\\\\1: Enable"]
106    #[inline(always)]
107    #[must_use]
108    pub fn f0_en(&mut self) -> F0_EN_W<FAULT_DETECT_SPEC> {
109        F0_EN_W::new(self, 0)
110    }
111    #[doc = "Bit 1 - Configures whether or not to enable event_f1 generation.\\\\0: Disable\\\\1: Enable"]
112    #[inline(always)]
113    #[must_use]
114    pub fn f1_en(&mut self) -> F1_EN_W<FAULT_DETECT_SPEC> {
115        F1_EN_W::new(self, 1)
116    }
117    #[doc = "Bit 2 - Configures whether or not to enable event_f2 generation.\\\\0: Disable\\\\1: Enable"]
118    #[inline(always)]
119    #[must_use]
120    pub fn f2_en(&mut self) -> F2_EN_W<FAULT_DETECT_SPEC> {
121        F2_EN_W::new(self, 2)
122    }
123    #[doc = "Bit 3 - Configures event_f0 trigger polarity on FAULT0 source from GPIO matrix.\\\\0: Level low\\\\1: Level high"]
124    #[inline(always)]
125    #[must_use]
126    pub fn f0_pole(&mut self) -> F0_POLE_W<FAULT_DETECT_SPEC> {
127        F0_POLE_W::new(self, 3)
128    }
129    #[doc = "Bit 4 - Configures event_f1 trigger polarity on FAULT1 source from GPIO matrix.\\\\0: Level low\\\\1: Level high"]
130    #[inline(always)]
131    #[must_use]
132    pub fn f1_pole(&mut self) -> F1_POLE_W<FAULT_DETECT_SPEC> {
133        F1_POLE_W::new(self, 4)
134    }
135    #[doc = "Bit 5 - Configures event_f2 trigger polarity on FAULT2 source from GPIO matrix.\\\\0: Level low\\\\1: Level high"]
136    #[inline(always)]
137    #[must_use]
138    pub fn f2_pole(&mut self) -> F2_POLE_W<FAULT_DETECT_SPEC> {
139        F2_POLE_W::new(self, 5)
140    }
141}
142#[doc = "Fault detection configuration and status register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`fault_detect::R`](R).  You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`fault_detect::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
143pub struct FAULT_DETECT_SPEC;
144impl crate::RegisterSpec for FAULT_DETECT_SPEC {
145    type Ux = u32;
146}
147#[doc = "`read()` method returns [`fault_detect::R`](R) reader structure"]
148impl crate::Readable for FAULT_DETECT_SPEC {}
149#[doc = "`write(|w| ..)` method takes [`fault_detect::W`](W) writer structure"]
150impl crate::Writable for FAULT_DETECT_SPEC {
151    type Safety = crate::Unsafe;
152    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
153    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
154}
155#[doc = "`reset()` method sets FAULT_DETECT to value 0"]
156impl crate::Resettable for FAULT_DETECT_SPEC {
157    const RESET_VALUE: u32 = 0;
158}