Skip to content
Snippets Groups Projects
Commit 2238998b authored by philip.schell's avatar philip.schell
Browse files

[NF] Lora

parents
No related branches found
No related tags found
No related merge requests found
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{85A78B05-5843-4E4D-8C56-4BCB12613750}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Fraunhofer.Fit.Iot.Lora</RootNamespace>
<AssemblyName>Lora</AssemblyName>
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="Unosquare.RaspberryIO, Version=0.14.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\Lora-Bot\packages\Unosquare.Raspberry.IO.0.14.0\lib\net452\Unosquare.RaspberryIO.dll</HintPath>
</Reference>
<Reference Include="Unosquare.Swan, Version=0.28.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\Lora-Bot\packages\Unosquare.Swan.0.28.1\lib\net452\Unosquare.Swan.dll</HintPath>
</Reference>
<Reference Include="Unosquare.Swan.Lite, Version=0.28.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\Lora-Bot\packages\Unosquare.Swan.Lite.0.28.0\lib\net452\Unosquare.Swan.Lite.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="lib\LoraConnector.cs" />
<Compile Include="LoraController.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Fraunhofer.Fit.Iot.Lora.lib;
namespace Fraunhofer.Fit.Iot.Lora {
public class LoraController {
public LoraController() {
LoraConnector l = new LoraConnector();
}
}
}
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die einer Assembly zugeordnet sind.
[assembly: AssemblyTitle("Lora")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Lora")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly
// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von
// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen.
[assembly: ComVisible(false)]
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
[assembly: Guid("85a78b05-5843-4e4d-8c56-4bcb12613750")]
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
//
// Hauptversion
// Nebenversion
// Buildnummer
// Revision
//
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
// indem Sie "*" wie unten gezeigt eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Unosquare.RaspberryIO;
using Unosquare.RaspberryIO.Gpio;
namespace Fraunhofer.Fit.Iot.Lora.lib {
public class LoraConnector {
enum Registers : Byte {
REG_VERSION = 0x42
};
public LoraConnector() {
Pi.Spi.Channel0Frequency = SpiChannel.MinFrequency;
//ssPin = 6;
Pi.Gpio.Pin06.PinMode = GpioPinDriveMode.Output;
//RST = 0;
Pi.Gpio.Pin00.PinMode = GpioPinDriveMode.Output;
Pi.Gpio.Pin00.Write(false);
System.Threading.Thread.Sleep(100);
Pi.Gpio.Pin00.Write(true);
System.Threading.Thread.Sleep(100);
Byte version = ReadRegister((Byte)Registers.REG_VERSION);
Console.WriteLine(version);
}
private Byte ReadRegister(Byte address) {
return this.SingleTransfer((Byte)(address & 0x7F), 0x00);
}
private void WriteRegister(Byte address, Byte value) {
this.SingleTransfer((Byte)(address | 0x80), value);
}
private Byte SingleTransfer(Byte address, Byte value) {
Selectreceiver();
Byte[] spibuf = Pi.Spi.Channel0.SendReceive(new Byte[] { address, 0x00 });
Unselectreceiver();
return spibuf[1];
}
private void Selectreceiver() {
Pi.Gpio.Pin06.Write(false);
}
private void Unselectreceiver() {
Pi.Gpio.Pin06.Write(true);
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Unosquare.Raspberry.IO" version="0.14.0" targetFramework="net471" />
<package id="Unosquare.Swan" version="0.28.1" targetFramework="net471" />
<package id="Unosquare.Swan.Lite" version="0.28.0" targetFramework="net471" />
</packages>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment