stm32g4/stm32g431/exti/
ftsr2.rs

1#[doc = "Register `FTSR2` reader"]
2pub struct R(crate::R<FTSR2_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<FTSR2_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<FTSR2_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<FTSR2_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `FTSR2` writer"]
17pub struct W(crate::W<FTSR2_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<FTSR2_SPEC>;
20    #[inline(always)]
21    fn deref(&self) -> &Self::Target {
22        &self.0
23    }
24}
25impl core::ops::DerefMut for W {
26    #[inline(always)]
27    fn deref_mut(&mut self) -> &mut Self::Target {
28        &mut self.0
29    }
30}
31impl From<crate::W<FTSR2_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<FTSR2_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Falling trigger event configuration of line 32\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39pub enum FT32_A {
40    #[doc = "0: Falling edge trigger is disabled"]
41    Disabled = 0,
42    #[doc = "1: Falling edge trigger is enabled"]
43    Enabled = 1,
44}
45impl From<FT32_A> for bool {
46    #[inline(always)]
47    fn from(variant: FT32_A) -> Self {
48        variant as u8 != 0
49    }
50}
51#[doc = "Field `FT32` reader - Falling trigger event configuration of line 32"]
52pub type FT32_R = crate::BitReader<FT32_A>;
53impl FT32_R {
54    #[doc = "Get enumerated values variant"]
55    #[inline(always)]
56    pub fn variant(&self) -> FT32_A {
57        match self.bits {
58            false => FT32_A::Disabled,
59            true => FT32_A::Enabled,
60        }
61    }
62    #[doc = "Checks if the value of the field is `Disabled`"]
63    #[inline(always)]
64    pub fn is_disabled(&self) -> bool {
65        *self == FT32_A::Disabled
66    }
67    #[doc = "Checks if the value of the field is `Enabled`"]
68    #[inline(always)]
69    pub fn is_enabled(&self) -> bool {
70        *self == FT32_A::Enabled
71    }
72}
73#[doc = "Field `FT32` writer - Falling trigger event configuration of line 32"]
74pub type FT32_W<'a, const O: u8> = crate::BitWriter<'a, u32, FTSR2_SPEC, FT32_A, O>;
75impl<'a, const O: u8> FT32_W<'a, O> {
76    #[doc = "Falling edge trigger is disabled"]
77    #[inline(always)]
78    pub fn disabled(self) -> &'a mut W {
79        self.variant(FT32_A::Disabled)
80    }
81    #[doc = "Falling edge trigger is enabled"]
82    #[inline(always)]
83    pub fn enabled(self) -> &'a mut W {
84        self.variant(FT32_A::Enabled)
85    }
86}
87#[doc = "Falling trigger event configuration of line 33"]
88pub use FT32_A as FT33_A;
89#[doc = "Falling trigger event configuration of line 40"]
90pub use FT32_A as FT40_A;
91#[doc = "Falling trigger event configuration of line 41"]
92pub use FT32_A as FT41_A;
93#[doc = "Field `FT33` reader - Falling trigger event configuration of line 33"]
94pub use FT32_R as FT33_R;
95#[doc = "Field `FT40` reader - Falling trigger event configuration of line 40"]
96pub use FT32_R as FT40_R;
97#[doc = "Field `FT41` reader - Falling trigger event configuration of line 41"]
98pub use FT32_R as FT41_R;
99#[doc = "Field `FT33` writer - Falling trigger event configuration of line 33"]
100pub use FT32_W as FT33_W;
101#[doc = "Field `FT40` writer - Falling trigger event configuration of line 40"]
102pub use FT32_W as FT40_W;
103#[doc = "Field `FT41` writer - Falling trigger event configuration of line 41"]
104pub use FT32_W as FT41_W;
105impl R {
106    #[doc = "Bit 0 - Falling trigger event configuration of line 32"]
107    #[inline(always)]
108    pub fn ft32(&self) -> FT32_R {
109        FT32_R::new((self.bits & 1) != 0)
110    }
111    #[doc = "Bit 1 - Falling trigger event configuration of line 33"]
112    #[inline(always)]
113    pub fn ft33(&self) -> FT33_R {
114        FT33_R::new(((self.bits >> 1) & 1) != 0)
115    }
116    #[doc = "Bit 8 - Falling trigger event configuration of line 40"]
117    #[inline(always)]
118    pub fn ft40(&self) -> FT40_R {
119        FT40_R::new(((self.bits >> 8) & 1) != 0)
120    }
121    #[doc = "Bit 9 - Falling trigger event configuration of line 41"]
122    #[inline(always)]
123    pub fn ft41(&self) -> FT41_R {
124        FT41_R::new(((self.bits >> 9) & 1) != 0)
125    }
126}
127impl W {
128    #[doc = "Bit 0 - Falling trigger event configuration of line 32"]
129    #[inline(always)]
130    pub fn ft32(&mut self) -> FT32_W<0> {
131        FT32_W::new(self)
132    }
133    #[doc = "Bit 1 - Falling trigger event configuration of line 33"]
134    #[inline(always)]
135    pub fn ft33(&mut self) -> FT33_W<1> {
136        FT33_W::new(self)
137    }
138    #[doc = "Bit 8 - Falling trigger event configuration of line 40"]
139    #[inline(always)]
140    pub fn ft40(&mut self) -> FT40_W<8> {
141        FT40_W::new(self)
142    }
143    #[doc = "Bit 9 - Falling trigger event configuration of line 41"]
144    #[inline(always)]
145    pub fn ft41(&mut self) -> FT41_W<9> {
146        FT41_W::new(self)
147    }
148    #[doc = "Writes raw bits to the register."]
149    #[inline(always)]
150    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
151        self.0.bits(bits);
152        self
153    }
154}
155#[doc = "Falling Trigger selection register\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [ftsr2](index.html) module"]
156pub struct FTSR2_SPEC;
157impl crate::RegisterSpec for FTSR2_SPEC {
158    type Ux = u32;
159}
160#[doc = "`read()` method returns [ftsr2::R](R) reader structure"]
161impl crate::Readable for FTSR2_SPEC {
162    type Reader = R;
163}
164#[doc = "`write(|w| ..)` method takes [ftsr2::W](W) writer structure"]
165impl crate::Writable for FTSR2_SPEC {
166    type Writer = W;
167}
168#[doc = "`reset()` method sets FTSR2 to value 0"]
169impl crate::Resettable for FTSR2_SPEC {
170    #[inline(always)]
171    fn reset_value() -> Self::Ux {
172        0
173    }
174}