moondancer_pac/generated/leds/
mode.rs1#[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>;
29impl R {
30 #[doc = "Bits 0:1 - pin_0 field"]
31 #[inline(always)]
32 pub fn pin_0(&self) -> PIN_0_R {
33 PIN_0_R::new((self.bits & 3) as u8)
34 }
35 #[doc = "Bits 2:3 - pin_1 field"]
36 #[inline(always)]
37 pub fn pin_1(&self) -> PIN_1_R {
38 PIN_1_R::new(((self.bits >> 2) & 3) as u8)
39 }
40 #[doc = "Bits 4:5 - pin_2 field"]
41 #[inline(always)]
42 pub fn pin_2(&self) -> PIN_2_R {
43 PIN_2_R::new(((self.bits >> 4) & 3) as u8)
44 }
45 #[doc = "Bits 6:7 - pin_3 field"]
46 #[inline(always)]
47 pub fn pin_3(&self) -> PIN_3_R {
48 PIN_3_R::new(((self.bits >> 6) & 3) as u8)
49 }
50 #[doc = "Bits 8:9 - pin_4 field"]
51 #[inline(always)]
52 pub fn pin_4(&self) -> PIN_4_R {
53 PIN_4_R::new(((self.bits >> 8) & 3) as u8)
54 }
55 #[doc = "Bits 10:11 - pin_5 field"]
56 #[inline(always)]
57 pub fn pin_5(&self) -> PIN_5_R {
58 PIN_5_R::new(((self.bits >> 10) & 3) as u8)
59 }
60}
61impl W {
62 #[doc = "Bits 0:1 - pin_0 field"]
63 #[inline(always)]
64 pub fn pin_0(&mut self) -> PIN_0_W<MODE_SPEC> {
65 PIN_0_W::new(self, 0)
66 }
67 #[doc = "Bits 2:3 - pin_1 field"]
68 #[inline(always)]
69 pub fn pin_1(&mut self) -> PIN_1_W<MODE_SPEC> {
70 PIN_1_W::new(self, 2)
71 }
72 #[doc = "Bits 4:5 - pin_2 field"]
73 #[inline(always)]
74 pub fn pin_2(&mut self) -> PIN_2_W<MODE_SPEC> {
75 PIN_2_W::new(self, 4)
76 }
77 #[doc = "Bits 6:7 - pin_3 field"]
78 #[inline(always)]
79 pub fn pin_3(&mut self) -> PIN_3_W<MODE_SPEC> {
80 PIN_3_W::new(self, 6)
81 }
82 #[doc = "Bits 8:9 - pin_4 field"]
83 #[inline(always)]
84 pub fn pin_4(&mut self) -> PIN_4_W<MODE_SPEC> {
85 PIN_4_W::new(self, 8)
86 }
87 #[doc = "Bits 10:11 - pin_5 field"]
88 #[inline(always)]
89 pub fn pin_5(&mut self) -> PIN_5_W<MODE_SPEC> {
90 PIN_5_W::new(self, 10)
91 }
92}
93#[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\" }, \\]
94Parameters ---------- 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)."]
95pub struct MODE_SPEC;
96impl crate::RegisterSpec for MODE_SPEC {
97 type Ux = u16;
98}
99#[doc = "`read()` method returns [`mode::R`](R) reader structure"]
100impl crate::Readable for MODE_SPEC {}
101#[doc = "`write(|w| ..)` method takes [`mode::W`](W) writer structure"]
102impl crate::Writable for MODE_SPEC {
103 type Safety = crate::Unsafe;
104 const ZERO_TO_MODIFY_FIELDS_BITMAP: u16 = 0;
105 const ONE_TO_MODIFY_FIELDS_BITMAP: u16 = 0;
106}
107#[doc = "`reset()` method sets Mode to value 0"]
108impl crate::Resettable for MODE_SPEC {
109 const RESET_VALUE: u16 = 0;
110}