Skip to content

Commit f5caaff

Browse files
rkalwakEllerbachjosesimoes
authored
MS5611 sensor library (#232)
* MS5611 sensor library Library for MS5611 sensor, used in GY-63 module, Signed-off-by: Rafał Kałwak <[email protected]> * Project fix for MS5611 sensor library Added proper assembly name. Signed-off-by: Rafał Kałwak <[email protected]> Signed-off-by: Rafał <Kałwak> * Project fix for MS5611 sensor library Added proper documentation file. Signed-off-by: Rafał Kałwak <[email protected]> Signed-off-by: Rafał <Kałwak> * Resolving PR comments Renamed CommandAddresses enum, added all registers values in place, renamed library to follow naming convention Signed-off-by: Rafał Kałwak <[email protected]> Signed-off-by: Rafał <Kałwak> * Resolving PR comments Updated namespaces Signed-off-by: Rafał Kałwak <[email protected]> Signed-off-by: Rafał <Kałwak> * Resolving PR comments Empty space and summary from nuspec file removal Signed-off-by: Rafał Kałwak <[email protected]> Signed-off-by: Rafał <Kałwak> Co-authored-by: r <a> Co-authored-by: Rafał <Kałwak> Co-authored-by: Laurent Ellerbach <[email protected]> Co-authored-by: José Simões <[email protected]>
1 parent e71b414 commit f5caaff

17 files changed

+765
-0
lines changed

devices/MS5611/CalibrationData.cs

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
namespace Iot.Device.Ms5611
5+
{
6+
/// <summary>
7+
/// MS5611 calibration data. Check data sheet, page 7, read calibration data from PROM section
8+
/// </summary>
9+
internal class CalibrationData
10+
{
11+
public int PressureSensitivity { get; private set; }
12+
public int PressureOffset { get; private set; }
13+
public int TemperatureCoefficientOfPressureSensitivity { get; private set; }
14+
public int TemperatureCoefficientOfPressureOffset { get; private set; }
15+
public int ReferenceTemperature { get; private set; }
16+
public int TemperatureCoefficientOfTheTemperature { get; private set; }
17+
18+
/// <summary>
19+
/// Reads data from device.
20+
/// </summary>
21+
/// <param name="ms5611">Sensor object</param>
22+
internal void ReadFromDevice(Ms5611 ms5611)
23+
{
24+
PressureSensitivity = ms5611.ReadRegister(CommandAddress.PressureSensitivity);
25+
PressureOffset = ms5611.ReadRegister(CommandAddress.PressureOffset);
26+
TemperatureCoefficientOfPressureSensitivity = ms5611.ReadRegister(CommandAddress.TemperatureCoefficientOfPressureSensitivity);
27+
TemperatureCoefficientOfPressureOffset = ms5611.ReadRegister(CommandAddress.TemperatureCoefficientOfPressureOffset);
28+
ReferenceTemperature = ms5611.ReadRegister(CommandAddress.ReferenceTemperature);
29+
TemperatureCoefficientOfTheTemperature = ms5611.ReadRegister(CommandAddress.TemperatureCoefficientOfTheTemperature);
30+
}
31+
}
32+
}

devices/MS5611/CommandAddress.cs

+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
namespace Iot.Device.Ms5611
5+
{
6+
/// <summary>
7+
/// MS5611 command addresses
8+
/// </summary>
9+
internal enum CommandAddress : byte
10+
{
11+
/// <summary>
12+
/// ADC read
13+
/// </summary>
14+
AdcRead = 0x00,
15+
16+
/// <summary>
17+
/// Reset
18+
/// </summary>
19+
Reset = 0x1E,
20+
21+
/// <summary>
22+
/// Sampling rate for pressure
23+
/// </summary>
24+
SamplingRatePressure = 0x40,
25+
26+
/// <summary>
27+
/// Sampling rate for temperature
28+
/// </summary>
29+
SamplingRateTemperature = 0x50,
30+
31+
/// <summary>
32+
/// Read PROM command
33+
/// </summary>
34+
ReadProm = 0xA2,
35+
36+
/// <summary>
37+
/// Calibration data - pressure sensitivity
38+
/// </summary>
39+
PressureSensitivity = 0xA2,
40+
41+
/// <summary>
42+
/// Calibration data - pressure offset
43+
/// </summary>
44+
PressureOffset = 0xA4,
45+
46+
/// <summary>
47+
/// Calibration data - temperature coefficient of pressure sensitivity
48+
/// </summary>
49+
TemperatureCoefficientOfPressureSensitivity = 0xA6,
50+
51+
/// <summary>
52+
/// Calibration data - temperature coefficient of pressure offset
53+
/// </summary>
54+
TemperatureCoefficientOfPressureOffset = 0xA8,
55+
56+
/// <summary>
57+
/// Calibration data - reference temperature
58+
/// </summary>
59+
ReferenceTemperature = 0xAA,
60+
61+
/// <summary>
62+
/// Calibration data - temperature coefficient of the temperature
63+
/// </summary>
64+
TemperatureCoefficientOfTheTemperature = 0xAC,
65+
66+
/// <summary>
67+
/// Low sampling rate temperature
68+
/// </summary>
69+
LowSamplingRateTemperature = 0x52,
70+
71+
/// <summary>
72+
/// Standard sampling rate temperature
73+
/// </summary>
74+
StandardSamplingRateTemperature = 0x54,
75+
76+
/// <summary>
77+
/// High sampling rate temperature
78+
/// </summary>
79+
HighSamplingRateTemperature = 0x56,
80+
81+
/// <summary>
82+
/// Ultra high sampling rate temperature
83+
/// </summary>
84+
UltraHighSamplingRateTemperature = 0x58,
85+
86+
/// <summary>
87+
/// Low sampling rate pressure
88+
/// </summary>
89+
LowSamplingRatePressure = 0x42,
90+
91+
/// <summary>
92+
/// Standard sampling rate pressure
93+
/// </summary>
94+
StandardSamplingRatePressure = 0x44,
95+
96+
/// <summary>
97+
/// High sampling rate pressure
98+
/// </summary>
99+
HighSamplingRatePressure = 0x46,
100+
101+
/// <summary>
102+
/// Ultra high sampling rate pressure
103+
/// </summary>
104+
UltraHighSamplingRatePressure = 0x48
105+
}
106+
}

devices/MS5611/MS5611.fzz

71.5 KB
Binary file not shown.

devices/MS5611/MS5611.nfproj

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="Current" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup Label="Globals">
4+
<NanoFrameworkProjectSystemPath>$(MSBuildExtensionsPath)\nanoFramework\v1.0\</NanoFrameworkProjectSystemPath>
5+
</PropertyGroup>
6+
<Import Project="$(NanoFrameworkProjectSystemPath)NFProjectSystem.Default.props" Condition="Exists('$(NanoFrameworkProjectSystemPath)NFProjectSystem.Default.props')" />
7+
<PropertyGroup>
8+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
9+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
10+
<ProjectTypeGuids>{11A8DD76-328B-46DF-9F39-F559912D0360};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
11+
<ProjectGuid>0c60f241-931d-4608-aa6c-0476b8a7b876</ProjectGuid>
12+
<OutputType>Library</OutputType>
13+
<AppDesignerFolder>Properties</AppDesignerFolder>
14+
<FileAlignment>512</FileAlignment>
15+
<RootNamespace>Iot.Device.Ms5611</RootNamespace>
16+
<AssemblyName>Iot.Device.Ms5611</AssemblyName>
17+
<TargetFrameworkVersion>v1.0</TargetFrameworkVersion>
18+
<DocumentationFile>bin\$(Configuration)\Iot.Device.Ms5611.xml</DocumentationFile>
19+
<LangVersion>9.0</LangVersion>
20+
</PropertyGroup>
21+
<Import Project="$(NanoFrameworkProjectSystemPath)NFProjectSystem.props" Condition="Exists('$(NanoFrameworkProjectSystemPath)NFProjectSystem.props')" />
22+
<ItemGroup>
23+
<Compile Include="CalibrationData.cs" />
24+
<Compile Include="CommandAddress.cs" />
25+
<Compile Include="Ms5611.cs" />
26+
<Compile Include="Properties\AssemblyInfo.cs" />
27+
<Compile Include="Sampling.cs" />
28+
</ItemGroup>
29+
<ItemGroup>
30+
<Reference Include="mscorlib">
31+
<HintPath>packages\nanoFramework.CoreLibrary.1.11.7\lib\mscorlib.dll</HintPath>
32+
</Reference>
33+
<Reference Include="System.Device.I2c">
34+
<HintPath>packages\nanoFramework.System.Device.I2c.1.0.2\lib\System.Device.I2c.dll</HintPath>
35+
</Reference>
36+
<Reference Include="System.Math">
37+
<HintPath>packages\nanoFramework.System.Math.1.4.3\lib\System.Math.dll</HintPath>
38+
</Reference>
39+
<Reference Include="UnitsNet.Length">
40+
<HintPath>packages\UnitsNet.nanoFramework.Length.4.112.0\lib\UnitsNet.Length.dll</HintPath>
41+
</Reference>
42+
<Reference Include="UnitsNet.Pressure">
43+
<HintPath>packages\UnitsNet.nanoFramework.Pressure.4.112.0\lib\UnitsNet.Pressure.dll</HintPath>
44+
</Reference>
45+
<Reference Include="UnitsNet.RelativeHumidity">
46+
<HintPath>packages\UnitsNet.nanoFramework.RelativeHumidity.4.112.0\lib\UnitsNet.RelativeHumidity.dll</HintPath>
47+
</Reference>
48+
<Reference Include="UnitsNet.Temperature">
49+
<HintPath>packages\UnitsNet.nanoFramework.Temperature.4.112.0\lib\UnitsNet.Temperature.dll</HintPath>
50+
</Reference>
51+
</ItemGroup>
52+
<ItemGroup>
53+
<None Include="packages.config" />
54+
<None Include="README.md" />
55+
</ItemGroup>
56+
<ItemGroup>
57+
<Compile Include="Properties\AssemblyInfo.cs" />
58+
<None Include="*.md" />
59+
</ItemGroup>
60+
<Import Project="..\..\src\System.Device.Model\System.Device.Model.projitems" Label="Shared" />
61+
<Import Project="..\..\src\Iot.Device.Common\Iot.Device.Common.projitems" Label="Shared" />
62+
<Import Project="$(NanoFrameworkProjectSystemPath)NFProjectSystem.CSharp.targets" Condition="Exists('$(NanoFrameworkProjectSystemPath)NFProjectSystem.CSharp.targets')" />
63+
<ProjectExtensions>
64+
<ProjectCapabilities>
65+
<ProjectConfigurationsDeclaredAsItems />
66+
</ProjectCapabilities>
67+
</ProjectExtensions>
68+
<Import Project="packages\Nerdbank.GitVersioning.3.4.194\build\Nerdbank.GitVersioning.targets" Condition="Exists('packages\Nerdbank.GitVersioning.3.4.194\build\Nerdbank.GitVersioning.targets')" />
69+
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
70+
<PropertyGroup>
71+
<ErrorText> This project references NuGet package(s) that are missing on this computer.Enable NuGet Package Restore to download them.For more information, see http://go.microsoft.com/fwlink/?LinkID=322105.The missing file is {0}.</ErrorText>
72+
</PropertyGroup>
73+
<Error Condition="!Exists('packages\Nerdbank.GitVersioning.3.4.194\build\Nerdbank.GitVersioning.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Nerdbank.GitVersioning.3.4.194\build\Nerdbank.GitVersioning.targets'))" />
74+
</Target>
75+
</Project>

devices/MS5611/MS5611.nuspec

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
3+
<metadata>
4+
<id>nanoFramework.Iot.Device.Ms5611</id>
5+
<version>$version$</version>
6+
<title>nanoFramework.Iot.Device.Ms5611</title>
7+
<authors>nanoFramework project contributors</authors>
8+
<owners>nanoFramework,dotnetfoundation</owners>
9+
<requireLicenseAcceptance>false</requireLicenseAcceptance>
10+
<license type="file">LICENSE.md</license>
11+
<releaseNotes>
12+
</releaseNotes>
13+
<readme>docs\README.md</readme>
14+
<developmentDependency>false</developmentDependency>
15+
<projectUrl>https://github.com/nanoframework/nanoFramework.IoT.Device</projectUrl>
16+
<icon>images\nf-logo.png</icon>
17+
<repository type="git" url="https://github.com/nanoframework/nanoFramework.IoT.Device" commit="$commit$" />
18+
<copyright>Copyright (c) .NET Foundation and Contributors</copyright>
19+
<description>This package includes the .NET IoT Core binding Iot.Device.Ms5611 for .NET nanoFramework C# projects.</description>
20+
<tags>nanoFramework C# csharp netmf netnf Iot.Device.Ms5611</tags>
21+
<dependencies>
22+
<dependency id="nanoFramework.CoreLibrary" version="1.11.7" />
23+
<dependency id="nanoFramework.System.Device.I2c" version="1.0.2" />
24+
<dependency id="nanoFramework.System.Math" version="1.4.3" />
25+
<dependency id="UnitsNet.nanoFramework.Length" version="4.112.0" />
26+
<dependency id="UnitsNet.nanoFramework.Temperature" version="4.112.0" />
27+
<dependency id="UnitsNet.nanoFramework.Pressure" version="4.112.0" />
28+
<dependency id="UnitsNet.nanoFramework.RelativeHumidity" version="4.112.0" />
29+
</dependencies>
30+
</metadata>
31+
<files>
32+
<file src="bin\Release\Iot.Device.Ms5611.dll" target="lib\Iot.Device.Ms5611.dll" />
33+
<file src="bin\Release\Iot.Device.Ms5611.pdb" target="lib\Iot.Device.Ms5611.pdb" />
34+
<file src="bin\Release\Iot.Device.Ms5611.pdbx" target="lib\Iot.Device.Ms5611.pdbx" />
35+
<file src="bin\Release\Iot.Device.Ms5611.pe" target="lib\Iot.Device.Ms5611.pe" />
36+
<file src="bin\Release\Iot.Device.Ms5611.xml" target="lib\Iot.Device.Ms5611.xml" />
37+
<file src="README.md" target="docs\" />
38+
<file src="..\..\assets\nf-logo.png" target="images" />
39+
<file src="..\..\LICENSE.md" target="" />
40+
</files>
41+
</package>

devices/MS5611/MS5611.sln

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.1.32104.313
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "MS5611", "MS5611.nfproj", "{0C60F241-931D-4608-AA6C-0476B8A7B876}"
7+
EndProject
8+
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "System.Device.Model", "..\..\src\System.Device.Model\System.Device.Model.shproj", "{23325B14-3651-4879-9697-9846FF123FEB}"
9+
EndProject
10+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shared Projects", "Shared Projects", "{F0DDA7D4-132B-40C4-B1B8-AD4A6733C0A4}"
11+
EndProject
12+
Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "MS5611.Sample", "samples\MS5611.Sample.nfproj", "{BB6F6B52-0BE0-4737-B411-3D088BD53A0A}"
13+
EndProject
14+
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Iot.Device.Common", "..\..\src\Iot.Device.Common\Iot.Device.Common.shproj", "{B439A23D-A742-4D1E-B182-7EC4C84DE211}"
15+
EndProject
16+
Global
17+
GlobalSection(SharedMSBuildProjectFiles) = preSolution
18+
..\..\src\System.Device.Model\System.Device.Model.projitems*{23325b14-3651-4879-9697-9846ff123feb}*SharedItemsImports = 13
19+
..\..\src\Iot.Device.Common\Iot.Device.Common.projitems*{b439a23d-a742-4d1e-b182-7ec4c84de211}*SharedItemsImports = 13
20+
EndGlobalSection
21+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
22+
Debug|Any CPU = Debug|Any CPU
23+
Release|Any CPU = Release|Any CPU
24+
EndGlobalSection
25+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
26+
{0C60F241-931D-4608-AA6C-0476B8A7B876}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27+
{0C60F241-931D-4608-AA6C-0476B8A7B876}.Debug|Any CPU.Build.0 = Debug|Any CPU
28+
{0C60F241-931D-4608-AA6C-0476B8A7B876}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
29+
{0C60F241-931D-4608-AA6C-0476B8A7B876}.Release|Any CPU.ActiveCfg = Release|Any CPU
30+
{0C60F241-931D-4608-AA6C-0476B8A7B876}.Release|Any CPU.Build.0 = Release|Any CPU
31+
{0C60F241-931D-4608-AA6C-0476B8A7B876}.Release|Any CPU.Deploy.0 = Release|Any CPU
32+
{BB6F6B52-0BE0-4737-B411-3D088BD53A0A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
33+
{BB6F6B52-0BE0-4737-B411-3D088BD53A0A}.Debug|Any CPU.Build.0 = Debug|Any CPU
34+
{BB6F6B52-0BE0-4737-B411-3D088BD53A0A}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
35+
{BB6F6B52-0BE0-4737-B411-3D088BD53A0A}.Release|Any CPU.ActiveCfg = Release|Any CPU
36+
{BB6F6B52-0BE0-4737-B411-3D088BD53A0A}.Release|Any CPU.Build.0 = Release|Any CPU
37+
{BB6F6B52-0BE0-4737-B411-3D088BD53A0A}.Release|Any CPU.Deploy.0 = Release|Any CPU
38+
EndGlobalSection
39+
GlobalSection(SolutionProperties) = preSolution
40+
HideSolutionNode = FALSE
41+
EndGlobalSection
42+
GlobalSection(NestedProjects) = preSolution
43+
{23325B14-3651-4879-9697-9846FF123FEB} = {F0DDA7D4-132B-40C4-B1B8-AD4A6733C0A4}
44+
{B439A23D-A742-4D1E-B182-7EC4C84DE211} = {F0DDA7D4-132B-40C4-B1B8-AD4A6733C0A4}
45+
EndGlobalSection
46+
GlobalSection(ExtensibilityGlobals) = postSolution
47+
SolutionGuid = {63E81BD1-9B2C-4104-BB95-C56C33533A8E}
48+
EndGlobalSection
49+
EndGlobal

devices/MS5611/MS5611_bb.png

90.6 KB
Loading

0 commit comments

Comments
 (0)