1- using System ;
1+ //
2+ // Copyright (c) .NET Foundation and Contributors
3+ // See LICENSE file in the project root for full license information.
4+ //
5+
6+ using System ;
27
38namespace System . Device . I2s
49{
5- public class I2sConnectionSettings
10+ /// <summary>
11+ /// The connection settings of a device on a I2Sbus.
12+ /// </summary>
13+ public sealed class I2sConnectionSettings
614 {
15+ private int _busId = 1 ;
16+
17+ private int _sampleRate = 44_100 ;
18+
19+ private I2sMode _i2sMode = I2sMode . Pdm ;
20+
21+ private I2sBitsPerSample _i2sBitsPerSample = I2sBitsPerSample . Bit16 ;
22+
23+ private I2sChannelFormat _i2sChannelFormat = I2sChannelFormat . RightLeft ;
24+
25+ private I2sCommunicationFormat _i2sConnectionFormat = I2sCommunicationFormat . StandardI2s ;
26+
27+ /// <summary>
28+ /// Initializes new instance of I2sConnectionSettings.
29+ /// </summary>
30+
31+ private I2sConnectionSettings ( )
32+ {
33+ }
34+
35+ /// <summary>
36+ /// Initializes a new instance of the <see cref="I2sConnectionSettings"/> class.
37+ /// </summary>
38+ /// <param name="busId">The bus ID the device is connected to.</param>
39+ public I2sConnectionSettings ( int busId )
40+ {
41+ BusId = busId ;
42+ }
43+
44+ internal I2sConnectionSettings ( I2sConnectionSettings other )
45+ {
46+ BusId = other . BusId ;
47+ Mode = other . Mode ;
48+ SampleRate = other . SampleRate ;
49+ CommunicationFormat = other . CommunicationFormat ;
50+ ChannelFormat = other . ChannelFormat ;
51+ BitsPerSample = other . BitsPerSample ;
52+ }
53+
54+ /// <summary>
55+ /// The bus ID the device is connected to.
56+ /// </summary>
57+ public int BusId
58+ {
59+ get => _busId ;
60+
61+ set
62+ {
63+ _busId = value ;
64+ }
65+ }
66+
67+ /// <summary>
68+ /// The I2Smode being used.
69+ /// </summary>
70+ public I2sMode Mode
71+ {
72+ get => _i2sMode ;
73+
74+ set
75+ {
76+ _i2sMode = value ;
77+ }
78+ }
79+
80+ /// <summary>
81+ /// Bits per sample
82+ /// </summary>
83+ public I2sBitsPerSample BitsPerSample
84+ {
85+ get => _i2sBitsPerSample ;
86+
87+ set
88+ {
89+ _i2sBitsPerSample = value ;
90+ }
91+ }
92+
93+ /// <summary>
94+ /// I2S Channel Format
95+ /// </summary>
96+ public I2sChannelFormat ChannelFormat
97+ {
98+ get => _i2sChannelFormat ;
99+
100+ set
101+ {
102+ _i2sChannelFormat = value ;
103+ }
104+ }
105+
106+ /// <summary>
107+ /// Specifies communication format on the I2Sbus.
108+ /// </summary>
109+ public I2sCommunicationFormat CommunicationFormat
110+ {
111+ get => _i2sConnectionFormat ;
112+
113+ set
114+ {
115+ _i2sConnectionFormat = value ;
116+ }
117+ }
118+
119+ /// <summary>
120+ /// Sample Rate.
121+ /// </summary>
122+ public int SampleRate
123+ {
124+ get => _sampleRate ;
125+
126+ set
127+ {
128+ _sampleRate = value ;
129+ }
130+ }
7131 }
8- }
132+ }
0 commit comments