d1_pac/gpio/
pc_eint_status.rs

1#[doc = "Register `pc_eint_status` reader"]
2pub type R = crate::R<PC_EINT_STATUS_SPEC>;
3#[doc = "Register `pc_eint_status` writer"]
4pub type W = crate::W<PC_EINT_STATUS_SPEC>;
5#[doc = "Field `eint_status[0-7]` 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-7]` 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        [(); 8][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    #[doc = "Bit 7 - External INT Pending Bit"]
102    #[inline(always)]
103    pub fn eint7_status(&self) -> EINT_STATUS_R {
104        EINT_STATUS_R::new(((self.bits >> 7) & 1) != 0)
105    }
106}
107impl W {
108    #[doc = "External INT Pending Bit\n\nNOTE: `n` is number of field in register. `n == 0` corresponds to `eint0_status` field"]
109    #[inline(always)]
110    #[must_use]
111    pub fn eint_status(&mut self, n: u8) -> EINT_STATUS_W<PC_EINT_STATUS_SPEC> {
112        #[allow(clippy::no_effect)]
113        [(); 8][n as usize];
114        EINT_STATUS_W::new(self, n)
115    }
116    #[doc = "Bit 0 - External INT Pending Bit"]
117    #[inline(always)]
118    #[must_use]
119    pub fn eint0_status(&mut self) -> EINT_STATUS_W<PC_EINT_STATUS_SPEC> {
120        EINT_STATUS_W::new(self, 0)
121    }
122    #[doc = "Bit 1 - External INT Pending Bit"]
123    #[inline(always)]
124    #[must_use]
125    pub fn eint1_status(&mut self) -> EINT_STATUS_W<PC_EINT_STATUS_SPEC> {
126        EINT_STATUS_W::new(self, 1)
127    }
128    #[doc = "Bit 2 - External INT Pending Bit"]
129    #[inline(always)]
130    #[must_use]
131    pub fn eint2_status(&mut self) -> EINT_STATUS_W<PC_EINT_STATUS_SPEC> {
132        EINT_STATUS_W::new(self, 2)
133    }
134    #[doc = "Bit 3 - External INT Pending Bit"]
135    #[inline(always)]
136    #[must_use]
137    pub fn eint3_status(&mut self) -> EINT_STATUS_W<PC_EINT_STATUS_SPEC> {
138        EINT_STATUS_W::new(self, 3)
139    }
140    #[doc = "Bit 4 - External INT Pending Bit"]
141    #[inline(always)]
142    #[must_use]
143    pub fn eint4_status(&mut self) -> EINT_STATUS_W<PC_EINT_STATUS_SPEC> {
144        EINT_STATUS_W::new(self, 4)
145    }
146    #[doc = "Bit 5 - External INT Pending Bit"]
147    #[inline(always)]
148    #[must_use]
149    pub fn eint5_status(&mut self) -> EINT_STATUS_W<PC_EINT_STATUS_SPEC> {
150        EINT_STATUS_W::new(self, 5)
151    }
152    #[doc = "Bit 6 - External INT Pending Bit"]
153    #[inline(always)]
154    #[must_use]
155    pub fn eint6_status(&mut self) -> EINT_STATUS_W<PC_EINT_STATUS_SPEC> {
156        EINT_STATUS_W::new(self, 6)
157    }
158    #[doc = "Bit 7 - External INT Pending Bit"]
159    #[inline(always)]
160    #[must_use]
161    pub fn eint7_status(&mut self) -> EINT_STATUS_W<PC_EINT_STATUS_SPEC> {
162        EINT_STATUS_W::new(self, 7)
163    }
164    #[doc = r" Writes raw bits to the register."]
165    #[doc = r""]
166    #[doc = r" # Safety"]
167    #[doc = r""]
168    #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
169    #[inline(always)]
170    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
171        self.bits = bits;
172        self
173    }
174}
175#[doc = "PC External Interrupt Status Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`pc_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 [`pc_eint_status::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
176pub struct PC_EINT_STATUS_SPEC;
177impl crate::RegisterSpec for PC_EINT_STATUS_SPEC {
178    type Ux = u32;
179}
180#[doc = "`read()` method returns [`pc_eint_status::R`](R) reader structure"]
181impl crate::Readable for PC_EINT_STATUS_SPEC {}
182#[doc = "`write(|w| ..)` method takes [`pc_eint_status::W`](W) writer structure"]
183impl crate::Writable for PC_EINT_STATUS_SPEC {
184    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
185    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
186}
187#[doc = "`reset()` method sets pc_eint_status to value 0"]
188impl crate::Resettable for PC_EINT_STATUS_SPEC {
189    const RESET_VALUE: Self::Ux = 0;
190}