Skip to content

Commit 2859000

Browse files
committed
Initial commit
1 parent 69d9c07 commit 2859000

File tree

6 files changed

+159
-1
lines changed

6 files changed

+159
-1
lines changed

System.Device.Adc/IAdcChannel.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//
2+
// Copyright (c) .NET Foundation and Contributors
3+
// See LICENSE file in the project root for full license information.
4+
//
5+
6+
namespace System.Device.Adc
7+
{
8+
internal interface IAdcChannel
9+
{
10+
int ReadValue();
11+
double ReadRatio();
12+
13+
AdcController Controller { get; }
14+
}
15+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//
2+
// Copyright (c) .NET Foundation and Contributors
3+
// See LICENSE file in the project root for full license information.
4+
//
5+
6+
namespace System.Device.Adc
7+
{
8+
internal interface IAdcController
9+
{
10+
bool IsChannelModeSupported(AdcChannelMode channelMode);
11+
AdcChannel OpenChannel(int channelNumber);
12+
13+
int ChannelCount { get; }
14+
AdcChannelMode ChannelMode { get; set; }
15+
int MaxValue { get; }
16+
int MinValue { get; }
17+
int ResolutionInBits { get; }
18+
}
19+
}
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
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;
7+
8+
namespace System.Device.Adc.Provider
9+
{
10+
public interface IAdcControllerProvider
11+
{
12+
/// <summary>
13+
/// Gets the number of channels available on for the controller.
14+
/// </summary>
15+
/// <value>
16+
/// Number of channels.
17+
/// </value>
18+
int ChannelCount { get; }
19+
20+
/// <summary>
21+
/// Gets or sets the controller channel mode.
22+
/// </summary>
23+
/// <value>
24+
/// The channel mode.
25+
/// </value>
26+
ProviderAdcChannelMode ChannelMode { get; set; }
27+
28+
/// <summary>
29+
/// Gets the maximum value that the controller can return.
30+
/// </summary>
31+
/// <value>
32+
/// The maximum value.
33+
/// </value>
34+
int MaxValue { get; }
35+
36+
/// <summary>
37+
/// Gets the minimum value that the controller can return.
38+
/// </summary>
39+
/// <value>
40+
/// The minimum value.
41+
/// </value>
42+
int MinValue { get; }
43+
44+
/// <summary>
45+
/// Acquires a connection to the specified channel.
46+
/// </summary>
47+
/// <param name="channel">
48+
/// Which channel to connect to.
49+
/// </param>
50+
void AcquireChannel(Int32 channel);
51+
52+
/// <summary>
53+
/// Determines if the specified channel mode is supported by the controller.
54+
/// </summary>
55+
/// <param name="channelMode">
56+
/// The channel mode in question.
57+
/// </param>
58+
/// <returns>
59+
/// True if the specified channel mode is supported, otherwise false.
60+
/// </returns>
61+
bool IsChannelModeSupported(ProviderAdcChannelMode channelMode);
62+
63+
/// <summary>
64+
/// Gets the digital representation of the analog value on the specified channel.
65+
/// </summary>
66+
/// <param name="channelNumber">
67+
/// Which channel to read from.
68+
/// </param>
69+
/// <returns>
70+
/// The digital representation of the analog value.
71+
/// </returns>
72+
int ReadValue(Int32 channelNumber);
73+
74+
/// <summary>
75+
/// Releases the channel connection, opening that channel for others to use.
76+
/// </summary>
77+
/// <param name="channel">
78+
/// Which channel to close the connection to.
79+
/// </param>
80+
void ReleaseChannel(Int32 channel)
81+
}
82+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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.Collections.Generic;
7+
8+
namespace System.Device.Adc.Provider
9+
{
10+
public interface IAdcProvider
11+
{
12+
/// <summary>
13+
/// Gets the ADC controllers available on the system.
14+
/// </summary>
15+
/// <returns>
16+
/// When this method completes it returns a list of all the available controllers on the system.
17+
/// </returns>
18+
IReadOnlyList<IAdcControllerProvider> GetControllers()
19+
}
20+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//
2+
// Copyright (c) .NET Foundation and Contributors
3+
// See LICENSE file in the project root for full license information.
4+
//
5+
6+
namespace System.Device.Adc.Provider
7+
{
8+
/// <summary>
9+
/// Determines how the pin value is represented. Implementation of specifics are decided by the provider, so differential may be fully or pseudo differential.
10+
/// </summary>
11+
public enum ProviderAdcChannelMode
12+
{
13+
/// <summary>
14+
/// Difference between two pins.
15+
/// </summary>
16+
Differential,
17+
/// <summary>
18+
/// Simple value of a particular pin.
19+
/// </summary>
20+
SingleEnded
21+
}
22+
}

System.Device.Adc/System.Device.Adc.nfproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,4 @@
7070
</PropertyGroup>
7171
<Error Condition="!Exists('..\packages\Nerdbank.GitVersioning.3.1.91\build\Nerdbank.GitVersioning.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Nerdbank.GitVersioning.3.1.91\build\Nerdbank.GitVersioning.targets'))" />
7272
</Target>
73-
</Project>
73+
</Project>

0 commit comments

Comments
 (0)