-
Notifications
You must be signed in to change notification settings - Fork 598
/
Copy pathDummyGpioDriver.cs
98 lines (84 loc) · 3 KB
/
DummyGpioDriver.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Collections.Generic;
using System.Device.Gpio;
using System.Text;
using System.Threading;
namespace Iot.Device.Board
{
/// <summary>
/// A GPIO driver that has zero pins. Use to fulfill the interface.
/// </summary>
public class DummyGpioDriver : GpioDriver
{
/// <summary>
/// Returns 0
/// </summary>
protected override int PinCount => 0;
/// <inheritdoc />
protected override int ConvertPinNumberToLogicalNumberingScheme(int pinNumber)
{
return 0;
}
/// <summary>
/// There are no pins on this board, so this always throws an exception
/// </summary>
/// <param name="pinNumber">Pin number</param>
/// <exception cref="NotSupportedException">Always thrown: This board has no pins</exception>
protected override void OpenPin(int pinNumber)
{
throw new NotSupportedException("No such pin");
}
/// <inheritdoc />
protected override void ClosePin(int pinNumber)
{
throw new NotSupportedException("No such pin");
}
/// <inheritdoc />
protected override void SetPinMode(int pinNumber, PinMode mode)
{
throw new NotSupportedException("No such pin");
}
/// <inheritdoc />
protected override PinMode GetPinMode(int pinNumber)
{
throw new NotSupportedException("No such pin");
}
/// <inheritdoc />
protected override bool IsPinModeSupported(int pinNumber, PinMode mode)
{
throw new NotSupportedException("No such pin");
}
/// <inheritdoc />
protected override PinValue Read(int pinNumber)
{
throw new NotSupportedException("No such pin");
}
/// <inheritdoc />
protected override void Toggle(int pinNumber)
{
throw new NotSupportedException("No such pin");
}
/// <inheritdoc />
protected override void Write(int pinNumber, PinValue value)
{
throw new NotSupportedException("No such pin");
}
/// <inheritdoc />
protected override WaitForEventResult WaitForEvent(int pinNumber, PinEventTypes eventTypes, CancellationToken cancellationToken)
{
throw new NotSupportedException("No such pin");
}
/// <inheritdoc />
protected override void AddCallbackForPinValueChangedEvent(int pinNumber, PinEventTypes eventTypes, PinChangeEventHandler callback)
{
throw new NotSupportedException("No such pin");
}
/// <inheritdoc />
protected override void RemoveCallbackForPinValueChangedEvent(int pinNumber, PinChangeEventHandler callback)
{
throw new NotSupportedException("No such pin");
}
}
}