Skip to content

Commit 78a7365

Browse files
authored
Porting the MPU6886 from .NET nanoFramework (dotnet#1676)
* inital port from nanoFramework MPU6886 * adressing PR feedback
1 parent 1533c3c commit 78a7365

13 files changed

+900
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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.Mpu6886
5+
{
6+
/// <summary>
7+
/// Averaging filter settings for Low Power Accelerometer mode. (Datasheet page 37)
8+
/// </summary>
9+
public enum AccelerometerLowPowerMode
10+
{
11+
/// <summary>
12+
/// Average of 4 samples.
13+
/// </summary>
14+
Average4Samples = 0b0000_0000,
15+
16+
/// <summary>
17+
/// Average of 8 samples.
18+
/// </summary>
19+
Average8Samples = 0b0001_0000,
20+
21+
/// <summary>
22+
/// Average of 16 samples.
23+
/// </summary>
24+
Average16Samples = 0b0010_0000,
25+
26+
/// <summary>
27+
/// Average of 32 samples.
28+
/// </summary>
29+
Average32Samples = 0b0011_0000,
30+
}
31+
}
+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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.Mpu6886
5+
{
6+
/// <summary>
7+
/// Accelerometer scale. (Datasheet page 37)
8+
/// </summary>
9+
public enum AccelerometerScale
10+
{
11+
/// <summary>
12+
/// +- 2G
13+
/// </summary>
14+
Scale2G = 0b0000_0000,
15+
16+
/// <summary>
17+
/// +- 4G
18+
/// </summary>
19+
Scale4G = 0b0000_1000,
20+
21+
/// <summary>
22+
/// +- 8G
23+
/// </summary>
24+
Scale8G = 0b0001_0000,
25+
26+
/// <summary>
27+
/// +- 16G
28+
/// </summary>
29+
Scale16G = 0b0001_1000
30+
}
31+
}

src/devices/Mpu6886/AxisEnabled.cs

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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+
using System;
5+
6+
namespace Iot.Device.Mpu6886
7+
{
8+
/// <summary>
9+
/// Axes to enable
10+
/// </summary>
11+
[Flags]
12+
public enum EnabledAxis
13+
{
14+
/// <summary>
15+
/// Accelerometer X axis.
16+
/// </summary>
17+
AccelerometerX = 0b0010_0000,
18+
19+
/// <summary>
20+
/// Accelerometer Y axis.
21+
/// </summary>
22+
AccelerometerY = 0b0001_0000,
23+
24+
/// <summary>
25+
/// Accelerometer Z axis.
26+
/// </summary>
27+
AccelerometerZ = 0b0000_1000,
28+
29+
/// <summary>
30+
/// Gyroscope X axis.
31+
/// </summary>
32+
GyroscopeX = 0b0000_0100,
33+
34+
/// <summary>
35+
/// Gyroscope Y axis.
36+
/// </summary>
37+
GyroscopeY = 0b0000_0010,
38+
39+
/// <summary>
40+
/// Gyroscope Z axis.
41+
/// </summary>
42+
GyroscopeZ = 0b0000_0001,
43+
}
44+
}

src/devices/Mpu6886/GyroscopeScale.cs

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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.Mpu6886
5+
{
6+
/// <summary>
7+
/// Gyroscope scale. (Datasheet page 37)
8+
/// </summary>
9+
public enum GyroscopeScale
10+
{
11+
/// <summary>
12+
/// +- 250 dps
13+
/// </summary>
14+
Scale250dps = 0b0000_0000,
15+
16+
/// <summary>
17+
/// +- 500 dps
18+
/// </summary>
19+
Scale500dps = 0b0000_1000,
20+
21+
/// <summary>
22+
/// +- 1000 dps
23+
/// </summary>
24+
Scale1000dps = 0b0001_0000,
25+
26+
/// <summary>
27+
/// +- 2000 dps
28+
/// </summary>
29+
Scale2000dps = 0b0001_1000
30+
}
31+
}
+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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+
using System;
5+
namespace Iot.Device.Mpu6886
6+
{
7+
/// <summary>
8+
/// WoM interrupt on axes of accelerometer.
9+
/// </summary>
10+
[Flags]
11+
public enum InterruptEnable
12+
{
13+
/// <summary>
14+
/// All axes disabled.
15+
/// </summary>
16+
None = 0x0000_0000,
17+
18+
/// <summary>
19+
/// Enable X axis.
20+
/// </summary>
21+
Xaxis = 0b1000_0000,
22+
23+
/// <summary>
24+
/// Enable Y axis.
25+
/// </summary>
26+
Yaxis = 0b0100_0000,
27+
28+
/// <summary>
29+
/// Enable Z axis.
30+
/// </summary>
31+
Zaxis = 0b0010_0000,
32+
}
33+
}

0 commit comments

Comments
 (0)