moondancer_pac/generated/gpio1/
mode.rs

1#[doc = "Register `Mode` reader"]
2pub type R = crate::R<MODE_SPEC>;
3#[doc = "Register `Mode` writer"]
4pub type W = crate::W<MODE_SPEC>;
5#[doc = "Field `pin_0` reader - pin_0 field"]
6pub type PIN_0_R = crate::FieldReader;
7#[doc = "Field `pin_0` writer - pin_0 field"]
8pub type PIN_0_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
9#[doc = "Field `pin_1` reader - pin_1 field"]
10pub type PIN_1_R = crate::FieldReader;
11#[doc = "Field `pin_1` writer - pin_1 field"]
12pub type PIN_1_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
13#[doc = "Field `pin_2` reader - pin_2 field"]
14pub type PIN_2_R = crate::FieldReader;
15#[doc = "Field `pin_2` writer - pin_2 field"]
16pub type PIN_2_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
17#[doc = "Field `pin_3` reader - pin_3 field"]
18pub type PIN_3_R = crate::FieldReader;
19#[doc = "Field `pin_3` writer - pin_3 field"]
20pub type PIN_3_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
21#[doc = "Field `pin_4` reader - pin_4 field"]
22pub type PIN_4_R = crate::FieldReader;
23#[doc = "Field `pin_4` writer - pin_4 field"]
24pub type PIN_4_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
25#[doc = "Field `pin_5` reader - pin_5 field"]
26pub type PIN_5_R = crate::FieldReader;
27#[doc = "Field `pin_5` writer - pin_5 field"]
28pub type PIN_5_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
29#[doc = "Field `pin_6` reader - pin_6 field"]
30pub type PIN_6_R = crate::FieldReader;
31#[doc = "Field `pin_6` writer - pin_6 field"]
32pub type PIN_6_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
33#[doc = "Field `pin_7` reader - pin_7 field"]
34pub type PIN_7_R = crate::FieldReader;
35#[doc = "Field `pin_7` writer - pin_7 field"]
36pub type PIN_7_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
37impl R {
38    #[doc = "Bits 0:1 - pin_0 field"]
39    #[inline(always)]
40    pub fn pin_0(&self) -> PIN_0_R {
41        PIN_0_R::new((self.bits & 3) as u8)
42    }
43    #[doc = "Bits 2:3 - pin_1 field"]
44    #[inline(always)]
45    pub fn pin_1(&self) -> PIN_1_R {
46        PIN_1_R::new(((self.bits >> 2) & 3) as u8)
47    }
48    #[doc = "Bits 4:5 - pin_2 field"]
49    #[inline(always)]
50    pub fn pin_2(&self) -> PIN_2_R {
51        PIN_2_R::new(((self.bits >> 4) & 3) as u8)
52    }
53    #[doc = "Bits 6:7 - pin_3 field"]
54    #[inline(always)]
55    pub fn pin_3(&self) -> PIN_3_R {
56        PIN_3_R::new(((self.bits >> 6) & 3) as u8)
57    }
58    #[doc = "Bits 8:9 - pin_4 field"]
59    #[inline(always)]
60    pub fn pin_4(&self) -> PIN_4_R {
61        PIN_4_R::new(((self.bits >> 8) & 3) as u8)
62    }
63    #[doc = "Bits 10:11 - pin_5 field"]
64    #[inline(always)]
65    pub fn pin_5(&self) -> PIN_5_R {
66        PIN_5_R::new(((self.bits >> 10) & 3) as u8)
67    }
68    #[doc = "Bits 12:13 - pin_6 field"]
69    #[inline(always)]
70    pub fn pin_6(&self) -> PIN_6_R {
71        PIN_6_R::new(((self.bits >> 12) & 3) as u8)
72    }
73    #[doc = "Bits 14:15 - pin_7 field"]
74    #[inline(always)]
75    pub fn pin_7(&self) -> PIN_7_R {
76        PIN_7_R::new(((self.bits >> 14) & 3) as u8)
77    }
78}
79impl W {
80    #[doc = "Bits 0:1 - pin_0 field"]
81    #[inline(always)]
82    pub fn pin_0(&mut self) -> PIN_0_W<MODE_SPEC> {
83        PIN_0_W::new(self, 0)
84    }
85    #[doc = "Bits 2:3 - pin_1 field"]
86    #[inline(always)]
87    pub fn pin_1(&mut self) -> PIN_1_W<MODE_SPEC> {
88        PIN_1_W::new(self, 2)
89    }
90    #[doc = "Bits 4:5 - pin_2 field"]
91    #[inline(always)]
92    pub fn pin_2(&mut self) -> PIN_2_W<MODE_SPEC> {
93        PIN_2_W::new(self, 4)
94    }
95    #[doc = "Bits 6:7 - pin_3 field"]
96    #[inline(always)]
97    pub fn pin_3(&mut self) -> PIN_3_W<MODE_SPEC> {
98        PIN_3_W::new(self, 6)
99    }
100    #[doc = "Bits 8:9 - pin_4 field"]
101    #[inline(always)]
102    pub fn pin_4(&mut self) -> PIN_4_W<MODE_SPEC> {
103        PIN_4_W::new(self, 8)
104    }
105    #[doc = "Bits 10:11 - pin_5 field"]
106    #[inline(always)]
107    pub fn pin_5(&mut self) -> PIN_5_W<MODE_SPEC> {
108        PIN_5_W::new(self, 10)
109    }
110    #[doc = "Bits 12:13 - pin_6 field"]
111    #[inline(always)]
112    pub fn pin_6(&mut self) -> PIN_6_W<MODE_SPEC> {
113        PIN_6_W::new(self, 12)
114    }
115    #[doc = "Bits 14:15 - pin_7 field"]
116    #[inline(always)]
117    pub fn pin_7(&mut self) -> PIN_7_W<MODE_SPEC> {
118        PIN_7_W::new(self, 14)
119    }
120}
121#[doc = "Mode register. This :class:`csr.Register` contains an array of ``pin_count`` read/write fields. Each field is 2-bit wide and its possible values are defined by the :class:`PinMode` enumeration. If ``pin_count`` is 8, then the register has the following fields: .. bitfield:: :bits: 16 \\[ { \"name\": \"pin\\[0\\]\", \"bits\": 2, \"attr\": \"RW\" }, { \"name\": \"pin\\[1\\]\", \"bits\": 2, \"attr\": \"RW\" }, { \"name\": \"pin\\[2\\]\", \"bits\": 2, \"attr\": \"RW\" }, { \"name\": \"pin\\[3\\]\", \"bits\": 2, \"attr\": \"RW\" }, { \"name\": \"pin\\[4\\]\", \"bits\": 2, \"attr\": \"RW\" }, { \"name\": \"pin\\[5\\]\", \"bits\": 2, \"attr\": \"RW\" }, { \"name\": \"pin\\[6\\]\", \"bits\": 2, \"attr\": \"RW\" }, { \"name\": \"pin\\[7\\]\", \"bits\": 2, \"attr\": \"RW\" }, \\]
122Parameters ---------- pin_count : :class:`int` Number of GPIO pins.\n\nYou can [`read`](crate::Reg::read) this register and get [`mode::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`mode::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
123pub struct MODE_SPEC;
124impl crate::RegisterSpec for MODE_SPEC {
125    type Ux = u16;
126}
127#[doc = "`read()` method returns [`mode::R`](R) reader structure"]
128impl crate::Readable for MODE_SPEC {}
129#[doc = "`write(|w| ..)` method takes [`mode::W`](W) writer structure"]
130impl crate::Writable for MODE_SPEC {
131    type Safety = crate::Unsafe;
132    const ZERO_TO_MODIFY_FIELDS_BITMAP: u16 = 0;
133    const ONE_TO_MODIFY_FIELDS_BITMAP: u16 = 0;
134}
135#[doc = "`reset()` method sets Mode to value 0"]
136impl crate::Resettable for MODE_SPEC {
137    const RESET_VALUE: u16 = 0;
138}