forked from dotnet/iot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
OrangePiZero2Driver.cs
35 lines (30 loc) · 1.38 KB
/
OrangePiZero2Driver.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
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
namespace Iot.Device.Gpio.Drivers
{
/// <summary>
/// A GPIO driver for the Orange Pi Zero 2.
/// </summary>
/// <remarks>
/// SoC: Allwinner H616 (sun50iw9p1)
/// </remarks>
public class OrangePiZero2Driver : Sun50iw9p1Driver
{
private static readonly int[] _pinNumberConverter = new int[]
{
-1, -1, -1, MapPinNumber('H', 5), -1, MapPinNumber('H', 4), -1, MapPinNumber('C', 9), MapPinNumber('H', 2), -1,
MapPinNumber('H', 3), MapPinNumber('C', 6), MapPinNumber('C', 11), MapPinNumber('C', 5), -1, MapPinNumber('C', 8),
MapPinNumber('C', 15), -1, MapPinNumber('C', 14), MapPinNumber('H', 7), -1, MapPinNumber('H', 8), MapPinNumber('C', 7),
MapPinNumber('H', 6), MapPinNumber('H', 9), -1, MapPinNumber('C', 10)
};
/// <inheritdoc/>
protected override int PinCount => 17;
/// <inheritdoc/>
protected override int ConvertPinNumberToLogicalNumberingScheme(int pinNumber)
{
int num = _pinNumberConverter[pinNumber];
return num != -1 ? num : throw new ArgumentException($"Board (header) pin {pinNumber} is not a GPIO pin on the {GetType().Name} device.", nameof(pinNumber));
}
}
}