d1_pac/i2s_pcm/
i2s_pcm_tx2chmap0.rs1#[doc = "Register `i2s_pcm_tx2chmap0` reader"]
2pub type R = crate::R<I2S_PCM_TX2CHMAP0_SPEC>;
3#[doc = "Register `i2s_pcm_tx2chmap0` writer"]
4pub type W = crate::W<I2S_PCM_TX2CHMAP0_SPEC>;
5#[doc = "Field `ch_map[8-15]` reader - Channel %s mapping\n\n0000: The first sample\n\n...\n\n1111: The sixteenth sample"]
6pub type CH_MAP_R = crate::FieldReader;
7#[doc = "Field `ch_map[8-15]` writer - Channel %s mapping\n\n0000: The first sample\n\n...\n\n1111: The sixteenth sample"]
8pub type CH_MAP_W<'a, REG> = crate::FieldWriter<'a, REG, 4>;
9impl R {
10 #[doc = "Channel [8-15] mapping\n\n0000: The first sample\n\n...\n\n1111: The sixteenth sample\n\nNOTE: `n` is number of field in register. `n == 0` corresponds to `ch8_map` field"]
11 #[inline(always)]
12 pub fn ch_map(&self, n: u8) -> CH_MAP_R {
13 #[allow(clippy::no_effect)]
14 [(); 8][n as usize];
15 CH_MAP_R::new(((self.bits >> (n * 4)) & 0x0f) as u8)
16 }
17 #[doc = "Bits 0:3 - Channel 8 mapping\n\n0000: The first sample\n\n...\n\n1111: The sixteenth sample"]
18 #[inline(always)]
19 pub fn ch8_map(&self) -> CH_MAP_R {
20 CH_MAP_R::new((self.bits & 0x0f) as u8)
21 }
22 #[doc = "Bits 4:7 - Channel 9 mapping\n\n0000: The first sample\n\n...\n\n1111: The sixteenth sample"]
23 #[inline(always)]
24 pub fn ch9_map(&self) -> CH_MAP_R {
25 CH_MAP_R::new(((self.bits >> 4) & 0x0f) as u8)
26 }
27 #[doc = "Bits 8:11 - Channel 10 mapping\n\n0000: The first sample\n\n...\n\n1111: The sixteenth sample"]
28 #[inline(always)]
29 pub fn ch10_map(&self) -> CH_MAP_R {
30 CH_MAP_R::new(((self.bits >> 8) & 0x0f) as u8)
31 }
32 #[doc = "Bits 12:15 - Channel 11 mapping\n\n0000: The first sample\n\n...\n\n1111: The sixteenth sample"]
33 #[inline(always)]
34 pub fn ch11_map(&self) -> CH_MAP_R {
35 CH_MAP_R::new(((self.bits >> 12) & 0x0f) as u8)
36 }
37 #[doc = "Bits 16:19 - Channel 12 mapping\n\n0000: The first sample\n\n...\n\n1111: The sixteenth sample"]
38 #[inline(always)]
39 pub fn ch12_map(&self) -> CH_MAP_R {
40 CH_MAP_R::new(((self.bits >> 16) & 0x0f) as u8)
41 }
42 #[doc = "Bits 20:23 - Channel 13 mapping\n\n0000: The first sample\n\n...\n\n1111: The sixteenth sample"]
43 #[inline(always)]
44 pub fn ch13_map(&self) -> CH_MAP_R {
45 CH_MAP_R::new(((self.bits >> 20) & 0x0f) as u8)
46 }
47 #[doc = "Bits 24:27 - Channel 14 mapping\n\n0000: The first sample\n\n...\n\n1111: The sixteenth sample"]
48 #[inline(always)]
49 pub fn ch14_map(&self) -> CH_MAP_R {
50 CH_MAP_R::new(((self.bits >> 24) & 0x0f) as u8)
51 }
52 #[doc = "Bits 28:31 - Channel 15 mapping\n\n0000: The first sample\n\n...\n\n1111: The sixteenth sample"]
53 #[inline(always)]
54 pub fn ch15_map(&self) -> CH_MAP_R {
55 CH_MAP_R::new(((self.bits >> 28) & 0x0f) as u8)
56 }
57}
58impl W {
59 #[doc = "Channel [8-15] mapping\n\n0000: The first sample\n\n...\n\n1111: The sixteenth sample\n\nNOTE: `n` is number of field in register. `n == 0` corresponds to `ch8_map` field"]
60 #[inline(always)]
61 #[must_use]
62 pub fn ch_map(&mut self, n: u8) -> CH_MAP_W<I2S_PCM_TX2CHMAP0_SPEC> {
63 #[allow(clippy::no_effect)]
64 [(); 8][n as usize];
65 CH_MAP_W::new(self, n * 4)
66 }
67 #[doc = "Bits 0:3 - Channel 8 mapping\n\n0000: The first sample\n\n...\n\n1111: The sixteenth sample"]
68 #[inline(always)]
69 #[must_use]
70 pub fn ch8_map(&mut self) -> CH_MAP_W<I2S_PCM_TX2CHMAP0_SPEC> {
71 CH_MAP_W::new(self, 0)
72 }
73 #[doc = "Bits 4:7 - Channel 9 mapping\n\n0000: The first sample\n\n...\n\n1111: The sixteenth sample"]
74 #[inline(always)]
75 #[must_use]
76 pub fn ch9_map(&mut self) -> CH_MAP_W<I2S_PCM_TX2CHMAP0_SPEC> {
77 CH_MAP_W::new(self, 4)
78 }
79 #[doc = "Bits 8:11 - Channel 10 mapping\n\n0000: The first sample\n\n...\n\n1111: The sixteenth sample"]
80 #[inline(always)]
81 #[must_use]
82 pub fn ch10_map(&mut self) -> CH_MAP_W<I2S_PCM_TX2CHMAP0_SPEC> {
83 CH_MAP_W::new(self, 8)
84 }
85 #[doc = "Bits 12:15 - Channel 11 mapping\n\n0000: The first sample\n\n...\n\n1111: The sixteenth sample"]
86 #[inline(always)]
87 #[must_use]
88 pub fn ch11_map(&mut self) -> CH_MAP_W<I2S_PCM_TX2CHMAP0_SPEC> {
89 CH_MAP_W::new(self, 12)
90 }
91 #[doc = "Bits 16:19 - Channel 12 mapping\n\n0000: The first sample\n\n...\n\n1111: The sixteenth sample"]
92 #[inline(always)]
93 #[must_use]
94 pub fn ch12_map(&mut self) -> CH_MAP_W<I2S_PCM_TX2CHMAP0_SPEC> {
95 CH_MAP_W::new(self, 16)
96 }
97 #[doc = "Bits 20:23 - Channel 13 mapping\n\n0000: The first sample\n\n...\n\n1111: The sixteenth sample"]
98 #[inline(always)]
99 #[must_use]
100 pub fn ch13_map(&mut self) -> CH_MAP_W<I2S_PCM_TX2CHMAP0_SPEC> {
101 CH_MAP_W::new(self, 20)
102 }
103 #[doc = "Bits 24:27 - Channel 14 mapping\n\n0000: The first sample\n\n...\n\n1111: The sixteenth sample"]
104 #[inline(always)]
105 #[must_use]
106 pub fn ch14_map(&mut self) -> CH_MAP_W<I2S_PCM_TX2CHMAP0_SPEC> {
107 CH_MAP_W::new(self, 24)
108 }
109 #[doc = "Bits 28:31 - Channel 15 mapping\n\n0000: The first sample\n\n...\n\n1111: The sixteenth sample"]
110 #[inline(always)]
111 #[must_use]
112 pub fn ch15_map(&mut self) -> CH_MAP_W<I2S_PCM_TX2CHMAP0_SPEC> {
113 CH_MAP_W::new(self, 28)
114 }
115 #[doc = r" Writes raw bits to the register."]
116 #[doc = r""]
117 #[doc = r" # Safety"]
118 #[doc = r""]
119 #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
120 #[inline(always)]
121 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
122 self.bits = bits;
123 self
124 }
125}
126#[doc = "I2S/PCM TX2 Channel Mapping Register0\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`i2s_pcm_tx2chmap0::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 [`i2s_pcm_tx2chmap0::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
127pub struct I2S_PCM_TX2CHMAP0_SPEC;
128impl crate::RegisterSpec for I2S_PCM_TX2CHMAP0_SPEC {
129 type Ux = u32;
130}
131#[doc = "`read()` method returns [`i2s_pcm_tx2chmap0::R`](R) reader structure"]
132impl crate::Readable for I2S_PCM_TX2CHMAP0_SPEC {}
133#[doc = "`write(|w| ..)` method takes [`i2s_pcm_tx2chmap0::W`](W) writer structure"]
134impl crate::Writable for I2S_PCM_TX2CHMAP0_SPEC {
135 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
136 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
137}
138#[doc = "`reset()` method sets i2s_pcm_tx2chmap0 to value 0"]
139impl crate::Resettable for I2S_PCM_TX2CHMAP0_SPEC {
140 const RESET_VALUE: Self::Ux = 0;
141}