Skip to content

Commit af649c0

Browse files
jbferguson75joshferguson75josesimoesEllerbach
authored
Added Adxl343 i2c Device Code and Sample (#662)
Co-authored-by: jbferguson75 <[email protected]> Co-authored-by: José Simões <[email protected]> Co-authored-by: Laurent Ellerbach <[email protected]>
1 parent 8891de1 commit af649c0

30 files changed

+3184
-0
lines changed

devices/Adxl343/ADXL343.cs

+1,905
Large diffs are not rendered by default.

devices/Adxl343/ADXL343.nfproj

+95
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
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>090f96cd-0dfa-4cb0-bc4d-f60acd5f0738</ProjectGuid>
12+
<OutputType>Library</OutputType>
13+
<AppDesignerFolder>Properties</AppDesignerFolder>
14+
<FileAlignment>512</FileAlignment>
15+
<RootNamespace>Iot.Device.Adxl343</RootNamespace>
16+
<AssemblyName>Iot.Device.Adxl343</AssemblyName>
17+
<TargetFrameworkVersion>v1.0</TargetFrameworkVersion>
18+
<DocumentationFile>bin\$(Configuration)\Iot.Device.Adxl343.xml</DocumentationFile>
19+
<StyleCopTreatErrorsAsWarnings>false</StyleCopTreatErrorsAsWarnings>
20+
<Name>Adxl343</Name>
21+
</PropertyGroup>
22+
<PropertyGroup>
23+
<SignAssembly>true</SignAssembly>
24+
</PropertyGroup>
25+
<PropertyGroup>
26+
<AssemblyOriginatorKeyFile>..\key.snk</AssemblyOriginatorKeyFile>
27+
</PropertyGroup>
28+
<PropertyGroup>
29+
<DelaySign>false</DelaySign>
30+
</PropertyGroup>
31+
<Import Project="$(NanoFrameworkProjectSystemPath)NFProjectSystem.props" Condition="Exists('$(NanoFrameworkProjectSystemPath)NFProjectSystem.props')" />
32+
<ItemGroup>
33+
<Compile Include="ActTapStatusMap.cs" />
34+
<Compile Include="Adxl343.cs" />
35+
<Compile Include="BwRateMap.cs" />
36+
<Compile Include="DataFormatMap.cs" />
37+
<Compile Include="FifoControlMap.cs" />
38+
<Compile Include="FifoMode.cs" />
39+
<Compile Include="FifoStatusMap.cs" />
40+
<Compile Include="GravityRange.cs" />
41+
<Compile Include="IntEnableMap.cs" />
42+
<Compile Include="ActInactCtlMap.cs" />
43+
<Compile Include="OutputDataRate.cs" />
44+
<Compile Include="PowerControlMap.cs" />
45+
<Compile Include="Properties\AssemblyInfo.cs" />
46+
<Compile Include="Register.cs" />
47+
<Compile Include="TapAxesMap.cs" />
48+
<Compile Include="WakeUpBits.cs" />
49+
</ItemGroup>
50+
<ItemGroup>
51+
<None Include="packages.config" />
52+
<None Include="packages.lock.json" />
53+
</ItemGroup>
54+
<ItemGroup>
55+
<Reference Include="mscorlib">
56+
<HintPath>packages\nanoFramework.CoreLibrary.1.14.2\lib\mscorlib.dll</HintPath>
57+
</Reference>
58+
<Reference Include="nanoFramework.Runtime.Events">
59+
<HintPath>packages\nanoFramework.Runtime.Events.1.11.6\lib\nanoFramework.Runtime.Events.dll</HintPath>
60+
</Reference>
61+
<Reference Include="System.Buffers.Binary.BinaryPrimitives">
62+
<HintPath>packages\nanoFramework.System.Buffers.Binary.BinaryPrimitives.1.2.211\lib\System.Buffers.Binary.BinaryPrimitives.dll</HintPath>
63+
</Reference>
64+
<Reference Include="System.Device.I2c">
65+
<HintPath>packages\nanoFramework.System.Device.I2c.1.1.9\lib\System.Device.I2c.dll</HintPath>
66+
</Reference>
67+
<Reference Include="System.Math">
68+
<HintPath>packages\nanoFramework.System.Math.1.5.29\lib\System.Math.dll</HintPath>
69+
</Reference>
70+
<Reference Include="System.Numerics">
71+
<HintPath>packages\nanoFramework.System.Numerics.1.2.227\lib\System.Numerics.dll</HintPath>
72+
</Reference>
73+
<Reference Include="UnitsNet.Duration">
74+
<HintPath>packages\UnitsNet.nanoFramework.Duration.5.2.0\lib\UnitsNet.Duration.dll</HintPath>
75+
</Reference>
76+
<Reference Include="UnitsNet.Mass">
77+
<HintPath>packages\UnitsNet.nanoFramework.Mass.5.2.0\lib\UnitsNet.Mass.dll</HintPath>
78+
</Reference>
79+
</ItemGroup>
80+
<Import Project="$(NanoFrameworkProjectSystemPath)NFProjectSystem.CSharp.targets" Condition="Exists('$(NanoFrameworkProjectSystemPath)NFProjectSystem.CSharp.targets')" />
81+
<ProjectExtensions>
82+
<ProjectCapabilities>
83+
<ProjectConfigurationsDeclaredAsItems />
84+
</ProjectCapabilities>
85+
</ProjectExtensions>
86+
<Import Project="packages\StyleCop.MSBuild.6.2.0\build\StyleCop.MSBuild.targets" Condition="Exists('packages\StyleCop.MSBuild.6.2.0\build\StyleCop.MSBuild.targets')" />
87+
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
88+
<PropertyGroup>
89+
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
90+
</PropertyGroup>
91+
<Error Condition="!Exists('packages\StyleCop.MSBuild.6.2.0\build\StyleCop.MSBuild.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\StyleCop.MSBuild.6.2.0\build\StyleCop.MSBuild.targets'))" />
92+
<Error Condition="!Exists('packages\Nerdbank.GitVersioning.3.5.119\build\Nerdbank.GitVersioning.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Nerdbank.GitVersioning.3.5.119\build\Nerdbank.GitVersioning.props'))" />
93+
<Error Condition="!Exists('packages\Nerdbank.GitVersioning.3.5.119\build\Nerdbank.GitVersioning.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Nerdbank.GitVersioning.3.5.119\build\Nerdbank.GitVersioning.targets'))" />
94+
</Target>
95+
</Project>

devices/Adxl343/ActInactCtlMap.cs

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// Copyright (c) 2017 The nanoFramework project contributors
2+
// See LICENSE file in the project root for full license information.
3+
4+
namespace Iot.Device.Adxl343Lib
5+
{
6+
/// <summary>
7+
/// Active Inactive Control Map.
8+
/// </summary>
9+
internal enum ActInactCtlMap : byte
10+
{
11+
/// <summary>
12+
/// Active AC/DC.
13+
/// </summary>
14+
ActAcDc = 0x80,
15+
16+
/// <summary>
17+
/// Active X Enable.
18+
/// </summary>
19+
ActXEnable = 0x40,
20+
21+
/// <summary>
22+
/// Active Y Enable.
23+
/// </summary>
24+
ActYEnable = 0x20,
25+
26+
/// <summary>
27+
/// Active Z Enable.
28+
/// </summary>
29+
ActZEnable = 0x10,
30+
31+
/// <summary>
32+
/// Inactive AC/DC.
33+
/// </summary>
34+
InactAcDc = 0x08,
35+
36+
/// <summary>
37+
/// Inactive X Enable.
38+
/// </summary>
39+
InactXEnable = 0x04,
40+
41+
/// <summary>
42+
/// Inactive Y Enable.
43+
/// </summary>
44+
InactYEnable = 0x02,
45+
46+
/// <summary>
47+
/// Inactive Z Enable.
48+
/// </summary>
49+
InactZEnable = 0x01
50+
}
51+
}

devices/Adxl343/ActTapStatusMap.cs

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// Copyright (c) 2017 The nanoFramework project contributors
2+
// See LICENSE file in the project root for full license information.
3+
4+
namespace Iot.Device.Adxl343Lib
5+
{
6+
/// <summary>
7+
/// Active Tap Status Map.
8+
/// </summary>
9+
internal enum ActTapStatusMap
10+
{
11+
/// <summary>
12+
/// Active X Source.
13+
/// </summary>
14+
ActXSource = 0x40,
15+
16+
/// <summary>
17+
/// Active Y Source.
18+
/// </summary>
19+
ActYSource = 0x20,
20+
21+
/// <summary>
22+
/// Active Z Source.
23+
/// </summary>
24+
ActZSource = 0x10,
25+
26+
/// <summary>
27+
/// Asleep.
28+
/// </summary>
29+
Asleep = 0x08,
30+
31+
/// <summary>
32+
/// Tap X Source.
33+
/// </summary>
34+
TapXSource = 0x04,
35+
36+
/// <summary>
37+
/// Tap Y Source.
38+
/// </summary>
39+
TapYSource = 0x02,
40+
41+
/// <summary>
42+
/// Tap Z Source.
43+
/// </summary>
44+
TapZSource = 0x01
45+
}
46+
}

devices/Adxl343/Adxl343.nfproj.user

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup />
4+
</Project>

devices/Adxl343/Adxl343.nuspec

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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.Adxl343</id>
5+
<version>$version$</version>
6+
<title>nanoFramework.Iot.Device.Adxl343</title>
7+
<authors>nanoFramework</authors>
8+
<requireLicenseAcceptance>false</requireLicenseAcceptance>
9+
<license type="file">LICENSE.md</license>
10+
<releaseNotes>
11+
</releaseNotes>
12+
<readme>docs\README.md</readme>
13+
<developmentDependency>false</developmentDependency>
14+
<projectUrl>https://github.com/nanoframework/nanoFramework.IoT.Device</projectUrl>
15+
<icon>images\nf-logo.png</icon>
16+
<repository type="git" url="https://github.com/nanoframework/nanoFramework.IoT.Device" commit="$commit$" />
17+
<copyright>Copyright (c) .NET Foundation and Contributors</copyright>
18+
<description>This package includes the .NET IoT Core binding Iot.Device.Adxl343 for .NET nanoFramework C# projects.</description>
19+
<summary>Iot.Device.Adxl343 assembly for .NET nanoFramework C# projects</summary>
20+
<tags>nanoFramework C# csharp netmf netnf Iot.Device.Adxl343</tags>
21+
<dependencies>
22+
<dependency id="nanoFramework.CoreLibrary" version="1.14.2" />
23+
<dependency id="nanoFramework.System.Buffers.Binary.BinaryPrimitives" version="1.2.211" />
24+
<dependency id="nanoFramework.System.Numerics" version="1.2.227" />
25+
<dependency id="nanoFramework.Runtime.Events" version="1.11.6" />
26+
<dependency id="nanoFramework.System.Device.I2c" version="1.1.9" />
27+
<dependency id="nanoFramework.System.Math" version="1.5.29" />
28+
<dependency id="UnitsNet.nanoFramework.Duration" version="5.2.0" />
29+
<dependency id="UnitsNet.nanoFramework.Mass" version="5.2.0" />
30+
</dependencies>
31+
</metadata>
32+
<files>
33+
<file src="bin\Release\Iot.Device.Adxl343.dll" target="lib\Iot.Device.Adxl343.dll" />
34+
<file src="bin\Release\Iot.Device.Adxl343.pdb" target="lib\Iot.Device.Adxl343.pdb" />
35+
<file src="bin\Release\Iot.Device.Adxl343.pdbx" target="lib\Iot.Device.Adxl343.pdbx" />
36+
<file src="bin\Release\Iot.Device.Adxl343.pe" target="lib\Iot.Device.Adxl343.pe" />
37+
<file src="bin\Release\Iot.Device.Adxl343.xml" target="lib\Iot.Device.Adxl343.xml" />
38+
<file src="README.md" target="docs\" />
39+
<file src="..\..\assets\nf-logo.png" target="images" />
40+
<file src="..\..\LICENSE.md" target="" />
41+
</files>
42+
</package>

devices/Adxl343/Adxl343.sln

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.4.33122.133
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "Adxl343Samples", "Samples\Adxl343.Samples.nfproj", "{A9CC2917-2DAA-4772-91DE-8D8F0E7F8CDC}"
7+
EndProject
8+
Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "Adxl343", "Adxl343.nfproj", "{090F96CD-0DFA-4CB0-BC4D-F60ACD5F0738}"
9+
EndProject
10+
Global
11+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
12+
Debug|Any CPU = Debug|Any CPU
13+
Release|Any CPU = Release|Any CPU
14+
EndGlobalSection
15+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
16+
{A9CC2917-2DAA-4772-91DE-8D8F0E7F8CDC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17+
{A9CC2917-2DAA-4772-91DE-8D8F0E7F8CDC}.Debug|Any CPU.Build.0 = Debug|Any CPU
18+
{A9CC2917-2DAA-4772-91DE-8D8F0E7F8CDC}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
19+
{A9CC2917-2DAA-4772-91DE-8D8F0E7F8CDC}.Release|Any CPU.ActiveCfg = Release|Any CPU
20+
{A9CC2917-2DAA-4772-91DE-8D8F0E7F8CDC}.Release|Any CPU.Build.0 = Release|Any CPU
21+
{A9CC2917-2DAA-4772-91DE-8D8F0E7F8CDC}.Release|Any CPU.Deploy.0 = Release|Any CPU
22+
{090F96CD-0DFA-4CB0-BC4D-F60ACD5F0738}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23+
{090F96CD-0DFA-4CB0-BC4D-F60ACD5F0738}.Debug|Any CPU.Build.0 = Debug|Any CPU
24+
{090F96CD-0DFA-4CB0-BC4D-F60ACD5F0738}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
25+
{090F96CD-0DFA-4CB0-BC4D-F60ACD5F0738}.Release|Any CPU.ActiveCfg = Release|Any CPU
26+
{090F96CD-0DFA-4CB0-BC4D-F60ACD5F0738}.Release|Any CPU.Build.0 = Release|Any CPU
27+
{090F96CD-0DFA-4CB0-BC4D-F60ACD5F0738}.Release|Any CPU.Deploy.0 = Release|Any CPU
28+
EndGlobalSection
29+
GlobalSection(SolutionProperties) = preSolution
30+
HideSolutionNode = FALSE
31+
EndGlobalSection
32+
GlobalSection(ExtensibilityGlobals) = postSolution
33+
SolutionGuid = {D1C155EB-F434-4A62-8E29-1775F3ED0238}
34+
EndGlobalSection
35+
EndGlobal

devices/Adxl343/BwRateMap.cs

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright (c) 2017 The nanoFramework project contributors
2+
// See LICENSE file in the project root for full license information.
3+
4+
namespace Iot.Device.Adxl343Lib
5+
{
6+
/// <summary>
7+
/// BW Rate Map.
8+
/// </summary>
9+
internal enum BwRateMap
10+
{
11+
/// <summary>
12+
/// Low Power.
13+
/// </summary>
14+
LowPower = 0x10,
15+
16+
/// <summary>
17+
/// Rate.
18+
/// </summary>
19+
Rate = 0x0F
20+
}
21+
}

devices/Adxl343/DataFormatMap.cs

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// Copyright (c) 2017 The nanoFramework project contributors
2+
// See LICENSE file in the project root for full license information.
3+
4+
namespace Iot.Device.Adxl343Lib
5+
{
6+
/// <summary>
7+
/// Data Format Map.
8+
/// </summary>
9+
internal enum DataFormatMap
10+
{
11+
/// <summary>
12+
/// Self Test.
13+
/// </summary>
14+
SelfTest = 0x80,
15+
16+
/// <summary>
17+
/// SPI.
18+
/// </summary>
19+
Spi = 0x40,
20+
21+
/// <summary>
22+
/// Interrupt Invert.
23+
/// </summary>
24+
IntInvert = 0x20,
25+
26+
/// <summary>
27+
/// Reserved.
28+
/// </summary>
29+
Reserved = 0x10,
30+
31+
/// <summary>
32+
/// Full Resolution.
33+
/// </summary>
34+
FullRes = 0x08,
35+
36+
/// <summary>
37+
/// Justify.
38+
/// </summary>
39+
Justify = 0x04,
40+
41+
/// <summary>
42+
/// Range.
43+
/// </summary>
44+
Range = 0x03
45+
}
46+
}

devices/Adxl343/FifoControlMap.cs

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright (c) 2017 The nanoFramework project contributors
2+
// See LICENSE file in the project root for full license information.
3+
4+
namespace Iot.Device.Adxl343Lib
5+
{
6+
/// <summary>
7+
/// FIFO Control Map.
8+
/// </summary>
9+
internal enum FifoControlMap : byte
10+
{
11+
/// <summary>
12+
/// Mode.
13+
/// </summary>
14+
Mode = 0xC0,
15+
16+
/// <summary>
17+
/// Trigger.
18+
/// </summary>
19+
Trigger = 0x20,
20+
21+
/// <summary>
22+
/// Samples.
23+
/// </summary>
24+
Samples = 0x0F
25+
}
26+
}

0 commit comments

Comments
 (0)