Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
jobily
Iot
提交
7d9d4079
I
Iot
项目概览
jobily
/
Iot
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
I
Iot
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
7d9d4079
编写于
6月 01, 2020
作者:
K
Krzysztof Wicher
提交者:
GitHub
6月 01, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make System.Device.Gpio work on Mono (#1095)
上级
94424fc7
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
54 addition
and
4 deletion
+54
-4
src/System.Device.Gpio/System/Device/Gpio/Drivers/RaspberryPi3Driver.cs
...ice.Gpio/System/Device/Gpio/Drivers/RaspberryPi3Driver.cs
+11
-1
src/System.Device.Gpio/System/Device/I2c/I2cDevice.cs
src/System.Device.Gpio/System/Device/I2c/I2cDevice.cs
+13
-1
src/System.Device.Gpio/System/Device/Pwm/PwmChannel.cs
src/System.Device.Gpio/System/Device/Pwm/PwmChannel.cs
+17
-1
src/System.Device.Gpio/System/Device/Spi/SpiDevice.cs
src/System.Device.Gpio/System/Device/Spi/SpiDevice.cs
+13
-1
未找到文件。
src/System.Device.Gpio/System/Device/Gpio/Drivers/RaspberryPi3Driver.cs
浏览文件 @
7d9d4079
...
...
@@ -41,7 +41,7 @@ namespace System.Device.Gpio.Drivers
}
else
{
_internalDriver
=
new
Windows10
Driver
();
_internalDriver
=
CreateWindows10Gpio
Driver
();
_setSetRegister
=
(
value
)
=>
throw
new
PlatformNotSupportedException
();
_setClearRegister
=
(
value
)
=>
throw
new
PlatformNotSupportedException
();
_getSetRegister
=
()
=>
throw
new
PlatformNotSupportedException
();
...
...
@@ -49,6 +49,16 @@ namespace System.Device.Gpio.Drivers
}
}
[
MethodImpl
(
MethodImplOptions
.
NoInlining
)]
private
static
GpioDriver
CreateWindows10GpioDriver
()
{
// This wrapper is needed to prevent Mono from loading Windows10Driver
// which causes all fields to be loaded - one of such fields is WinRT type which does not
// exist on Linux which causes TypeLoadException.
// Using NoInlining and no explicit type prevents this from happening.
return
new
Windows10Driver
();
}
/// <inheritdoc/>
protected
internal
override
int
PinCount
=>
28
;
...
...
src/System.Device.Gpio/System/Device/I2c/I2cDevice.cs
浏览文件 @
7d9d4079
...
...
@@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using
System.Runtime.CompilerServices
;
namespace
System.Device.I2c
{
/// <summary>
...
...
@@ -67,7 +69,7 @@ namespace System.Device.I2c
{
if
(
Environment
.
OSVersion
.
Platform
==
PlatformID
.
Win32NT
)
{
return
new
Windows10I2cDevice
(
settings
);
return
Create
Windows10I2cDevice
(
settings
);
}
else
{
...
...
@@ -75,6 +77,16 @@ namespace System.Device.I2c
}
}
[
MethodImpl
(
MethodImplOptions
.
NoInlining
)]
private
static
I2cDevice
CreateWindows10I2cDevice
(
I2cConnectionSettings
settings
)
{
// This wrapper is needed to prevent Mono from loading Windows10I2cDevice
// which causes all fields to be loaded - one of such fields is WinRT type which does not
// exist on Linux which causes TypeLoadException.
// Using NoInlining and no explicit type prevents this from happening.
return
new
Windows10I2cDevice
(
settings
);
}
/// <inheritdoc cref="IDisposable.Dispose"/>
public
void
Dispose
()
{
...
...
src/System.Device.Gpio/System/Device/Pwm/PwmChannel.cs
浏览文件 @
7d9d4079
...
...
@@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using
System.Runtime.CompilerServices
;
namespace
System.Device.Pwm
{
/// <summary>
...
...
@@ -61,7 +63,7 @@ namespace System.Device.Pwm
{
if
(
Environment
.
OSVersion
.
Platform
==
PlatformID
.
Win32NT
)
{
return
new
Channels
.
Windows10PwmChannel
(
return
Create
Windows10PwmChannel
(
chip
,
channel
,
frequency
,
...
...
@@ -76,5 +78,19 @@ namespace System.Device.Pwm
dutyCyclePercentage
);
}
}
[
MethodImpl
(
MethodImplOptions
.
NoInlining
)]
private
static
PwmChannel
CreateWindows10PwmChannel
(
int
chip
,
int
channel
,
int
frequency
,
double
dutyCyclePercentage
)
{
// This wrapper is needed to prevent Mono from loading Windows10PwmChannel
// which causes all fields to be loaded - one of such fields is WinRT type which does not
// exist on Linux which causes TypeLoadException.
// Using NoInlining and no explicit type prevents this from happening.
return
new
Channels
.
Windows10PwmChannel
(
chip
,
channel
,
frequency
,
dutyCyclePercentage
);
}
}
}
src/System.Device.Gpio/System/Device/Spi/SpiDevice.cs
浏览文件 @
7d9d4079
...
...
@@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using
System.Runtime.CompilerServices
;
namespace
System.Device.Spi
{
/// <summary>
...
...
@@ -60,7 +62,7 @@ namespace System.Device.Spi
{
if
(
Environment
.
OSVersion
.
Platform
==
PlatformID
.
Win32NT
)
{
return
new
Windows10SpiDevice
(
settings
);
return
Create
Windows10SpiDevice
(
settings
);
}
else
{
...
...
@@ -68,6 +70,16 @@ namespace System.Device.Spi
}
}
[
MethodImpl
(
MethodImplOptions
.
NoInlining
)]
private
static
SpiDevice
CreateWindows10SpiDevice
(
SpiConnectionSettings
settings
)
{
// This wrapper is needed to prevent Mono from loading Windows10SpiDevice
// which causes all fields to be loaded - one of such fields is WinRT type which does not
// exist on Linux which causes TypeLoadException.
// Using NoInlining and no explicit type prevents this from happening.
return
new
Windows10SpiDevice
(
settings
);
}
/// <inheritdoc cref="IDisposable.Dispose"/>
public
void
Dispose
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录