Skip to content
This repository was archived by the owner on Jan 4, 2021. It is now read-only.

Commit dc45c75

Browse files
committed
Commit for 0.1.0
1 parent ad55a29 commit dc45c75

File tree

184 files changed

+15130
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

184 files changed

+15130
-2
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,6 @@ ClientBin/
190190
*.dbmdl
191191
*.dbproj.schemaview
192192
*.jfm
193-
*.pfx
194193
*.publishsettings
195194
node_modules/
196195
orleans.codegen.cs
@@ -258,4 +257,4 @@ paket-files/
258257

259258
# Python Tools for Visual Studio (PTVS)
260259
__pycache__/
261-
*.pyc
260+
*.pyc

MetaWear-SDK-CSharp.sln

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.26430.14
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "MetaWear", "MetaWear\MetaWear.shproj", "{ECC695E9-A3AE-49DB-B66C-911AB5842D0A}"
7+
EndProject
8+
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "MetaWear.Impl", "MetaWear.Impl\MetaWear.Impl.shproj", "{28AC4A04-B008-4057-96AE-9E6482793C1C}"
9+
EndProject
10+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MetaWear.DotNet", "MetaWear.DotNet\MetaWear.DotNet.csproj", "{0DE30138-2666-4991-A572-3B3914A53146}"
11+
EndProject
12+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MetaWear.Test", "MetaWear.Test\MetaWear.Test.csproj", "{8B19D12F-867B-40B1-BAB9-C9BF953AD6D4}"
13+
EndProject
14+
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "MetaWear.Win10", "MetaWear.Win10\MetaWear.Win10.shproj", "{272AFD1E-B093-4A4B-8F30-B51BF47D3FD5}"
15+
EndProject
16+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MetaWear.Uwp", "MetaWear.Uwp\MetaWear.Uwp.csproj", "{06E0C04F-2FE9-43A0-A816-A64BA57A7AA6}"
17+
EndProject
18+
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "MetaWear.Platform", "MetaWear.Platform\MetaWear.Platform.shproj", "{345A43DC-B35D-4B53-B263-D0DFECCF2050}"
19+
EndProject
20+
Global
21+
GlobalSection(SharedMSBuildProjectFiles) = preSolution
22+
MetaWear.Impl\MetaWear.Impl.projitems*{06e0c04f-2fe9-43a0-a816-a64ba57a7aa6}*SharedItemsImports = 4
23+
MetaWear.Platform\MetaWear.Platform.projitems*{06e0c04f-2fe9-43a0-a816-a64ba57a7aa6}*SharedItemsImports = 4
24+
MetaWear.Win10\MetaWear.Win10.projitems*{06e0c04f-2fe9-43a0-a816-a64ba57a7aa6}*SharedItemsImports = 4
25+
MetaWear\MetaWear.projitems*{06e0c04f-2fe9-43a0-a816-a64ba57a7aa6}*SharedItemsImports = 4
26+
MetaWear.Impl\MetaWear.Impl.projitems*{0de30138-2666-4991-a572-3b3914a53146}*SharedItemsImports = 4
27+
MetaWear.Platform\MetaWear.Platform.projitems*{0de30138-2666-4991-a572-3b3914a53146}*SharedItemsImports = 4
28+
MetaWear.Win10\MetaWear.Win10.projitems*{0de30138-2666-4991-a572-3b3914a53146}*SharedItemsImports = 4
29+
MetaWear\MetaWear.projitems*{0de30138-2666-4991-a572-3b3914a53146}*SharedItemsImports = 4
30+
MetaWear.Win10\MetaWear.Win10.projitems*{272afd1e-b093-4a4b-8f30-b51bf47d3fd5}*SharedItemsImports = 13
31+
MetaWear.Impl\MetaWear.Impl.projitems*{28ac4a04-b008-4057-96ae-9e6482793c1c}*SharedItemsImports = 13
32+
MetaWear.Platform\MetaWear.Platform.projitems*{345a43dc-b35d-4b53-b263-d0dfeccf2050}*SharedItemsImports = 13
33+
MetaWear\MetaWear.projitems*{ecc695e9-a3ae-49db-b66c-911ab5842d0a}*SharedItemsImports = 13
34+
EndGlobalSection
35+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
36+
Debug|Any CPU = Debug|Any CPU
37+
Debug|ARM = Debug|ARM
38+
Debug|x64 = Debug|x64
39+
Debug|x86 = Debug|x86
40+
Release|Any CPU = Release|Any CPU
41+
Release|ARM = Release|ARM
42+
Release|x64 = Release|x64
43+
Release|x86 = Release|x86
44+
EndGlobalSection
45+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
46+
{0DE30138-2666-4991-A572-3B3914A53146}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
47+
{0DE30138-2666-4991-A572-3B3914A53146}.Debug|Any CPU.Build.0 = Debug|Any CPU
48+
{0DE30138-2666-4991-A572-3B3914A53146}.Debug|ARM.ActiveCfg = Debug|Any CPU
49+
{0DE30138-2666-4991-A572-3B3914A53146}.Debug|ARM.Build.0 = Debug|Any CPU
50+
{0DE30138-2666-4991-A572-3B3914A53146}.Debug|x64.ActiveCfg = Debug|Any CPU
51+
{0DE30138-2666-4991-A572-3B3914A53146}.Debug|x64.Build.0 = Debug|Any CPU
52+
{0DE30138-2666-4991-A572-3B3914A53146}.Debug|x86.ActiveCfg = Debug|Any CPU
53+
{0DE30138-2666-4991-A572-3B3914A53146}.Debug|x86.Build.0 = Debug|Any CPU
54+
{0DE30138-2666-4991-A572-3B3914A53146}.Release|Any CPU.ActiveCfg = Release|Any CPU
55+
{0DE30138-2666-4991-A572-3B3914A53146}.Release|Any CPU.Build.0 = Release|Any CPU
56+
{0DE30138-2666-4991-A572-3B3914A53146}.Release|ARM.ActiveCfg = Release|Any CPU
57+
{0DE30138-2666-4991-A572-3B3914A53146}.Release|ARM.Build.0 = Release|Any CPU
58+
{0DE30138-2666-4991-A572-3B3914A53146}.Release|x64.ActiveCfg = Release|Any CPU
59+
{0DE30138-2666-4991-A572-3B3914A53146}.Release|x64.Build.0 = Release|Any CPU
60+
{0DE30138-2666-4991-A572-3B3914A53146}.Release|x86.ActiveCfg = Release|Any CPU
61+
{0DE30138-2666-4991-A572-3B3914A53146}.Release|x86.Build.0 = Release|Any CPU
62+
{8B19D12F-867B-40B1-BAB9-C9BF953AD6D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
63+
{8B19D12F-867B-40B1-BAB9-C9BF953AD6D4}.Debug|Any CPU.Build.0 = Debug|Any CPU
64+
{8B19D12F-867B-40B1-BAB9-C9BF953AD6D4}.Debug|ARM.ActiveCfg = Debug|Any CPU
65+
{8B19D12F-867B-40B1-BAB9-C9BF953AD6D4}.Debug|ARM.Build.0 = Debug|Any CPU
66+
{8B19D12F-867B-40B1-BAB9-C9BF953AD6D4}.Debug|x64.ActiveCfg = Debug|Any CPU
67+
{8B19D12F-867B-40B1-BAB9-C9BF953AD6D4}.Debug|x64.Build.0 = Debug|Any CPU
68+
{8B19D12F-867B-40B1-BAB9-C9BF953AD6D4}.Debug|x86.ActiveCfg = Debug|Any CPU
69+
{8B19D12F-867B-40B1-BAB9-C9BF953AD6D4}.Debug|x86.Build.0 = Debug|Any CPU
70+
{8B19D12F-867B-40B1-BAB9-C9BF953AD6D4}.Release|Any CPU.ActiveCfg = Release|Any CPU
71+
{8B19D12F-867B-40B1-BAB9-C9BF953AD6D4}.Release|Any CPU.Build.0 = Release|Any CPU
72+
{8B19D12F-867B-40B1-BAB9-C9BF953AD6D4}.Release|ARM.ActiveCfg = Release|Any CPU
73+
{8B19D12F-867B-40B1-BAB9-C9BF953AD6D4}.Release|ARM.Build.0 = Release|Any CPU
74+
{8B19D12F-867B-40B1-BAB9-C9BF953AD6D4}.Release|x64.ActiveCfg = Release|Any CPU
75+
{8B19D12F-867B-40B1-BAB9-C9BF953AD6D4}.Release|x64.Build.0 = Release|Any CPU
76+
{8B19D12F-867B-40B1-BAB9-C9BF953AD6D4}.Release|x86.ActiveCfg = Release|Any CPU
77+
{8B19D12F-867B-40B1-BAB9-C9BF953AD6D4}.Release|x86.Build.0 = Release|Any CPU
78+
{06E0C04F-2FE9-43A0-A816-A64BA57A7AA6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
79+
{06E0C04F-2FE9-43A0-A816-A64BA57A7AA6}.Debug|Any CPU.Build.0 = Debug|Any CPU
80+
{06E0C04F-2FE9-43A0-A816-A64BA57A7AA6}.Debug|ARM.ActiveCfg = Debug|ARM
81+
{06E0C04F-2FE9-43A0-A816-A64BA57A7AA6}.Debug|ARM.Build.0 = Debug|ARM
82+
{06E0C04F-2FE9-43A0-A816-A64BA57A7AA6}.Debug|x64.ActiveCfg = Debug|x64
83+
{06E0C04F-2FE9-43A0-A816-A64BA57A7AA6}.Debug|x64.Build.0 = Debug|x64
84+
{06E0C04F-2FE9-43A0-A816-A64BA57A7AA6}.Debug|x86.ActiveCfg = Debug|x86
85+
{06E0C04F-2FE9-43A0-A816-A64BA57A7AA6}.Debug|x86.Build.0 = Debug|x86
86+
{06E0C04F-2FE9-43A0-A816-A64BA57A7AA6}.Release|Any CPU.ActiveCfg = Release|Any CPU
87+
{06E0C04F-2FE9-43A0-A816-A64BA57A7AA6}.Release|Any CPU.Build.0 = Release|Any CPU
88+
{06E0C04F-2FE9-43A0-A816-A64BA57A7AA6}.Release|ARM.ActiveCfg = Release|ARM
89+
{06E0C04F-2FE9-43A0-A816-A64BA57A7AA6}.Release|ARM.Build.0 = Release|ARM
90+
{06E0C04F-2FE9-43A0-A816-A64BA57A7AA6}.Release|x64.ActiveCfg = Release|x64
91+
{06E0C04F-2FE9-43A0-A816-A64BA57A7AA6}.Release|x64.Build.0 = Release|x64
92+
{06E0C04F-2FE9-43A0-A816-A64BA57A7AA6}.Release|x86.ActiveCfg = Release|x86
93+
{06E0C04F-2FE9-43A0-A816-A64BA57A7AA6}.Release|x86.Build.0 = Release|x86
94+
EndGlobalSection
95+
GlobalSection(SolutionProperties) = preSolution
96+
HideSolutionNode = FALSE
97+
EndGlobalSection
98+
EndGlobal
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{0DE30138-2666-4991-A572-3B3914A53146}</ProjectGuid>
8+
<OutputType>Library</OutputType>
9+
<AppDesignerFolder>Properties</AppDesignerFolder>
10+
<RootNamespace>MbientLab.MetaWear.Win10</RootNamespace>
11+
<AssemblyName>MbientLab.MetaWear.DotNet</AssemblyName>
12+
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
13+
<FileAlignment>512</FileAlignment>
14+
<NuGetPackageImportStamp>
15+
</NuGetPackageImportStamp>
16+
<TargetFrameworkProfile />
17+
</PropertyGroup>
18+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
19+
<DebugSymbols>true</DebugSymbols>
20+
<DebugType>full</DebugType>
21+
<Optimize>false</Optimize>
22+
<OutputPath>bin\Debug\</OutputPath>
23+
<DefineConstants>DEBUG;TRACE</DefineConstants>
24+
<ErrorReport>prompt</ErrorReport>
25+
<WarningLevel>4</WarningLevel>
26+
<DocumentationFile>
27+
</DocumentationFile>
28+
<LangVersion>7</LangVersion>
29+
</PropertyGroup>
30+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
31+
<DebugType>pdbonly</DebugType>
32+
<Optimize>true</Optimize>
33+
<OutputPath>bin\Release\</OutputPath>
34+
<DefineConstants>TRACE</DefineConstants>
35+
<ErrorReport>prompt</ErrorReport>
36+
<WarningLevel>4</WarningLevel>
37+
<LangVersion>7</LangVersion>
38+
<DocumentationFile>
39+
</DocumentationFile>
40+
</PropertyGroup>
41+
<ItemGroup>
42+
<Reference Include="System" />
43+
<Reference Include="System.Core" />
44+
<Reference Include="System.Runtime.Serialization" />
45+
<Reference Include="System.Xml.Linq" />
46+
<Reference Include="System.Data.DataSetExtensions" />
47+
<Reference Include="Microsoft.CSharp" />
48+
<Reference Include="System.Data" />
49+
<Reference Include="System.Net.Http" />
50+
<Reference Include="System.Xml" />
51+
<Reference Include="System.Runtime.WindowsRuntime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
52+
<SpecificVersion>False</SpecificVersion>
53+
<HintPath>$(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5\System.Runtime.WindowsRuntime.dll</HintPath>
54+
</Reference>
55+
<Reference Include="Windows">
56+
<HintPath>$(MSBuildProgramFiles32)\Windows Kits\10\UnionMetadata\10.0.15063.0\Windows.winmd</HintPath>
57+
</Reference>
58+
</ItemGroup>
59+
<ItemGroup>
60+
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
61+
</ItemGroup>
62+
<ItemGroup>
63+
<None Include="MetaWear-SDK-CSharp.pfx" />
64+
</ItemGroup>
65+
<ItemGroup>
66+
<Compile Include="Properties\AssemblyInfo.cs" />
67+
</ItemGroup>
68+
<Import Project="..\MetaWear\MetaWear.projitems" Label="Shared" />
69+
<Import Project="..\MetaWear.Impl\MetaWear.Impl.projitems" Label="Shared" />
70+
<Import Project="..\MetaWear.Win10\MetaWear.Win10.projitems" Label="Shared" />
71+
<Import Project="..\MetaWear.Platform\MetaWear.Platform.projitems" Label="Shared" />
72+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
73+
</Project>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using System.Reflection;
2+
using System.Runtime.InteropServices;
3+
4+
// General Information about an assembly is controlled through the following
5+
// set of attributes. Change these attribute values to modify the information
6+
// associated with an assembly.
7+
[assembly: AssemblyTitle("MetaWear.DotNet")]
8+
[assembly: AssemblyDescription("MetaWear C# API for .NET framework apps")]
9+
[assembly: AssemblyConfiguration("")]
10+
[assembly: AssemblyCompany("MbientLab")]
11+
[assembly: AssemblyProduct("MetaWear.DotNet")]
12+
[assembly: AssemblyCopyright("Copyright © 2017")]
13+
[assembly: AssemblyTrademark("")]
14+
[assembly: AssemblyCulture("")]
15+
16+
// Setting ComVisible to false makes the types in this assembly not visible
17+
// to COM components. If you need to access a type in this assembly from
18+
// COM, set the ComVisible attribute to true on that type.
19+
[assembly: ComVisible(false)]
20+
21+
// The following GUID is for the ID of the typelib if this project is exposed to COM
22+
[assembly: Guid("0de30138-2666-4991-a572-3b3914a53146")]
23+
24+
// Version information for an assembly consists of the following four values:
25+
//
26+
// Major Version
27+
// Minor Version
28+
// Build Number
29+
// Revision
30+
//
31+
// You can specify all the values or you can default the Build and Revision Numbers
32+
// by using the '*' as shown below:
33+
// [assembly: AssemblyVersion("1.0.*")]
34+
[assembly: AssemblyVersion("1.0.0.0")]
35+
[assembly: AssemblyFileVersion("0.1.0")]

MetaWear.Impl/AccelerationData.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using MbientLab.MetaWear.Data;
2+
using System;
3+
4+
namespace MbientLab.MetaWear.Impl {
5+
class AccelerationData : DataBase {
6+
public AccelerationData(IModuleBoardBridge bridge, DataTypeBase datatype, DateTime timestamp, byte[] bytes) :
7+
base(bridge, datatype, timestamp, bytes) {
8+
}
9+
10+
public override Type[] Types => new Type[] { typeof(Acceleration) };
11+
12+
public override T Value<T>() {
13+
var type = typeof(T);
14+
15+
if (type == typeof(Acceleration)) {
16+
return (T) Convert.ChangeType(new Acceleration(
17+
BitConverter.ToInt16(bytes, 0) / Scale,
18+
BitConverter.ToInt16(bytes, 2) / Scale,
19+
BitConverter.ToInt16(bytes, 4) / Scale), type);
20+
}
21+
return base.Value<T>();
22+
}
23+
}
24+
}

MetaWear.Impl/AccelerometerBma255.cs

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
using MbientLab.MetaWear.Sensor;
2+
using static MbientLab.MetaWear.Impl.Module;
3+
4+
using System.Runtime.Serialization;
5+
using MbientLab.MetaWear.Sensor.AccelerometerBma255;
6+
using MbientLab.MetaWear.Sensor.AccelerometerBosch;
7+
8+
namespace MbientLab.MetaWear.Impl {
9+
[DataContract]
10+
class AccelerometerBma255 : AccelerometerBosch, IAccelerometerBma255 {
11+
public const byte IMPLEMENTATION = 0x3;
12+
private static readonly float[] FREQUENCIES = new float[] { 15.62f, 31.26f, 62.5f, 125f, 250f, 500f, 1000f, 2000f };
13+
14+
[DataMember] private readonly byte[] accDataConfig = new byte[] { 0x0b, 0x03 };
15+
16+
public AccelerometerBma255(IModuleBoardBridge bridge) : base(bridge) {
17+
}
18+
19+
public void Configure(OutputDataRate odr, DataRange range) {
20+
accDataConfig[0] &= 0xe0;
21+
accDataConfig[0] |= (byte) (odr + 8);
22+
23+
accDataConfig[1] &= 0xf0;
24+
accDataConfig[1] |= RANGE_BIT_MASKS[(int) range];
25+
26+
bridge.sendCommand(ACCELEROMETER, DATA_CONFIG, accDataConfig);
27+
}
28+
29+
public override void Configure(float odr = 100f, float range = 2f) {
30+
Configure((OutputDataRate)Util.closestIndex(FREQUENCIES, odr), (DataRange)Util.closestIndex(RANGES, range));
31+
}
32+
33+
protected override float GetDataScale() {
34+
switch (accDataConfig[1] & 0x0f) {
35+
case 0x3:
36+
return 16384f;
37+
case 0x5:
38+
return 8192f;
39+
case 0x8:
40+
return 4096f;
41+
case 0xc:
42+
return 2048f;
43+
default:
44+
return 1f;
45+
}
46+
}
47+
}
48+
}

MetaWear.Impl/AccelerometerBmi160.cs

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
using MbientLab.MetaWear.Sensor;
2+
using static MbientLab.MetaWear.Impl.Module;
3+
4+
using System.Runtime.Serialization;
5+
using MbientLab.MetaWear.Sensor.AccelerometerBmi160;
6+
using MbientLab.MetaWear.Sensor.AccelerometerBosch;
7+
8+
namespace MbientLab.MetaWear.Impl {
9+
[DataContract]
10+
class AccelerometerBmi160 : AccelerometerBosch, IAccelerometerBmi160 {
11+
public const byte IMPLEMENTATION = 0x1;
12+
13+
private static readonly float[] FREQUENCIES = new float[] { 0.078125f, 1.5625f, 3.125f, 6.25f, 12.5f, 25f, 50f, 100f, 200f, 400f, 800f, 1600f };
14+
15+
[DataMember] private readonly byte[] accDataConfig = new byte[] { 0x28, 0x03 };
16+
17+
public AccelerometerBmi160(IModuleBoardBridge bridge) : base(bridge) { }
18+
19+
public void Configure(OutputDataRate odr, DataRange range) {
20+
accDataConfig[0] &= 0xf0;
21+
accDataConfig[0] |= (byte)(odr + 1);
22+
23+
accDataConfig[0] &= 0xf;
24+
if (FREQUENCIES[(int) odr] < 12.5f) {
25+
accDataConfig[0] |= 0x80;
26+
} else {
27+
accDataConfig[0] |= 0x20;
28+
}
29+
30+
accDataConfig[1] &= 0xf0;
31+
accDataConfig[1] |= RANGE_BIT_MASKS[(int) range];
32+
33+
bridge.sendCommand(ACCELEROMETER, DATA_CONFIG, accDataConfig);
34+
}
35+
36+
public override void Configure(float odr = 100f, float range = 2f) {
37+
Configure((OutputDataRate) Util.closestIndex(FREQUENCIES, odr), (DataRange) Util.closestIndex(RANGES, range));
38+
}
39+
40+
protected override float GetDataScale() {
41+
switch (accDataConfig[1] & 0x0f) {
42+
case 0x3:
43+
return 16384f;
44+
case 0x5:
45+
return 8192f;
46+
case 0x8:
47+
return 4096f;
48+
case 0xc:
49+
return 2048f;
50+
default:
51+
return 1f;
52+
}
53+
}
54+
}
55+
}

0 commit comments

Comments
 (0)