bl602_pac/glb/
gpio_cfgctl14.rs

1#[doc = "Register `GPIO_CFGCTL14` reader"]
2pub struct R(crate::R<GPIO_CFGCTL14_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<GPIO_CFGCTL14_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<GPIO_CFGCTL14_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<GPIO_CFGCTL14_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `GPIO_CFGCTL14` writer"]
17pub struct W(crate::W<GPIO_CFGCTL14_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<GPIO_CFGCTL14_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<GPIO_CFGCTL14_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<GPIO_CFGCTL14_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `reg_gpio_28_ie` reader - Input enable for GPIO28."]
38pub type REG_GPIO_28_IE_R = crate::BitReader<GPIO28INPUT_ENABLED_A>;
39#[doc = "Input enable for GPIO28.\n\nValue on reset: 1"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41pub enum GPIO28INPUT_ENABLED_A {
42    #[doc = "0: `0`"]
43    DISABLED = 0,
44    #[doc = "1: `1`"]
45    ENABLED = 1,
46}
47impl From<GPIO28INPUT_ENABLED_A> for bool {
48    #[inline(always)]
49    fn from(variant: GPIO28INPUT_ENABLED_A) -> Self {
50        variant as u8 != 0
51    }
52}
53impl REG_GPIO_28_IE_R {
54    #[doc = "Get enumerated values variant"]
55    #[inline(always)]
56    pub fn variant(&self) -> GPIO28INPUT_ENABLED_A {
57        match self.bits {
58            false => GPIO28INPUT_ENABLED_A::DISABLED,
59            true => GPIO28INPUT_ENABLED_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 == GPIO28INPUT_ENABLED_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 == GPIO28INPUT_ENABLED_A::ENABLED
71    }
72}
73#[doc = "Field `reg_gpio_28_ie` writer - Input enable for GPIO28."]
74pub type REG_GPIO_28_IE_W<'a, const O: u8> =
75    crate::BitWriter<'a, u32, GPIO_CFGCTL14_SPEC, GPIO28INPUT_ENABLED_A, O>;
76impl<'a, const O: u8> REG_GPIO_28_IE_W<'a, O> {
77    #[doc = "`0`"]
78    #[inline(always)]
79    pub fn disabled(self) -> &'a mut W {
80        self.variant(GPIO28INPUT_ENABLED_A::DISABLED)
81    }
82    #[doc = "`1`"]
83    #[inline(always)]
84    pub fn enabled(self) -> &'a mut W {
85        self.variant(GPIO28INPUT_ENABLED_A::ENABLED)
86    }
87}
88#[doc = "Field `reg_gpio_28_smt` reader - Schmitt trigger enabled for GPIO28."]
89pub type REG_GPIO_28_SMT_R = crate::BitReader<GPIO28SCHMITT_A>;
90#[doc = "Schmitt trigger enabled for GPIO28.\n\nValue on reset: 1"]
91#[derive(Clone, Copy, Debug, PartialEq, Eq)]
92pub enum GPIO28SCHMITT_A {
93    #[doc = "0: `0`"]
94    DISABLED = 0,
95    #[doc = "1: `1`"]
96    ENABLED = 1,
97}
98impl From<GPIO28SCHMITT_A> for bool {
99    #[inline(always)]
100    fn from(variant: GPIO28SCHMITT_A) -> Self {
101        variant as u8 != 0
102    }
103}
104impl REG_GPIO_28_SMT_R {
105    #[doc = "Get enumerated values variant"]
106    #[inline(always)]
107    pub fn variant(&self) -> GPIO28SCHMITT_A {
108        match self.bits {
109            false => GPIO28SCHMITT_A::DISABLED,
110            true => GPIO28SCHMITT_A::ENABLED,
111        }
112    }
113    #[doc = "Checks if the value of the field is `DISABLED`"]
114    #[inline(always)]
115    pub fn is_disabled(&self) -> bool {
116        *self == GPIO28SCHMITT_A::DISABLED
117    }
118    #[doc = "Checks if the value of the field is `ENABLED`"]
119    #[inline(always)]
120    pub fn is_enabled(&self) -> bool {
121        *self == GPIO28SCHMITT_A::ENABLED
122    }
123}
124#[doc = "Field `reg_gpio_28_smt` writer - Schmitt trigger enabled for GPIO28."]
125pub type REG_GPIO_28_SMT_W<'a, const O: u8> =
126    crate::BitWriter<'a, u32, GPIO_CFGCTL14_SPEC, GPIO28SCHMITT_A, O>;
127impl<'a, const O: u8> REG_GPIO_28_SMT_W<'a, O> {
128    #[doc = "`0`"]
129    #[inline(always)]
130    pub fn disabled(self) -> &'a mut W {
131        self.variant(GPIO28SCHMITT_A::DISABLED)
132    }
133    #[doc = "`1`"]
134    #[inline(always)]
135    pub fn enabled(self) -> &'a mut W {
136        self.variant(GPIO28SCHMITT_A::ENABLED)
137    }
138}
139#[doc = "Field `reg_gpio_28_drv` reader - Driving control enabled for GPIO28."]
140pub type REG_GPIO_28_DRV_R = crate::FieldReader<u8, GPIO28DRIVING_A>;
141#[doc = "Driving control enabled for GPIO28.\n\nValue on reset: 0"]
142#[derive(Clone, Copy, Debug, PartialEq, Eq)]
143#[repr(u8)]
144pub enum GPIO28DRIVING_A {
145    #[doc = "0: `0`"]
146    DISABLED = 0,
147    #[doc = "1: `1`"]
148    ENABLED = 1,
149}
150impl From<GPIO28DRIVING_A> for u8 {
151    #[inline(always)]
152    fn from(variant: GPIO28DRIVING_A) -> Self {
153        variant as _
154    }
155}
156impl REG_GPIO_28_DRV_R {
157    #[doc = "Get enumerated values variant"]
158    #[inline(always)]
159    pub fn variant(&self) -> Option<GPIO28DRIVING_A> {
160        match self.bits {
161            0 => Some(GPIO28DRIVING_A::DISABLED),
162            1 => Some(GPIO28DRIVING_A::ENABLED),
163            _ => None,
164        }
165    }
166    #[doc = "Checks if the value of the field is `DISABLED`"]
167    #[inline(always)]
168    pub fn is_disabled(&self) -> bool {
169        *self == GPIO28DRIVING_A::DISABLED
170    }
171    #[doc = "Checks if the value of the field is `ENABLED`"]
172    #[inline(always)]
173    pub fn is_enabled(&self) -> bool {
174        *self == GPIO28DRIVING_A::ENABLED
175    }
176}
177#[doc = "Field `reg_gpio_28_drv` writer - Driving control enabled for GPIO28."]
178pub type REG_GPIO_28_DRV_W<'a, const O: u8> =
179    crate::FieldWriter<'a, u32, GPIO_CFGCTL14_SPEC, u8, GPIO28DRIVING_A, 2, O>;
180impl<'a, const O: u8> REG_GPIO_28_DRV_W<'a, O> {
181    #[doc = "`0`"]
182    #[inline(always)]
183    pub fn disabled(self) -> &'a mut W {
184        self.variant(GPIO28DRIVING_A::DISABLED)
185    }
186    #[doc = "`1`"]
187    #[inline(always)]
188    pub fn enabled(self) -> &'a mut W {
189        self.variant(GPIO28DRIVING_A::ENABLED)
190    }
191}
192#[doc = "Field `reg_gpio_28_pu` reader - Pull Up Resistor for GPIO28."]
193pub type REG_GPIO_28_PU_R = crate::BitReader<GPIO28PULL_UP_RESISTOR_A>;
194#[doc = "Pull Up Resistor for GPIO28.\n\nValue on reset: 0"]
195#[derive(Clone, Copy, Debug, PartialEq, Eq)]
196pub enum GPIO28PULL_UP_RESISTOR_A {
197    #[doc = "0: `0`"]
198    DISABLED = 0,
199    #[doc = "1: `1`"]
200    ENABLED = 1,
201}
202impl From<GPIO28PULL_UP_RESISTOR_A> for bool {
203    #[inline(always)]
204    fn from(variant: GPIO28PULL_UP_RESISTOR_A) -> Self {
205        variant as u8 != 0
206    }
207}
208impl REG_GPIO_28_PU_R {
209    #[doc = "Get enumerated values variant"]
210    #[inline(always)]
211    pub fn variant(&self) -> GPIO28PULL_UP_RESISTOR_A {
212        match self.bits {
213            false => GPIO28PULL_UP_RESISTOR_A::DISABLED,
214            true => GPIO28PULL_UP_RESISTOR_A::ENABLED,
215        }
216    }
217    #[doc = "Checks if the value of the field is `DISABLED`"]
218    #[inline(always)]
219    pub fn is_disabled(&self) -> bool {
220        *self == GPIO28PULL_UP_RESISTOR_A::DISABLED
221    }
222    #[doc = "Checks if the value of the field is `ENABLED`"]
223    #[inline(always)]
224    pub fn is_enabled(&self) -> bool {
225        *self == GPIO28PULL_UP_RESISTOR_A::ENABLED
226    }
227}
228#[doc = "Field `reg_gpio_28_pu` writer - Pull Up Resistor for GPIO28."]
229pub type REG_GPIO_28_PU_W<'a, const O: u8> =
230    crate::BitWriter<'a, u32, GPIO_CFGCTL14_SPEC, GPIO28PULL_UP_RESISTOR_A, O>;
231impl<'a, const O: u8> REG_GPIO_28_PU_W<'a, O> {
232    #[doc = "`0`"]
233    #[inline(always)]
234    pub fn disabled(self) -> &'a mut W {
235        self.variant(GPIO28PULL_UP_RESISTOR_A::DISABLED)
236    }
237    #[doc = "`1`"]
238    #[inline(always)]
239    pub fn enabled(self) -> &'a mut W {
240        self.variant(GPIO28PULL_UP_RESISTOR_A::ENABLED)
241    }
242}
243#[doc = "Field `reg_gpio_28_pd` reader - Pull Down Resistor for GPIO28."]
244pub type REG_GPIO_28_PD_R = crate::BitReader<GPIO28PULL_DOWN_RESISTOR_A>;
245#[doc = "Pull Down Resistor for GPIO28.\n\nValue on reset: 0"]
246#[derive(Clone, Copy, Debug, PartialEq, Eq)]
247pub enum GPIO28PULL_DOWN_RESISTOR_A {
248    #[doc = "0: `0`"]
249    DISABLED = 0,
250    #[doc = "1: `1`"]
251    ENABLED = 1,
252}
253impl From<GPIO28PULL_DOWN_RESISTOR_A> for bool {
254    #[inline(always)]
255    fn from(variant: GPIO28PULL_DOWN_RESISTOR_A) -> Self {
256        variant as u8 != 0
257    }
258}
259impl REG_GPIO_28_PD_R {
260    #[doc = "Get enumerated values variant"]
261    #[inline(always)]
262    pub fn variant(&self) -> GPIO28PULL_DOWN_RESISTOR_A {
263        match self.bits {
264            false => GPIO28PULL_DOWN_RESISTOR_A::DISABLED,
265            true => GPIO28PULL_DOWN_RESISTOR_A::ENABLED,
266        }
267    }
268    #[doc = "Checks if the value of the field is `DISABLED`"]
269    #[inline(always)]
270    pub fn is_disabled(&self) -> bool {
271        *self == GPIO28PULL_DOWN_RESISTOR_A::DISABLED
272    }
273    #[doc = "Checks if the value of the field is `ENABLED`"]
274    #[inline(always)]
275    pub fn is_enabled(&self) -> bool {
276        *self == GPIO28PULL_DOWN_RESISTOR_A::ENABLED
277    }
278}
279#[doc = "Field `reg_gpio_28_pd` writer - Pull Down Resistor for GPIO28."]
280pub type REG_GPIO_28_PD_W<'a, const O: u8> =
281    crate::BitWriter<'a, u32, GPIO_CFGCTL14_SPEC, GPIO28PULL_DOWN_RESISTOR_A, O>;
282impl<'a, const O: u8> REG_GPIO_28_PD_W<'a, O> {
283    #[doc = "`0`"]
284    #[inline(always)]
285    pub fn disabled(self) -> &'a mut W {
286        self.variant(GPIO28PULL_DOWN_RESISTOR_A::DISABLED)
287    }
288    #[doc = "`1`"]
289    #[inline(always)]
290    pub fn enabled(self) -> &'a mut W {
291        self.variant(GPIO28PULL_DOWN_RESISTOR_A::ENABLED)
292    }
293}
294impl R {
295    #[doc = "Bit 0 - Input enable for GPIO28."]
296    #[inline(always)]
297    pub fn reg_gpio_28_ie(&self) -> REG_GPIO_28_IE_R {
298        REG_GPIO_28_IE_R::new((self.bits & 1) != 0)
299    }
300    #[doc = "Bit 1 - Schmitt trigger enabled for GPIO28."]
301    #[inline(always)]
302    pub fn reg_gpio_28_smt(&self) -> REG_GPIO_28_SMT_R {
303        REG_GPIO_28_SMT_R::new(((self.bits >> 1) & 1) != 0)
304    }
305    #[doc = "Bits 2:3 - Driving control enabled for GPIO28."]
306    #[inline(always)]
307    pub fn reg_gpio_28_drv(&self) -> REG_GPIO_28_DRV_R {
308        REG_GPIO_28_DRV_R::new(((self.bits >> 2) & 3) as u8)
309    }
310    #[doc = "Bit 4 - Pull Up Resistor for GPIO28."]
311    #[inline(always)]
312    pub fn reg_gpio_28_pu(&self) -> REG_GPIO_28_PU_R {
313        REG_GPIO_28_PU_R::new(((self.bits >> 4) & 1) != 0)
314    }
315    #[doc = "Bit 5 - Pull Down Resistor for GPIO28."]
316    #[inline(always)]
317    pub fn reg_gpio_28_pd(&self) -> REG_GPIO_28_PD_R {
318        REG_GPIO_28_PD_R::new(((self.bits >> 5) & 1) != 0)
319    }
320}
321impl W {
322    #[doc = "Bit 0 - Input enable for GPIO28."]
323    #[inline(always)]
324    #[must_use]
325    pub fn reg_gpio_28_ie(&mut self) -> REG_GPIO_28_IE_W<0> {
326        REG_GPIO_28_IE_W::new(self)
327    }
328    #[doc = "Bit 1 - Schmitt trigger enabled for GPIO28."]
329    #[inline(always)]
330    #[must_use]
331    pub fn reg_gpio_28_smt(&mut self) -> REG_GPIO_28_SMT_W<1> {
332        REG_GPIO_28_SMT_W::new(self)
333    }
334    #[doc = "Bits 2:3 - Driving control enabled for GPIO28."]
335    #[inline(always)]
336    #[must_use]
337    pub fn reg_gpio_28_drv(&mut self) -> REG_GPIO_28_DRV_W<2> {
338        REG_GPIO_28_DRV_W::new(self)
339    }
340    #[doc = "Bit 4 - Pull Up Resistor for GPIO28."]
341    #[inline(always)]
342    #[must_use]
343    pub fn reg_gpio_28_pu(&mut self) -> REG_GPIO_28_PU_W<4> {
344        REG_GPIO_28_PU_W::new(self)
345    }
346    #[doc = "Bit 5 - Pull Down Resistor for GPIO28."]
347    #[inline(always)]
348    #[must_use]
349    pub fn reg_gpio_28_pd(&mut self) -> REG_GPIO_28_PD_W<5> {
350        REG_GPIO_28_PD_W::new(self)
351    }
352    #[doc = "Writes raw bits to the register."]
353    #[inline(always)]
354    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
355        self.0.bits(bits);
356        self
357    }
358}
359#[doc = "GPIO28 configuration\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 [gpio_cfgctl14](index.html) module"]
360pub struct GPIO_CFGCTL14_SPEC;
361impl crate::RegisterSpec for GPIO_CFGCTL14_SPEC {
362    type Ux = u32;
363}
364#[doc = "`read()` method returns [gpio_cfgctl14::R](R) reader structure"]
365impl crate::Readable for GPIO_CFGCTL14_SPEC {
366    type Reader = R;
367}
368#[doc = "`write(|w| ..)` method takes [gpio_cfgctl14::W](W) writer structure"]
369impl crate::Writable for GPIO_CFGCTL14_SPEC {
370    type Writer = W;
371    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
372    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
373}
374#[doc = "`reset()` method sets GPIO_CFGCTL14 to value 0x03"]
375impl crate::Resettable for GPIO_CFGCTL14_SPEC {
376    const RESET_VALUE: Self::Ux = 0x03;
377}