add Swan.Tiny and CodingStyles
This commit is contained in:
parent
2f1d949dcc
commit
c41f2043e2
@ -9,23 +9,20 @@ namespace Unosquare.WiringPi {
|
|||||||
/// Represents the Bootstrap class to extract resources.
|
/// Represents the Bootstrap class to extract resources.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <seealso cref="Unosquare.RaspberryIO.Abstractions.IBootstrap" />
|
/// <seealso cref="Unosquare.RaspberryIO.Abstractions.IBootstrap" />
|
||||||
public class BootstrapWiringPi : IBootstrap
|
public class BootstrapWiringPi : IBootstrap {
|
||||||
{
|
|
||||||
private static readonly Object SyncLock = new Object();
|
private static readonly Object SyncLock = new Object();
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public void Bootstrap()
|
public void Bootstrap() {
|
||||||
{
|
lock(SyncLock) {
|
||||||
lock (SyncLock)
|
|
||||||
{
|
|
||||||
Resources.EmbeddedResources.ExtractAll();
|
Resources.EmbeddedResources.ExtractAll();
|
||||||
|
|
||||||
DependencyContainer.Current.Register<IGpioController>(new GpioController());
|
_ = DependencyContainer.Current.Register<IGpioController>(new GpioController());
|
||||||
DependencyContainer.Current.Register<ISpiBus>(new SpiBus());
|
_ = DependencyContainer.Current.Register<ISpiBus>(new SpiBus());
|
||||||
DependencyContainer.Current.Register<II2CBus>(new I2CBus());
|
_ = DependencyContainer.Current.Register<II2CBus>(new I2CBus());
|
||||||
DependencyContainer.Current.Register<ISystemInfo>(new SystemInfo());
|
_ = DependencyContainer.Current.Register<ISystemInfo>(new SystemInfo());
|
||||||
DependencyContainer.Current.Register<ITiming>(new Timing());
|
_ = DependencyContainer.Current.Register<ITiming>(new Timing());
|
||||||
DependencyContainer.Current.Register<IThreading>(new Threading());
|
_ = DependencyContainer.Current.Register<IThreading>(new Threading());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -396,7 +396,7 @@ namespace Unosquare.WiringPi {
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="value">The value.</param>
|
/// <param name="value">The value.</param>
|
||||||
/// <returns>The awaitable task.</returns>
|
/// <returns>The awaitable task.</returns>
|
||||||
public Task WriteAsync(GpioPinValue value) => Task.Run(() => { this.Write(value); });
|
public Task WriteAsync(GpioPinValue value) => Task.Run(() => this.Write(value));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Writes the specified bit value.
|
/// Writes the specified bit value.
|
||||||
@ -413,7 +413,7 @@ namespace Unosquare.WiringPi {
|
|||||||
/// <returns>
|
/// <returns>
|
||||||
/// The awaitable task.
|
/// The awaitable task.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public Task WriteAsync(Boolean value) => Task.Run(() => { this.Write(value); });
|
public Task WriteAsync(Boolean value) => Task.Run(() => this.Write(value));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Writes the specified value. 0 for low, any other value for high
|
/// Writes the specified value. 0 for low, any other value for high
|
||||||
@ -428,7 +428,7 @@ namespace Unosquare.WiringPi {
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="value">The value.</param>
|
/// <param name="value">The value.</param>
|
||||||
/// <returns>The awaitable task.</returns>
|
/// <returns>The awaitable task.</returns>
|
||||||
public Task WriteAsync(Int32 value) => Task.Run(() => { this.Write(value); });
|
public Task WriteAsync(Int32 value) => Task.Run(() => this.Write(value));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Writes the specified value as an analog level.
|
/// Writes the specified value as an analog level.
|
||||||
@ -452,7 +452,7 @@ namespace Unosquare.WiringPi {
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="value">The value.</param>
|
/// <param name="value">The value.</param>
|
||||||
/// <returns>The awaitable task.</returns>
|
/// <returns>The awaitable task.</returns>
|
||||||
public Task WriteLevelAsync(Int32 value) => Task.Run(() => { this.WriteLevel(value); });
|
public Task WriteLevelAsync(Int32 value) => Task.Run(() => this.WriteLevel(value));
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ namespace Unosquare.WiringPi.Resources {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
using(Stream stream = typeof(EmbeddedResources).Assembly.GetManifestResourceStream(resourceName)) {
|
using Stream stream = typeof(EmbeddedResources).Assembly.GetManifestResourceStream(resourceName);
|
||||||
using(FileStream outputStream = File.OpenWrite(targetPath)) {
|
using(FileStream outputStream = File.OpenWrite(targetPath)) {
|
||||||
stream?.CopyTo(outputStream);
|
stream?.CopyTo(outputStream);
|
||||||
}
|
}
|
||||||
@ -53,4 +53,3 @@ namespace Unosquare.WiringPi.Resources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
@ -107,7 +107,7 @@ namespace Unosquare.WiringPi {
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="buffer">The buffer.</param>
|
/// <param name="buffer">The buffer.</param>
|
||||||
/// <returns>The awaitable task.</returns>
|
/// <returns>The awaitable task.</returns>
|
||||||
public Task WriteAsync(Byte[] buffer) => Task.Run(() => { this.Write(buffer); });
|
public Task WriteAsync(Byte[] buffer) => Task.Run(() => this.Write(buffer));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Retrieves the spi bus. If the bus channel is not registered it sets it up automatically.
|
/// Retrieves the spi bus. If the bus channel is not registered it sets it up automatically.
|
||||||
|
@ -19,8 +19,8 @@ namespace Unosquare.WiringPi {
|
|||||||
public Version LibraryVersion {
|
public Version LibraryVersion {
|
||||||
get {
|
get {
|
||||||
String[] libParts = Native.WiringPi.WiringPiLibrary.Split('.');
|
String[] libParts = Native.WiringPi.WiringPiLibrary.Split('.');
|
||||||
Int32 major = Int32.Parse(libParts[libParts.Length - 2]);
|
Int32 major = Int32.Parse(libParts[^2]);
|
||||||
Int32 minor = Int32.Parse(libParts[libParts.Length - 1]);
|
Int32 minor = Int32.Parse(libParts[^1]);
|
||||||
return new Version(major, minor);
|
return new Version(major, minor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
27
Unosquare.WiringPi/Unosquare.WiringPi.Tiny.csproj
Normal file
27
Unosquare.WiringPi/Unosquare.WiringPi.Tiny.csproj
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<Description>This library uses WiringPi to enables developers to use the various Raspberry Pi's hardware modules including the Camera to capture images and video, the GPIO pins, and both, the SPI and I2C buses.</Description>
|
||||||
|
<Copyright>Unosquare (c) 2016-2019</Copyright>
|
||||||
|
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||||
|
<AssemblyName>Unosquare.WiringPi</AssemblyName>
|
||||||
|
<PackageId>Unosquare.WiringPi</PackageId>
|
||||||
|
<Version>0.4.2</Version>
|
||||||
|
<Authors>Unosquare</Authors>
|
||||||
|
<PackageIconUrl>https://github.com/unosquare/wiringpi-dotnet/raw/master/logos/raspberryio-logo-32.png</PackageIconUrl>
|
||||||
|
<PackageProjectUrl>https://github.com/unosquare/wiringpi-dotnet</PackageProjectUrl>
|
||||||
|
<PackageLicenseUrl>https://raw.githubusercontent.com/unosquare/wiringpi-dotnet/master/LICENSE</PackageLicenseUrl>
|
||||||
|
<PackageTags>Raspberry Pi GPIO Camera SPI I2C Embedded IoT Mono C# .NET wiringPi</PackageTags>
|
||||||
|
<LangVersion>8.0</LangVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Include="Resources\gpio" />
|
||||||
|
<EmbeddedResource Include="Resources\libwiringPi.so.2.50" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Swan.Tiny\Swan.Tiny.csproj" />
|
||||||
|
<ProjectReference Include="..\Unosquare.RaspberryIO.Abstractions\Unosquare.RaspberryIO.Abstractions.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
@ -21,6 +21,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Swan.Lite\Swan.Lite.csproj" />
|
||||||
<ProjectReference Include="..\Swan\Swan.csproj" />
|
<ProjectReference Include="..\Swan\Swan.csproj" />
|
||||||
<ProjectReference Include="..\Unosquare.RaspberryIO.Abstractions\Unosquare.RaspberryIO.Abstractions.csproj" />
|
<ProjectReference Include="..\Unosquare.RaspberryIO.Abstractions\Unosquare.RaspberryIO.Abstractions.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
Loading…
Reference in New Issue
Block a user