d1_pac/gpio/
pf_eint_status.rs

1#[doc = "Register `pf_eint_status` reader"]
2pub type R = crate::R<PF_EINT_STATUS_SPEC>;
3#[doc = "Register `pf_eint_status` writer"]
4pub type W = crate::W<PF_EINT_STATUS_SPEC>;
5#[doc = "Field `eint_status[0-6]` reader - External INT Pending Bit"]
6pub type EINT_STATUS_R = crate::BitReader<EINT_STATUS_A>;
7#[doc = "External INT Pending Bit\n\nValue on reset: 0"]
8#[derive(Clone, Copy, Debug, PartialEq, Eq)]
9pub enum EINT_STATUS_A {
10    #[doc = "0: `0`"]
11    NO_PENDING = 0,
12    #[doc = "1: `1`"]
13    PENDING = 1,
14}
15impl From<EINT_STATUS_A> for bool {
16    #[inline(always)]
17    fn from(variant: EINT_STATUS_A) -> Self {
18        variant as u8 != 0
19    }
20}
21impl EINT_STATUS_R {
22    #[doc = "Get enumerated values variant"]
23    #[inline(always)]
24    pub const fn variant(&self) -> EINT_STATUS_A {
25        match self.bits {
26            false => EINT_STATUS_A::NO_PENDING,
27            true => EINT_STATUS_A::PENDING,
28        }
29    }
30    #[doc = "`0`"]
31    #[inline(always)]
32    pub fn is_no_pending(&self) -> bool {
33        *self == EINT_STATUS_A::NO_PENDING
34    }
35    #[doc = "`1`"]
36    #[inline(always)]
37    pub fn is_pending(&self) -> bool {
38        *self == EINT_STATUS_A::PENDING
39    }
40}
41#[doc = "Field `eint_status[0-6]` writer - External INT Pending Bit"]
42pub type EINT_STATUS_W<'a, REG> = crate::BitWriter<'a, REG, EINT_STATUS_A>;
43impl<'a, REG> EINT_STATUS_W<'a, REG>
44where
45    REG: crate::Writable + crate::RegisterSpec,
46{
47    #[doc = "`0`"]
48    #[inline(always)]
49    pub fn no_pending(self) -> &'a mut crate::W<REG> {
50        self.variant(EINT_STATUS_A::NO_PENDING)
51    }
52    #[doc = "`1`"]
53    #[inline(always)]
54    pub fn pending(self) -> &'a mut crate::W<REG> {
55        self.variant(EINT_STATUS_A::PENDING)
56    }
57}
58impl R {
59    #[doc = "External INT Pending Bit\n\nNOTE: `n` is number of field in register. `n == 0` corresponds to `eint0_status` field"]
60    #[inline(always)]
61    pub fn eint_status(&self, n: u8) -> EINT_STATUS_R {
62        #[allow(clippy::no_effect)]
63        [(); 7][n as usize];
64        EINT_STATUS_R::new(((self.bits >> n) & 1) != 0)
65    }
66    #[doc = "Bit 0 - External INT Pending Bit"]
67    #[inline(always)]
68    pub fn eint0_status(&self) -> EINT_STATUS_R {
69        EINT_STATUS_R::new((self.bits & 1) != 0)
70    }
71    #[doc = "Bit 1 - External INT Pending Bit"]
72    #[inline(always)]
73    pub fn eint1_status(&self) -> EINT_STATUS_R {
74        EINT_STATUS_R::new(((self.bits >> 1) & 1) != 0)
75    }
76    #[doc = "Bit 2 - External INT Pending Bit"]
77    #[inline(always)]
78    pub fn eint2_status(&self) -> EINT_STATUS_R {
79        EINT_STATUS_R::new(((self.bits >> 2) & 1) != 0)
80    }
81    #[doc = "Bit 3 - External INT Pending Bit"]
82    #[inline(always)]
83    pub fn eint3_status(&self) -> EINT_STATUS_R {
84        EINT_STATUS_R::new(((self.bits >> 3) & 1) != 0)
85    }
86    #[doc = "Bit 4 - External INT Pending Bit"]
87    #[inline(always)]
88    pub fn eint4_status(&self) -> EINT_STATUS_R {
89        EINT_STATUS_R::new(((self.bits >> 4) & 1) != 0)
90    }
91    #[doc = "Bit 5 - External INT Pending Bit"]
92    #[inline(always)]
93    pub fn eint5_status(&self) -> EINT_STATUS_R {
94        EINT_STATUS_R::new(((self.bits >> 5) & 1) != 0)
95    }
96    #[doc = "Bit 6 - External INT Pending Bit"]
97    #[inline(always)]
98    pub fn eint6_status(&self) -> EINT_STATUS_R {
99        EINT_STATUS_R::new(((self.bits >> 6) & 1) != 0)
100    }
101}
102impl W {
103    #[doc = "External INT Pending Bit\n\nNOTE: `n` is number of field in register. `n == 0` corresponds to `eint0_status` field"]
104    #[inline(always)]
105    #[must_use]
106    pub fn eint_status(&mut self, n: u8) -> EINT_STATUS_W<PF_EINT_STATUS_SPEC> {
107        #[allow(clippy::no_effect)]
108        [(); 7][n as usize];
109        EINT_STATUS_W::new(self, n)
110    }
111    #[doc = "Bit 0 - External INT Pending Bit"]
112    #[inline(always)]
113    #[must_use]
114    pub fn eint0_status(&mut self) -> EINT_STATUS_W<PF_EINT_STATUS_SPEC> {
115        EINT_STATUS_W::new(self, 0)
116    }
117    #[doc = "Bit 1 - External INT Pending Bit"]
118    #[inline(always)]
119    #[must_use]
120    pub fn eint1_status(&mut self) -> EINT_STATUS_W<PF_EINT_STATUS_SPEC> {
121        EINT_STATUS_W::new(self, 1)
122    }
123    #[doc = "Bit 2 - External INT Pending Bit"]
124    #[inline(always)]
125    #[must_use]
126    pub fn eint2_status(&mut self) -> EINT_STATUS_W<PF_EINT_STATUS_SPEC> {
127        EINT_STATUS_W::new(self, 2)
128    }
129    #[doc = "Bit 3 - External INT Pending Bit"]
130    #[inline(always)]
131    #[must_use]
132    pub fn eint3_status(&mut self) -> EINT_STATUS_W<PF_EINT_STATUS_SPEC> {
133        EINT_STATUS_W::new(self, 3)
134    }
135    #[doc = "Bit 4 - External INT Pending Bit"]
136    #[inline(always)]
137    #[must_use]
138    pub fn eint4_status(&mut self) -> EINT_STATUS_W<PF_EINT_STATUS_SPEC> {
139        EINT_STATUS_W::new(self, 4)
140    }
141    #[doc = "Bit 5 - External INT Pending Bit"]
142    #[inline(always)]
143    #[must_use]
144    pub fn eint5_status(&mut self) -> EINT_STATUS_W<PF_EINT_STATUS_SPEC> {
145        EINT_STATUS_W::new(self, 5)
146    }
147    #[doc = "Bit 6 - External INT Pending Bit"]
148    #[inline(always)]
149    #[must_use]
150    pub fn eint6_status(&mut self) -> EINT_STATUS_W<PF_EINT_STATUS_SPEC> {
151        EINT_STATUS_W::new(self, 6)
152    }
153    #[doc = r" Writes raw bits to the register."]
154    #[doc = r""]
155    #[doc = r" # Safety"]
156    #[doc = r""]
157    #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
158    #[inline(always)]
159    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
160        self.bits = bits;
161        self
162    }
163}
164#[doc = "PF External Interrupt Status Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`pf_eint_status::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 [`pf_eint_status::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
165pub struct PF_EINT_STATUS_SPEC;
166impl crate::RegisterSpec for PF_EINT_STATUS_SPEC {
167    type Ux = u32;
168}
169#[doc = "`read()` method returns [`pf_eint_status::R`](R) reader structure"]
170impl crate::Readable for PF_EINT_STATUS_SPEC {}
171#[doc = "`write(|w| ..)` method takes [`pf_eint_status::W`](W) writer structure"]
172impl crate::Writable for PF_EINT_STATUS_SPEC {
173    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
174    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
175}
176#[doc = "`reset()` method sets pf_eint_status to value 0"]
177impl crate::Resettable for PF_EINT_STATUS_SPEC {
178    const RESET_VALUE: Self::Ux = 0;
179}