1#[doc = "Register `CFG2` reader"]
2pub struct R(crate::R<CFG2_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<CFG2_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<CFG2_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<CFG2_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `CFG2` writer"]
17pub struct W(crate::W<CFG2_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<CFG2_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<CFG2_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<CFG2_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `FRAMELEN` reader - Frame Length, minus 1 encoded, defines the number of clocks and data bits in the frames that this channel pair participates in. See Frame format. 0x000 to 0x002 = not supported 0x003 = frame is 4 bits in total length 0x004 = frame is 5 bits in total length 0x7FF = frame is 2048 bits in total length if FRAMELEN is an defines an odd length frame (e.g. 33 clocks) in mode 0 or 1, the extra clock appears in the right half. When MODE = 3, FRAMELEN must be larger than DATALEN in order for the WS pulse to be generated correctly."]
38pub type FRAMELEN_R = crate::FieldReader<u16, u16>;
39#[doc = "Field `FRAMELEN` writer - Frame Length, minus 1 encoded, defines the number of clocks and data bits in the frames that this channel pair participates in. See Frame format. 0x000 to 0x002 = not supported 0x003 = frame is 4 bits in total length 0x004 = frame is 5 bits in total length 0x7FF = frame is 2048 bits in total length if FRAMELEN is an defines an odd length frame (e.g. 33 clocks) in mode 0 or 1, the extra clock appears in the right half. When MODE = 3, FRAMELEN must be larger than DATALEN in order for the WS pulse to be generated correctly."]
40pub type FRAMELEN_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CFG2_SPEC, u16, u16, 11, O>;
41#[doc = "Field `POSITION` reader - Data Position. Defines the location within the frame of the data for this channel pair. POSITION + DATALEN must be less than FRAMELEN. See Frame format. When MODE = 0, POSITION defines the location of data in both the left phase and right phase, starting one clock after the WS edge. In other modes, POSITION defines the location of data within the entire frame. ONECHANNEL = 1 while MODE = 0 is a special case, see the description of ONECHANNEL. The combination of DATALEN and the POSITION fields of all channel pairs must be made such that the channels do not overlap within the frame. 0x000 = data begins at bit position 0 (the first bit position) within the frame or WS phase. 0x001 = data begins at bit position 1 within the frame or WS phase. 0x002 = data begins at bit position 2 within the frame or WS phase."]
42pub type POSITION_R = crate::FieldReader<u16, u16>;
43#[doc = "Field `POSITION` writer - Data Position. Defines the location within the frame of the data for this channel pair. POSITION + DATALEN must be less than FRAMELEN. See Frame format. When MODE = 0, POSITION defines the location of data in both the left phase and right phase, starting one clock after the WS edge. In other modes, POSITION defines the location of data within the entire frame. ONECHANNEL = 1 while MODE = 0 is a special case, see the description of ONECHANNEL. The combination of DATALEN and the POSITION fields of all channel pairs must be made such that the channels do not overlap within the frame. 0x000 = data begins at bit position 0 (the first bit position) within the frame or WS phase. 0x001 = data begins at bit position 1 within the frame or WS phase. 0x002 = data begins at bit position 2 within the frame or WS phase."]
44pub type POSITION_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CFG2_SPEC, u16, u16, 9, O>;
45impl R {
46 #[doc = "Bits 0:10 - Frame Length, minus 1 encoded, defines the number of clocks and data bits in the frames that this channel pair participates in. See Frame format. 0x000 to 0x002 = not supported 0x003 = frame is 4 bits in total length 0x004 = frame is 5 bits in total length 0x7FF = frame is 2048 bits in total length if FRAMELEN is an defines an odd length frame (e.g. 33 clocks) in mode 0 or 1, the extra clock appears in the right half. When MODE = 3, FRAMELEN must be larger than DATALEN in order for the WS pulse to be generated correctly."]
47 #[inline(always)]
48 pub fn framelen(&self) -> FRAMELEN_R {
49 FRAMELEN_R::new((self.bits & 0x07ff) as u16)
50 }
51 #[doc = "Bits 16:24 - Data Position. Defines the location within the frame of the data for this channel pair. POSITION + DATALEN must be less than FRAMELEN. See Frame format. When MODE = 0, POSITION defines the location of data in both the left phase and right phase, starting one clock after the WS edge. In other modes, POSITION defines the location of data within the entire frame. ONECHANNEL = 1 while MODE = 0 is a special case, see the description of ONECHANNEL. The combination of DATALEN and the POSITION fields of all channel pairs must be made such that the channels do not overlap within the frame. 0x000 = data begins at bit position 0 (the first bit position) within the frame or WS phase. 0x001 = data begins at bit position 1 within the frame or WS phase. 0x002 = data begins at bit position 2 within the frame or WS phase."]
52 #[inline(always)]
53 pub fn position(&self) -> POSITION_R {
54 POSITION_R::new(((self.bits >> 16) & 0x01ff) as u16)
55 }
56}
57impl W {
58 #[doc = "Bits 0:10 - Frame Length, minus 1 encoded, defines the number of clocks and data bits in the frames that this channel pair participates in. See Frame format. 0x000 to 0x002 = not supported 0x003 = frame is 4 bits in total length 0x004 = frame is 5 bits in total length 0x7FF = frame is 2048 bits in total length if FRAMELEN is an defines an odd length frame (e.g. 33 clocks) in mode 0 or 1, the extra clock appears in the right half. When MODE = 3, FRAMELEN must be larger than DATALEN in order for the WS pulse to be generated correctly."]
59 #[inline(always)]
60 pub fn framelen(&mut self) -> FRAMELEN_W<0> {
61 FRAMELEN_W::new(self)
62 }
63 #[doc = "Bits 16:24 - Data Position. Defines the location within the frame of the data for this channel pair. POSITION + DATALEN must be less than FRAMELEN. See Frame format. When MODE = 0, POSITION defines the location of data in both the left phase and right phase, starting one clock after the WS edge. In other modes, POSITION defines the location of data within the entire frame. ONECHANNEL = 1 while MODE = 0 is a special case, see the description of ONECHANNEL. The combination of DATALEN and the POSITION fields of all channel pairs must be made such that the channels do not overlap within the frame. 0x000 = data begins at bit position 0 (the first bit position) within the frame or WS phase. 0x001 = data begins at bit position 1 within the frame or WS phase. 0x002 = data begins at bit position 2 within the frame or WS phase."]
64 #[inline(always)]
65 pub fn position(&mut self) -> POSITION_W<16> {
66 POSITION_W::new(self)
67 }
68 #[doc = "Writes raw bits to the register."]
69 #[inline(always)]
70 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
71 self.0.bits(bits);
72 self
73 }
74}
75#[doc = "Configuration register 2 for the primary channel pair.\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 [cfg2](index.html) module"]
76pub struct CFG2_SPEC;
77impl crate::RegisterSpec for CFG2_SPEC {
78 type Ux = u32;
79}
80#[doc = "`read()` method returns [cfg2::R](R) reader structure"]
81impl crate::Readable for CFG2_SPEC {
82 type Reader = R;
83}
84#[doc = "`write(|w| ..)` method takes [cfg2::W](W) writer structure"]
85impl crate::Writable for CFG2_SPEC {
86 type Writer = W;
87}
88#[doc = "`reset()` method sets CFG2 to value 0"]
89impl crate::Resettable for CFG2_SPEC {
90 #[inline(always)]
91 fn reset_value() -> Self::Ux {
92 0
93 }
94}