This commit is contained in:
Laurent Ellerbach 2021-03-22 21:51:15 +01:00
Коммит 506be10e70
22 изменённых файлов: 1042 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,13 @@
user=nanoframework
project=lib-System.Device.Spi
issues=true
add_issues_wo_labels=false
add_pr_wo_labels=false
add_issues_wo_labels=false
filter_issues_by_milestone=false
exclude_labels=Area: Config-and-Build,Area: Infrastructure-and-Organization,reverted
enhancement_labels=Type: enhancement
bug_labels=Type: bug
merge_prefix=**Documentation and other chores:**
unreleased_label=**Changes available only in 'Preview' NuGet packages:**
author=false

255
.gitignore поставляемый Normal file
Просмотреть файл

@ -0,0 +1,255 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# DNX
project.lock.json
artifacts/
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignoreable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# JetBrains Rider
.idea/
*.sln.iml
#SoundCloud
*.sonarqube/

21
LICENSE Normal file
Просмотреть файл

@ -0,0 +1,21 @@
MIT License
Copyright (c) .NET Foundation and Contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

7
NuGet.Config Normal file
Просмотреть файл

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="NuGet" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="Azure Artifacts nanoFramework dev" value="https://pkgs.dev.azure.com/nanoframework/feed/_packaging/sandbox/nuget/v3/index.json" protocolVersion="3" />
</packageSources>
</configuration>

37
README.md Normal file
Просмотреть файл

@ -0,0 +1,37 @@
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=nanoframework_lib-System.Device.Spi&metric=alert_status)](https://sonarcloud.io/dashboard?id=nanoframework_lib-System.Device.Spi) [![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=nanoframework_lib-System.Device.Spi&metric=reliability_rating)](https://sonarcloud.io/dashboard?id=nanoframework_lib-System.Device.Spi) [![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE) [![NuGet](https://img.shields.io/nuget/dt/nanoFramework.System.Device.Spi.svg?label=NuGet&style=flat&logo=nuget)](https://www.nuget.org/packages/nanoFramework.System.Device.Spi/) [![#yourfirstpr](https://img.shields.io/badge/first--timers--only-friendly-blue.svg)](https://github.com/nanoframework/Home/blob/master/CONTRIBUTING.md)[![Discord](https://img.shields.io/discord/478725473862549535.svg?logo=discord&logoColor=white&label=Discord&color=7289DA)](https://discord.gg/gCyBu8T)
![nanoFramework logo](https://github.com/nanoframework/Home/blob/master/resources/logo/nanoFramework-repo-logo.png)
-----
### Welcome to the **nanoFramework** System.Device.Spi Library repository!
## Build status
| Component | Build Status | NuGet Package |
|:-|---|---|
| System.Device.Spi | [![Build Status](https://dev.azure.com/nanoframework/System.Device.Spi/_apis/build/status/nanoframework.lib-System.Device.Spi?branchName=develop)](https://dev.azure.com/nanoframework/System.Device.Spi/_build/latest?definitionId=7?branchName=master) | [![NuGet](https://img.shields.io/nuget/v/nanoFramework.System.Device.Spi.svg?label=NuGet&style=flat&logo=nuget)](https://www.nuget.org/packages/nanoFramework.System.Device.Spi/) |
| System.Device.Spi (preview) | [![Build Status](https://dev.azure.com/nanoframework/System.Device.Spi/_apis/build/status/nanoframework.lib-System.Device.Spi?branchName=develop)](https://dev.azure.com/nanoframework/System.Device.Spi/_build/latest?definitionId=7?branchName=develop) | [![](https://badgen.net/badge/NuGet/preview/D7B023?icon=https://simpleicons.now.sh/azuredevops/fff)](https://dev.azure.com/nanoframework/feed/_packaging?_a=package&feed=sandbox&package=nanoFramework.System.Device.Spi&protocolType=NuGet&view=overview) |
## Feedback and documentation
For documentation, providing feedback, issues and finding out how to contribute please refer to the [Home repo](https://github.com/nanoframework/Home).
Join our Discord community [here](https://discord.gg/gCyBu8T).
## Credits
The list of contributors to this project can be found at [CONTRIBUTORS](https://github.com/nanoframework/Home/blob/master/CONTRIBUTORS.md).
## License
The **nanoFramework** Class Libraries are licensed under the [MIT license](LICENSE.md).
## Code of Conduct
This project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behavior in our community.
For more information see the [.NET Foundation Code of Conduct](https://dotnetfoundation.org/code-of-conduct).
### .NET Foundation
This project is supported by the [.NET Foundation](https://dotnetfoundation.org).

Просмотреть файл

@ -0,0 +1,23 @@
//
// Copyright (c) .NET Foundation and Contributors
// See LICENSE file in the project root for full license information.
//
namespace System.Device.Spi
{
/// <summary>
/// Specifies order in which bits are transferred first on the SPI bus.
/// </summary>
public enum DataFlow
{
/// <summary>
/// Most significant bit will be sent first (most of the devices use this value).
/// </summary>
MsbFirst,
/// <summary>
/// Least significant bit will be sent first.
/// </summary>
LsbFirst,
}
}

Просмотреть файл

@ -0,0 +1,39 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("CSharp.BlankApplication")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CSharp.BlankApplication")]
[assembly: AssemblyCopyright("Copyright © ")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
/////////////////////////////////////////////////////////////////
// This attribute is mandatory when building Interop libraries //
// update this whenever the native assembly signature changes //
[assembly: AssemblyNativeVersion("1.0.0.0")]
/////////////////////////////////////////////////////////////////

Просмотреть файл

@ -0,0 +1,150 @@
//
// Copyright (c) .NET Foundation and Contributors
// See LICENSE file in the project root for full license information.
//
using System.Device.Gpio;
namespace System.Device.Spi
{
/// <summary>
/// The connection settings of a device on a SPI bus.
/// </summary>
public sealed class SpiConnectionSettings
{
private int _csLine;
private int _clockFrequency = 500_000; // 500 KHz
private int _databitLength = 8; // 1 byte
private SpiMode _spiMode = SpiMode.Mode0;
private SpiSharingMode _spiSharingMode;
private DataFlow _dataFlow = DataFlow.MsbFirst;
private int _busId;
/// <summary>
/// Initializes new instance of SpiConnectionSettings.
/// </summary>
/// <param name="chipSelectLine">The chip select line on which the connection will be made.</param>
private SpiConnectionSettings()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="SpiConnectionSettings"/> class.
/// </summary>
/// <param name="busId">The bus ID the device is connected to.</param>
/// <param name="chipSelectLine">The chip select line used on the bus. Optional, -1 if not used</param>
public SpiConnectionSettings(int busId, int chipSelectLine = -1)
{
BusId = busId;
ChipSelectLine = chipSelectLine;
}
internal SpiConnectionSettings(SpiConnectionSettings other)
{
BusId = other.BusId;
ChipSelectLine = other.ChipSelectLine;
Mode = other.Mode;
DataBitLength = other.DataBitLength;
ClockFrequency = other.ClockFrequency;
DataFlow = other.DataFlow;
ChipSelectLineActiveState = other.ChipSelectLineActiveState;
}
/// <summary>
/// The bus ID the device is connected to.
/// </summary>
public int BusId
{
get => _busId;
set
{
_busId = value;
}
}
/// <summary>
/// The chip select line used on the bus.
/// </summary>
public int ChipSelectLine
{
get => _csLine;
set
{
_csLine = value;
}
}
/// <summary>
/// The SPI mode being used.
/// </summary>
public SpiMode Mode
{
get => _spiMode;
set
{
_spiMode = value;
}
}
/// <summary>
/// The length of the data to be transfered.
/// </summary>
public int DataBitLength
{
get => _databitLength;
set
{
_databitLength = value;
}
}
/// <summary>
/// The frequency in which the data will be transferred.
/// </summary>
public int ClockFrequency
{
get => _clockFrequency;
set
{
_clockFrequency = value;
}
}
/// <summary>
/// Specifies order in which bits are transferred first on the SPI bus.
/// </summary>
public DataFlow DataFlow
{
get => _dataFlow;
set
{
_dataFlow = value;
}
}
/// <summary>
/// Specifies which value on chip select pin means "active".
/// </summary>
public PinValue ChipSelectLineActiveState { get; set; } = PinValue.Low;
/// <summary>
/// Gets or sets the sharing mode for the SPI connection.
/// </summary>
public SpiSharingMode SharingMode
{
get => _spiSharingMode;
set
{
_spiSharingMode = value;
}
}
}
}

Просмотреть файл

@ -0,0 +1,142 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System.Device.Spi
{
/// <summary>
/// The communications channel to a device on a SPI bus.
/// </summary>
public class SpiDevice : IDisposable
{
private Windows.Devices.Spi.SpiDevice _device;
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
private readonly SpiConnectionSettings _connectionSettings;
// For the ReadByte and WriteByte operations
private byte[] bufferSingleOperation = new byte[1];
/// <summary>
/// The connection settings of a device on a SPI bus. The connection settings are immutable after the device is created
/// so the object returned will be a clone of the settings object.
/// </summary>
public SpiConnectionSettings ConnectionSettings
{
get => new SpiConnectionSettings(_connectionSettings);
}
/// <summary>
/// Reads a byte from the SPI device.
/// </summary>
/// <returns>A byte read from the SPI device.</returns>
public byte ReadByte()
{
_device.Read(bufferSingleOperation);
return bufferSingleOperation[0];
}
/// <summary>
/// Reads data from the SPI device.
/// </summary>
/// <param name="buffer">
/// The buffer to read the data from the SPI device.
/// The length of the buffer determines how much data to read from the SPI device.
/// </param>
public void Read(SpanByte buffer)
{
// This is allocating an intermediate buffer and then copy back the data to
// the SpanByte. This is intend to be changed in a native implementation
byte[] toRead = new byte[buffer.Length];
_device.Read(toRead);
for (int i = 0; i < toRead.Length; i++)
{
buffer[i] = toRead[i];
}
}
/// <summary>
/// Writes a byte to the SPI device.
/// </summary>
/// <param name="value">The byte to be written to the SPI device.</param>
public void WriteByte(byte value)
{
bufferSingleOperation[0] = value;
_device.Write(bufferSingleOperation);
}
/// <summary>
/// Writes data to the SPI device.
/// </summary>
/// <param name="buffer">
/// The buffer that contains the data to be written to the SPI device.
/// </param>
public void Write(SpanByte buffer)
{
// This is allocating an intermediate buffer using the buffer of
// the SpanByte. This is intend to be changed in a native implementation
_device.Write(buffer.ToArray());
}
/// <summary>
/// Writes and reads data from the SPI device.
/// </summary>
/// <param name="writeBuffer">The buffer that contains the data to be written to the SPI device.</param>
/// <param name="readBuffer">The buffer to read the data from the SPI device.</param>
public void TransferFullDuplex(SpanByte writeBuffer, SpanByte readBuffer)
{
// This is allocating an intermediate buffer using the buffer of
// the SpanByte. This is intend to be changed in a native implementation
byte[] toRead = new byte[readBuffer.Length];
_device.TransferFullDuplex(writeBuffer.ToArray(), toRead);
for (int i = 0; i < toRead.Length; i++)
{
readBuffer[i] = toRead[i];
}
}
/// <summary>
/// Creates a communications channel to a device on a SPI bus running on the current hardware
/// </summary>
/// <param name="settings">The connection settings of a device on a SPI bus.</param>
/// <returns>A communications channel to a device on a SPI bus running on Windows 10 IoT.</returns>
public static SpiDevice Create(SpiConnectionSettings settings)
{
return new SpiDevice(settings);
}
/// <summary>
/// Creates a communications channel to a device on a SPI bus running on the current hardware
/// </summary>
/// <param name="settings">The connection settings of a device on a SPI bus.</param>
public SpiDevice(SpiConnectionSettings settings)
{
_connectionSettings = settings;
_device = Windows.Devices.Spi.SpiDevice.FromId($"SPI{settings.BusId}", new Windows.Devices.Spi.SpiConnectionSettings(settings.ChipSelectLine)
{
BitOrder = settings.DataFlow == DataFlow.MsbFirst ? Windows.Devices.Spi.DataBitOrder.MSB : Windows.Devices.Spi.DataBitOrder.LSB,
ClockFrequency = settings.ClockFrequency,
DataBitLength = settings.DataBitLength,
Mode = (Windows.Devices.Spi.SpiMode)settings.Mode,
SharingMode = (Windows.Devices.Spi.SpiSharingMode)settings.SharingMode
});
}
/// <summary>
/// Disposes this instance
/// </summary>
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
/// <summary>
/// Disposes this instance
/// </summary>
/// <param name="disposing"><see langword="true"/> if explicitly disposing, <see langword="false"/> if in finalizer</param>
protected void Dispose(bool disposing)
{
// Nothing to do in base class.
}
}
}

Просмотреть файл

@ -0,0 +1,35 @@
//
// Copyright (c) .NET Foundation and Contributors
// See LICENSE file in the project root for full license information.
//
namespace System.Device.Spi
{
/// <summary>
/// Defines how data is synchronized between devices on a SPI bus.
/// Clock Polarity (CPOL) determines if clock signal is low or high when in idle state.
/// Clock Phase (CPHA) determines when data is sampled relative to the clock signal.
/// </summary>
public enum SpiMode
{
/// <summary>
/// CPOL 0, CPHA 0. Polarity is idled low and data is sampled on rising edge of the clock signal.
/// </summary>
Mode0,
/// <summary>
/// CPOL 0, CPHA 1. Polarity is idled low and data is sampled on falling edge of the clock signal.
/// </summary>
Mode1,
/// <summary>
/// CPOL 1, CPHA 0. Polarity is idled high and data is sampled on falling edge of the clock signal.
/// </summary>
Mode2,
/// <summary>
/// CPOL 1, CPHA 1. Polarity is idled high and data is sampled on rising edge of the clock signal.
/// </summary>
Mode3
}
}

Просмотреть файл

@ -0,0 +1,23 @@
//
// Copyright (c) .NET Foundation and Contributors
// See LICENSE file in the project root for full license information.
//
namespace System.Device.Spi
{
/// <summary>
/// Defines the sharing mode for the SPI bus.
/// </summary>
public enum SpiSharingMode
{
/// <summary>
/// SPI bus segment is not shared.
/// </summary>
Exclusive,
/// <summary>
/// SPI bus is shared.
/// </summary>
Shared
}
}

Просмотреть файл

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="Globals">
<NanoFrameworkProjectSystemPath>$(MSBuildToolsPath)..\..\..\nanoFramework\v1.0\</NanoFrameworkProjectSystemPath>
</PropertyGroup>
<Import Project="$(NanoFrameworkProjectSystemPath)NFProjectSystem.Default.props" Condition="Exists('$(NanoFrameworkProjectSystemPath)NFProjectSystem.Default.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectTypeGuids>{11A8DD76-328B-46DF-9F39-F559912D0360};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<ProjectGuid>eaf5717b-f0a4-4707-893f-da560df13978</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<FileAlignment>512</FileAlignment>
<RootNamespace>System.Device.Spi</RootNamespace>
<AssemblyName>System.Device.Spi</AssemblyName>
<TargetFrameworkVersion>v1.0</TargetFrameworkVersion>
</PropertyGroup>
<Import Project="$(NanoFrameworkProjectSystemPath)NFProjectSystem.props" Condition="Exists('$(NanoFrameworkProjectSystemPath)NFProjectSystem.props')" />
<ItemGroup>
<Compile Include="DataFlow.cs" />
<Compile Include="SpiConnectionSettings.cs" />
<Compile Include="SpiDevice.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SpiMode.cs" />
<Compile Include="SpiSharingMode.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="mscorlib, Version=1.10.1.0, Culture=neutral, PublicKeyToken=c07d481e9758c731">
<HintPath>packages\nanoFramework.CoreLibrary.1.10.1-preview.11\lib\mscorlib.dll</HintPath>
<Private>True</Private>
<SpecificVersion>True</SpecificVersion>
</Reference>
<Reference Include="nanoFramework.Runtime.Events, Version=1.8.2.0, Culture=neutral, PublicKeyToken=c07d481e9758c731">
<HintPath>packages\nanoFramework.Runtime.Events.1.8.2-preview.5\lib\nanoFramework.Runtime.Events.dll</HintPath>
<Private>True</Private>
<SpecificVersion>True</SpecificVersion>
</Reference>
<Reference Include="System.Device.Gpio, Version=1.0.0.0, Culture=neutral, PublicKeyToken=c07d481e9758c731">
<HintPath>packages\nanoFramework.System.Device.Gpio.1.0.0-preview.4\lib\System.Device.Gpio.dll</HintPath>
<Private>True</Private>
<SpecificVersion>True</SpecificVersion>
</Reference>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(NanoFrameworkProjectSystemPath)NFProjectSystem.CSharp.targets" Condition="Exists('$(NanoFrameworkProjectSystemPath)NFProjectSystem.CSharp.targets')" />
<ProjectExtensions>
<ProjectCapabilities>
<ProjectConfigurationsDeclaredAsItems />
</ProjectCapabilities>
</ProjectExtensions>
</Project>

Просмотреть файл

@ -0,0 +1,27 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31105.61
MinimumVisualStudioVersion = 10.0.40219.1
Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "System.Device.Spi", "System.Device.Spi.nfproj", "{EAF5717B-F0A4-4707-893F-DA560DF13978}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{EAF5717B-F0A4-4707-893F-DA560DF13978}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EAF5717B-F0A4-4707-893F-DA560DF13978}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EAF5717B-F0A4-4707-893F-DA560DF13978}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{EAF5717B-F0A4-4707-893F-DA560DF13978}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EAF5717B-F0A4-4707-893F-DA560DF13978}.Release|Any CPU.Build.0 = Release|Any CPU
{EAF5717B-F0A4-4707-893F-DA560DF13978}.Release|Any CPU.Deploy.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C978C144-1CAB-4E05-9F22-C4BC081BCF17}
EndGlobalSection
EndGlobal

Просмотреть файл

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="mscorlib" publicKeyToken="c07d481e9758c731" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.10.1.0" newVersion="1.10.1.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

Двоичные данные
System.Device.Spi/key.snk Normal file

Двоичный файл не отображается.

Просмотреть файл

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="nanoFramework.CoreLibrary" version="1.10.1-preview.11" targetFramework="netnanoframework10" />
<package id="nanoFramework.Runtime.Events" version="1.8.2-preview.5" targetFramework="netnanoframework10" />
<package id="nanoFramework.System.Device.Gpio" version="1.0.0-preview.4" targetFramework="netnanoframework10" />
</packages>

Двоичные данные
assets/nf-logo.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 4.0 KiB

21
assets/readme.txt Normal file
Просмотреть файл

@ -0,0 +1,21 @@
_____ _
_ __ __ _ _ __ ___ | ___| __ __ _ _ __ ___ _____ _____ _ __| | __
| '_ \ / _` | '_ \ / _ \| |_ | '__/ _` | '_ ` _ \ / _ \ \ /\ / / _ \| '__| |/ /
| | | | (_| | | | | (_) | _|| | | (_| | | | | | | __/\ V V / (_) | | | <
|_| |_|\__,_|_| |_|\___/|_| |_| \__,_|_| |_| |_|\___| \_/\_/ \___/|_| |_|\_\
===================================================================================
API docs: https://docs.nanoframework.net/api
Browse our samples repository: https://github.com/nanoframework/samples
Check our documentation online: https://docs.nanoframework.net
Join our lively Discord community: https://discord.gg/gCyBu8T
Report issues: https://github.com/nanoframework/Home/issues
Follow us on Twitter: https://twitter.com/nanoframework
Follow our YouTube channel: https://www.youtube.com/c/nanoFramework

44
azure-pipelines.yml Normal file
Просмотреть файл

@ -0,0 +1,44 @@
trigger:
branches:
include: [master, develop, "release-*" ]
paths:
exclude: ["*.md", .gitignore]
tags:
include: ["v*"]
# PR always trigger build
# add nf-tools repo to resources (for Azure Pipelines templates)
resources:
repositories:
- repository: templates
type: github
name: nanoframework/nf-tools
endpoint: nanoframework
pool:
vmImage: 'VS2017-Win2016'
variables:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
nugetPackageName: 'nanoFramework.System.Device.Spi'
repoName: 'lib-System.Device.Spi'
steps:
# step from template @ nf-tools repo
# all build, update and publish steps
- template: azure-pipelines-templates/class-lib-build.yml@templates
parameters:
sonarCloudProject: 'nanoframework_lib-System.Device.Spi'
# step from template @ nf-tools repo
# report error
- template: azure-pipelines-templates/discord-webhook-task.yml@templates
parameters:
status: 'failure'
webhookUrl: '$(DiscordWebhook)'
message: ''

Просмотреть файл

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>nanoFramework.System.Device.Spi</id>
<version>$version$</version>
<title>nanoFramework.System.Device.Spi</title>
<authors>nanoFramework project contributors</authors>
<owners>nanoFramework project contributors</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<license type="expression">MIT</license>
<releaseNotes>
</releaseNotes>
<developmentDependency>false</developmentDependency>
<projectUrl>https://github.com/nanoframework/lib-System.Device.Spi</projectUrl>
<iconUrl>https://secure.gravatar.com/avatar/97d0e092247f0716db6d4b47b7d1d1ad</iconUrl>
<repository type="git" url="https://github.com/nanoframework/lib-System.Device.Spi" commit="$commit$" />
<copyright>Copyright (c) .NET Foundation and Contributors</copyright>
<description>This package includes the System.Device.Spi assembly for nanoFramework C# projects.
This package requires a target with System.Device.Spi v$nativeVersion$.</description>
<summary>System.Device.Spi assembly for nanoFramework C# projects</summary>
<tags>nanoFramework C# csharp netmf netnf System.Device.Spi</tags>
<dependencies>
<dependency id="nanoFramework.CoreLibrary" version="1.10.3-preview.7" />
</dependencies>
</metadata>
<files>
<file src="System.Device.Spi\bin\Release\System.Device.Spi.dll" target="lib\System.Device.Spi.dll" />
<file src="System.Device.Spi\bin\Release\System.Device.Spi.pdb" target="lib\System.Device.Spi.pdb" />
<file src="System.Device.Spi\bin\Release\System.Device.Spi.pdbx" target="lib\System.Device.Spi.pdbx" />
<file src="System.Device.Spi\bin\Release\System.Device.Spi.pe" target="lib\System.Device.Spi.pe" />
<file src="System.Device.Spi\bin\Release\System.Device.Spi.xml" target="lib\System.Device.Spi.xml" />
<!-- readme -->
<file src="readme.txt" target="readme.txt" />
</files>
</package>

74
template.vssettings Normal file
Просмотреть файл

@ -0,0 +1,74 @@
<UserSettings>
<ApplicationIdentity version="12.0"/>
<ToolsOptions>
<ToolsOptionsCategory name="TextEditor" RegisteredName="TextEditor">
<ToolsOptionsSubCategory name="AllLanguages" RegisteredName="AllLanguages" PackageName="Text Management Package"/>
<ToolsOptionsSubCategory name="CSharp" RegisteredName="CSharp" PackageName="Text Management Package">
<PropertyValue name="TabSize">4</PropertyValue>
<PropertyValue name="InsertTabs">false</PropertyValue>
<PropertyValue name="IndentSize">4</PropertyValue>
<PropertyValue name="BraceCompletion">true</PropertyValue>
</ToolsOptionsSubCategory>
<ToolsOptionsSubCategory name="CSharp-Specific" RegisteredName="CSharp-Specific" PackageName="Visual C# Language Service Package">
<PropertyValue name="NewLines_QueryExpression_EachClause">1</PropertyValue>
<PropertyValue name="Space_Normalize">0</PropertyValue>
<PropertyValue name="Space_AroundBinaryOperator">1</PropertyValue>
<PropertyValue name="Formatting_TriggerOnPaste">1</PropertyValue>
<PropertyValue name="NewLines_Braces_Method">1</PropertyValue>
<PropertyValue name="Indent_CaseLabels">1</PropertyValue>
<PropertyValue name="Formatting_TriggerOnBlockCompletion">1</PropertyValue>
<PropertyValue name="CodeDefinitionWindow_DocumentationComment_IndentOffset">2</PropertyValue>
<PropertyValue name="NewLines_Braces_ControlFlow">1</PropertyValue>
<PropertyValue name="NewLines_Braces_AnonymousMethod">0</PropertyValue>
<PropertyValue name="Space_WithinOtherParentheses">0</PropertyValue>
<PropertyValue name="Wrapping_KeepStatementsOnSingleLine">1</PropertyValue>
<PropertyValue name="Space_AfterBasesColon">1</PropertyValue>
<PropertyValue name="Indent_Braces">0</PropertyValue>
<PropertyValue name="Wrapping_IgnoreSpacesAroundVariableDeclaration">0</PropertyValue>
<PropertyValue name="Space_WithinMethodCallParentheses">0</PropertyValue>
<PropertyValue name="Space_AfterCast">0</PropertyValue>
<PropertyValue name="NewLines_Braces_CollectionInitializer">0</PropertyValue>
<PropertyValue name="NewLines_AnonymousTypeInitializer_EachMember">1</PropertyValue>
<PropertyValue name="NewLines_Keywords_Catch">1</PropertyValue>
<PropertyValue name="NewLines_Braces_ObjectInitializer">0</PropertyValue>
<PropertyValue name="NewLines_Braces_ArrayInitializer">0</PropertyValue>
<PropertyValue name="Space_WithinExpressionParentheses">0</PropertyValue>
<PropertyValue name="Space_InControlFlowConstruct">1</PropertyValue>
<PropertyValue name="Formatting_TriggerOnStatementCompletion">0</PropertyValue>
<PropertyValue name="NewLines_Keywords_Finally">1</PropertyValue>
<PropertyValue name="Space_BetweenEmptyMethodDeclarationParentheses">0</PropertyValue>
<PropertyValue name="Indent_UnindentLabels">0</PropertyValue>
<PropertyValue name="NewLines_ObjectInitializer_EachMember">1</PropertyValue>
<PropertyValue name="NewLines_Keywords_Else">1</PropertyValue>
<PropertyValue name="Space_WithinMethodDeclarationParentheses">0</PropertyValue>
<PropertyValue name="Space_BetweenEmptyMethodCallParentheses">0</PropertyValue>
<PropertyValue name="Space_BeforeSemicolonsInForStatement">0</PropertyValue>
<PropertyValue name="Space_BeforeComma">0</PropertyValue>
<PropertyValue name="Space_AfterMethodCallName">0</PropertyValue>
<PropertyValue name="Space_AfterComma">1</PropertyValue>
<PropertyValue name="Wrapping_IgnoreSpacesAroundBinaryOperators">0</PropertyValue>
<PropertyValue name="Space_BeforeBasesColon">1</PropertyValue>
<PropertyValue name="Space_AfterMethodDeclarationName">0</PropertyValue>
<PropertyValue name="Space_AfterDot">0</PropertyValue>
<PropertyValue name="NewLines_Braces_Type">1</PropertyValue>
<PropertyValue name="Space_AfterLambdaArrow">1</PropertyValue>
<PropertyValue name="NewLines_Braces_LambdaExpressionBody">0</PropertyValue>
<PropertyValue name="Space_WithinSquares">0</PropertyValue>
<PropertyValue name="Space_BeforeLambdaArrow">1</PropertyValue>
<PropertyValue name="NewLines_Braces_AnonymousTypeInitializer">0</PropertyValue>
<PropertyValue name="Space_WithinCastParentheses">0</PropertyValue>
<PropertyValue name="Space_AfterSemicolonsInForStatement">1</PropertyValue>
<PropertyValue name="Indent_CaseContents">0</PropertyValue>
<PropertyValue name="Indent_FlushLabelsLeft">1</PropertyValue>
<PropertyValue name="Wrapping_PreserveSingleLine">1</PropertyValue>
<PropertyValue name="Space_BetweenEmptySquares">0</PropertyValue>
<PropertyValue name="Space_BeforeOpenSquare">0</PropertyValue>
<PropertyValue name="Space_BeforeDot">0</PropertyValue>
<PropertyValue name="Indent_BlockContents">1</PropertyValue>
<PropertyValue name="SortUsings_PlaceSystemFirst">1</PropertyValue>
<PropertyValue name="SortUsings">1</PropertyValue>
<PropertyValue name="RemoveUnusedUsings">1</PropertyValue>
</ToolsOptionsSubCategory>
</ToolsOptionsCategory>
</ToolsOptions>
</UserSettings>

24
version.json Normal file
Просмотреть файл

@ -0,0 +1,24 @@
{
"$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
"version": "1.0.0-preview.{height}",
"assemblyVersion": {
"precision": "revision"
},
"semVer1NumericIdentifierPadding": 3,
"nuGetPackageVersion": {
"semVer": 2.0
},
"publicReleaseRefSpec": [
"^refs/heads/master$",
"^refs/heads/v\\d+(?:\\.\\d+)?$"
],
"cloudBuild": {
"setAllVariables": true,
"buildNumber": null
},
"release": {
"branchName": "release-v{version}",
"versionIncrement": "build",
"firstUnstableTag": "preview"
}
}