Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/nf-telemetry-clients/Clients/RipTide.Nfirmware/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Diagnostics;
using System.Drawing;
using System.Threading;
using TelemetryStash.Ds18b20Sensor;

namespace RipTide.Nfirmware
{
Expand All @@ -26,6 +27,9 @@ public static void Main()
Thread.Sleep(TimeSpan.FromMinutes(1));
}

var ds18b20 = new Ds18b20Sensor();
ds18b20.RunDemo();

var neo = new NeoPixelGauge(pixelsCount: 45, new[] { Color.Green, Color.Yellow, Color.Red }, pin: 11);
neo.DemoRun();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
</Reference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Peripherals\Ds18b20.Sensor\Ds18b20.Sensor.nfproj" />
<ProjectReference Include="..\..\Peripherals\NeoPixel.Peripheral\NeoPixel.Peripheral.nfproj" />
<ProjectReference Include="..\..\Shared\Client.Services\Client.Services.nfproj" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="Globals">
<NanoFrameworkProjectSystemPath>$(MSBuildExtensionsPath)\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>de298f11-0961-430e-8fa5-0f2bd5f4997d</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<FileAlignment>512</FileAlignment>
<RootNamespace>TelemetryStash.Ds18b20Sensor</RootNamespace>
<AssemblyName>Ts.Ds18b20.Sensor</AssemblyName>
<TargetFrameworkVersion>v1.0</TargetFrameworkVersion>
<AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>
<NuGetAudit>true</NuGetAudit>
<NuGetAuditMode>direct</NuGetAuditMode>
<NuGetAuditLevel>low</NuGetAuditLevel>
</PropertyGroup>
<Import Project="$(NanoFrameworkProjectSystemPath)NFProjectSystem.props" Condition="Exists('$(NanoFrameworkProjectSystemPath)NFProjectSystem.props')" />
<ItemGroup>
<Compile Include="Ds18b20Sensor.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="Iot.Device.Ds18b20">
<HintPath>..\..\packages\nanoFramework.Iot.Device.Ds18b20.1.0.726\lib\Iot.Device.Ds18b20.dll</HintPath>
</Reference>
<Reference Include="mscorlib">
<HintPath>..\..\packages\nanoFramework.CoreLibrary.1.16.11\lib\mscorlib.dll</HintPath>
</Reference>
<Reference Include="nanoFramework.Device.OneWire">
<HintPath>..\..\packages\nanoFramework.Device.OneWire.1.4.32\lib\nanoFramework.Device.OneWire.dll</HintPath>
</Reference>
<Reference Include="nanoFramework.Hardware.Esp32">
<HintPath>..\..\packages\nanoFramework.Hardware.Esp32.1.6.29\lib\nanoFramework.Hardware.Esp32.dll</HintPath>
</Reference>
<Reference Include="nanoFramework.Runtime.Events">
<HintPath>..\..\packages\nanoFramework.Runtime.Events.1.11.29\lib\nanoFramework.Runtime.Events.dll</HintPath>
</Reference>
<Reference Include="System.Device.Model">
<HintPath>..\..\packages\nanoFramework.System.Device.Model.1.2.771\lib\System.Device.Model.dll</HintPath>
</Reference>
<Reference Include="UnitsNet.Temperature">
<HintPath>..\..\packages\UnitsNet.nanoFramework.Temperature.5.69.0\lib\UnitsNet.Temperature.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(NanoFrameworkProjectSystemPath)NFProjectSystem.CSharp.targets" Condition="Exists('$(NanoFrameworkProjectSystemPath)NFProjectSystem.CSharp.targets')" />
<ProjectExtensions>
<ProjectCapabilities>
<ProjectConfigurationsDeclaredAsItems />
</ProjectCapabilities>
</ProjectExtensions>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
using Iot.Device.Ds18b20;
using nanoFramework.Device.OneWire;
using nanoFramework.Hardware.Esp32;
using System;
using System.Threading;

namespace TelemetryStash.Ds18b20Sensor
{
public class Ds18b20Sensor
{
public Ds18b20Sensor()
{
Configuration.SetPinFunction(18, DeviceFunction.COM2_RX);
Configuration.SetPinFunction(17, DeviceFunction.COM2_TX);
}

public void RunDemo()
{
var oneWire = new OneWireHost();

var ds18b20 = new Ds18b20(oneWire, null, false, TemperatureResolution.VeryHigh)
{
IsAlarmSearchCommandEnabled = false
};

if (ds18b20.Initialize())
{
Console.WriteLine($"Is sensor parasite powered?:{ds18b20.IsParasitePowered}");
string devAddrStr = "";
foreach (var addrByte in ds18b20.Address)
{
devAddrStr += addrByte.ToString("X2");
}

Console.WriteLine($"Sensor address:{devAddrStr}");

while (true)
{
if (!ds18b20.TryReadTemperature(out var currentTemperature))
{
Console.WriteLine("Can't read!");
}
else
{
Console.WriteLine($"Temperature: {currentTemperature.DegreesCelsius.ToString("F")}\u00B0C");
}

Thread.Sleep(5000);
}
}

oneWire.Dispose();
}
}
}
Original file line number Diff line number Diff line change
@@ -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.TestApplication")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CSharp.TestApplication")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[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")]
/////////////////////////////////////////////////////////////////
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="nanoFramework.CoreLibrary" version="1.16.11" targetFramework="netnano1.0" />
<package id="nanoFramework.Device.OneWire" version="1.4.32" targetFramework="netnano1.0" />
<package id="nanoFramework.Hardware.Esp32" version="1.6.29" targetFramework="netnano1.0" />
<package id="nanoFramework.Iot.Device.Ds18b20" version="1.0.726" targetFramework="netnano1.0" />
<package id="nanoFramework.Runtime.Events" version="1.11.29" targetFramework="netnano1.0" />
<package id="nanoFramework.System.Device.Model" version="1.2.771" targetFramework="netnano1.0" />
<package id="UnitsNet.nanoFramework.Temperature" version="5.69.0" targetFramework="netnano1.0" />
</packages>
9 changes: 9 additions & 0 deletions src/nf-telemetry-clients/TelemetryStash.NfClients.sln
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "RipTide.Nfirmware", "Client
EndProject
Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NeoPixel.Peripheral", "Peripherals\NeoPixel.Peripheral\NeoPixel.Peripheral.nfproj", "{CC3F20B1-1B1E-45C1-AC32-AD400AE75CD3}"
EndProject
Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "Ds18b20.Sensor", "Peripherals\Ds18b20.Sensor\Ds18b20.Sensor.nfproj", "{DE298F11-0961-430E-8FA5-0F2BD5F4997D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -162,6 +164,12 @@ Global
{CC3F20B1-1B1E-45C1-AC32-AD400AE75CD3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CC3F20B1-1B1E-45C1-AC32-AD400AE75CD3}.Release|Any CPU.Build.0 = Release|Any CPU
{CC3F20B1-1B1E-45C1-AC32-AD400AE75CD3}.Release|Any CPU.Deploy.0 = Release|Any CPU
{DE298F11-0961-430E-8FA5-0F2BD5F4997D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DE298F11-0961-430E-8FA5-0F2BD5F4997D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DE298F11-0961-430E-8FA5-0F2BD5F4997D}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{DE298F11-0961-430E-8FA5-0F2BD5F4997D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DE298F11-0961-430E-8FA5-0F2BD5F4997D}.Release|Any CPU.Build.0 = Release|Any CPU
{DE298F11-0961-430E-8FA5-0F2BD5F4997D}.Release|Any CPU.Deploy.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -187,6 +195,7 @@ Global
{744E774D-535E-4603-B19D-FA665857BFE3} = {6D5155B9-7C65-4C8A-BE4A-73CEEB67A6CA}
{78162167-EDF3-4774-870C-763141F9EB34} = {C54DF9D6-E23A-4AB3-968F-9E9519B0A099}
{CC3F20B1-1B1E-45C1-AC32-AD400AE75CD3} = {5505F7B6-DDA0-414F-8BC5-1AC87CDF3928}
{DE298F11-0961-430E-8FA5-0F2BD5F4997D} = {5505F7B6-DDA0-414F-8BC5-1AC87CDF3928}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {303CCAD6-C43B-419F-ACC3-FAE0574C1931}
Expand Down
Loading