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
20 changes: 10 additions & 10 deletions FrameworkSensors/AccelerometerClient.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (C) Microsoft Corporation, All Rights Reserved.
// Copyright (C) Framework Computer Inc, All Rights Reserved.
//
// Abstract:
//
Expand All @@ -13,19 +14,18 @@

#include "AccelerometerClient.tmh"

#define SENSORV2_POOL_TAG_ACCELEROMETER '2CaL'
#define FWK_SENSORS_POOL_TAG_ACCELEROMETER 'ccAF'

#define AccelerometerDevice_Default_MinDataInterval (4)
#define AccelerometerDevice_Default_Axis_Threshold (1.0f)
#define AccelerometerDevice_Axis_Resolution (4.0f / 65536.0f) // in delta g
#define AccelerometerDevice_Axis_Minimum (-2.0f) // in g
#define AccelerometerDevice_Axis_Maximum (2.0f) // in g

// TODO: New GUID for this?
// Accelerometer Unique ID
// {2BAAA1A7-6795-42A0-B830-82526CFD28D1}
// {A931067B-D450-42A4-8B20-2647D4CA9D2D}
DEFINE_GUID(GUID_AccelerometerDevice_UniqueID,
0x2baaa1a7, 0x6795, 0x42a0, 0xb8, 0x30, 0x82, 0x52, 0x6c, 0xfd, 0x28, 0xd1);
0xa931067b, 0xd450, 0x42a4, 0x8b, 0x20, 0x26, 0x47, 0xd4, 0xca, 0x9d, 0x2d);

// Sensor data
typedef enum
Expand Down Expand Up @@ -111,7 +111,7 @@ AccelerometerDevice::Initialize(
MemoryAttributes.ParentObject = SensorInstance;
Status = WdfMemoryCreate(&MemoryAttributes,
PagedPool,
SENSORV2_POOL_TAG_ACCELEROMETER,
FWK_SENSORS_POOL_TAG_ACCELEROMETER,
Size,
&MemoryHandle,
(PVOID*)&m_pEnumerationProperties);
Expand Down Expand Up @@ -163,7 +163,7 @@ AccelerometerDevice::Initialize(
MemoryAttributes.ParentObject = SensorInstance;
Status = WdfMemoryCreate(&MemoryAttributes,
PagedPool,
SENSORV2_POOL_TAG_ACCELEROMETER,
FWK_SENSORS_POOL_TAG_ACCELEROMETER,
Size,
&MemoryHandle,
(PVOID*)&m_pSupportedDataFields);
Expand Down Expand Up @@ -197,7 +197,7 @@ AccelerometerDevice::Initialize(
MemoryAttributes.ParentObject = SensorInstance;
Status = WdfMemoryCreate(&MemoryAttributes,
PagedPool,
SENSORV2_POOL_TAG_ACCELEROMETER,
FWK_SENSORS_POOL_TAG_ACCELEROMETER,
Size,
&MemoryHandle,
(PVOID*)&m_pData);
Expand Down Expand Up @@ -252,7 +252,7 @@ AccelerometerDevice::Initialize(
MemoryAttributes.ParentObject = SensorInstance;
Status = WdfMemoryCreate(&MemoryAttributes,
PagedPool,
SENSORV2_POOL_TAG_ACCELEROMETER,
FWK_SENSORS_POOL_TAG_ACCELEROMETER,
Size,
&MemoryHandle,
(PVOID*)&m_pProperties);
Expand Down Expand Up @@ -295,7 +295,7 @@ AccelerometerDevice::Initialize(
MemoryAttributes.ParentObject = SensorInstance;
Status = WdfMemoryCreate(&MemoryAttributes,
PagedPool,
SENSORV2_POOL_TAG_ACCELEROMETER,
FWK_SENSORS_POOL_TAG_ACCELEROMETER,
Size,
&MemoryHandle,
(PVOID*)&m_pDataFieldProperties);
Expand Down Expand Up @@ -335,7 +335,7 @@ AccelerometerDevice::Initialize(
MemoryAttributes.ParentObject = SensorInstance;
Status = WdfMemoryCreate(&MemoryAttributes,
PagedPool,
SENSORV2_POOL_TAG_ACCELEROMETER,
FWK_SENSORS_POOL_TAG_ACCELEROMETER,
Size,
&MemoryHandle,
(PVOID*)&m_pThresholds);
Expand Down
18 changes: 9 additions & 9 deletions FrameworkSensors/AlsClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

#include "AlsClient.tmh"

#define SENSORV2_POOL_TAG_AMBIENT_LIGHT '2LmA'
#define FWK_SENSORS_POOL_TAG_AMBIENT_LIGHT 'SLAF'

#define Als_Initial_MinDataInterval_Ms (10) // 100Hz
#define Als_Initial_Lux_Threshold_Pct (1.0f) // Percent threshold: 100%
Expand All @@ -29,9 +29,9 @@
#define AlsDevice_Resolution_Lux (AlsDevice_Range_Lux / AlsDevice_Precision)

// Ambient Light Sensor Unique ID
// {2D2A4524-51E3-4E68-9B0F-5CAEDFB12C02}
// {506AC61B-C762-499E-A848-685FC45DF39F}
DEFINE_GUID(GUID_AlsDevice_UniqueID,
0x2d2a4524, 0x51e3, 0x4e68, 0x9b, 0xf, 0x5c, 0xae, 0xdf, 0xb1, 0x2c, 0x2);
0x506ac61b, 0xc762, 0x499e, 0xa8, 0x48, 0x68, 0x5f, 0xc4, 0x5d, 0xf3, 0x9f);

// Sensor data
typedef enum
Expand Down Expand Up @@ -148,7 +148,7 @@ AlsDevice::Initialize(
MemoryAttributes.ParentObject = SensorInstance;
Status = WdfMemoryCreate(&MemoryAttributes,
PagedPool,
SENSORV2_POOL_TAG_AMBIENT_LIGHT,
FWK_SENSORS_POOL_TAG_AMBIENT_LIGHT,
Size,
&MemoryHandle,
(PVOID*)&m_pEnumerationProperties);
Expand Down Expand Up @@ -208,7 +208,7 @@ AlsDevice::Initialize(
MemoryAttributes.ParentObject = SensorInstance;
Status = WdfMemoryCreate(&MemoryAttributes,
PagedPool,
SENSORV2_POOL_TAG_AMBIENT_LIGHT,
FWK_SENSORS_POOL_TAG_AMBIENT_LIGHT,
Size,
&MemoryHandle,
(PVOID*)&m_pSupportedDataFields);
Expand Down Expand Up @@ -243,7 +243,7 @@ AlsDevice::Initialize(
MemoryAttributes.ParentObject = SensorInstance;
Status = WdfMemoryCreate(&MemoryAttributes,
PagedPool,
SENSORV2_POOL_TAG_AMBIENT_LIGHT,
FWK_SENSORS_POOL_TAG_AMBIENT_LIGHT,
Size,
&MemoryHandle,
(PVOID*)&m_pData);
Expand Down Expand Up @@ -305,7 +305,7 @@ AlsDevice::Initialize(
MemoryAttributes.ParentObject = SensorInstance;
Status = WdfMemoryCreate(&MemoryAttributes,
PagedPool,
SENSORV2_POOL_TAG_AMBIENT_LIGHT,
FWK_SENSORS_POOL_TAG_AMBIENT_LIGHT,
Size,
&MemoryHandle,
(PVOID*)&m_pProperties);
Expand Down Expand Up @@ -373,7 +373,7 @@ AlsDevice::Initialize(
MemoryAttributes.ParentObject = SensorInstance;
Status = WdfMemoryCreate(&MemoryAttributes,
PagedPool,
SENSORV2_POOL_TAG_AMBIENT_LIGHT,
FWK_SENSORS_POOL_TAG_AMBIENT_LIGHT,
Size,
&MemoryHandle,
(PVOID*)&m_pDataFieldProperties);
Expand Down Expand Up @@ -412,7 +412,7 @@ AlsDevice::Initialize(
MemoryAttributes.ParentObject = SensorInstance;
Status = WdfMemoryCreate(&MemoryAttributes,
PagedPool,
SENSORV2_POOL_TAG_AMBIENT_LIGHT,
FWK_SENSORS_POOL_TAG_AMBIENT_LIGHT,
Size,
&MemoryHandle,
(PVOID*)&m_pThresholds);
Expand Down
16 changes: 13 additions & 3 deletions FrameworkSensors/EcCommunication.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@

// Only need EC commands to use EC_CMD_MOTION_SENSE_CMD to determine which accel sensors there are and which position they are
// ALl the rest can be done using memory map reads
// Copyright (C) Framework Computer Inc, All Rights Reserved.
//
// Abstract:
//
// This module contains the implementation of communication with the embedded controller.
//
// Only need EC commands to use EC_CMD_MOTION_SENSE_CMD to determine which
// accel sensors there are and which position they are. ALl the rest can be
// done using memory map reads.
//
// Environment:
//
// Windows User-Mode Driver Framework (UMDF)

#include "Clients.h"
#include "EcCommunication.h"
Expand Down
28 changes: 15 additions & 13 deletions FrameworkSensors/SensorsTrace.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//Copyright (C) Microsoft Corporation, All Rights Reserved
//Copyright (C) Framework Computer Inc, All Rights Reserved
//
//Abstract:
//
Expand All @@ -16,19 +17,20 @@ extern "C" {

// Define the tracing flags.
//
// Tracing GUID - 3C773167-F26D-4F72-A1DE-95F1FD795840

#define WPP_CONTROL_GUIDS \
WPP_DEFINE_CONTROL_GUID( \
SimpleDeviceOrientationSensorTraceGuid, (3C773167,F26D,4F72,A1DE,95F1FD795840), \
WPP_DEFINE_BIT(EntryExit) \
WPP_DEFINE_BIT(DataFlow) \
WPP_DEFINE_BIT(Verbose) \
WPP_DEFINE_BIT(Information) \
WPP_DEFINE_BIT(Warning) \
WPP_DEFINE_BIT(Error) \
WPP_DEFINE_BIT(Fatal) \
WPP_DEFINE_BIT(DriverStatus) \
// Tracing GUID - B915AE22-198E-4CF7-BF4D-395FAD3F645A


#define WPP_CONTROL_GUIDS \
WPP_DEFINE_CONTROL_GUID( \
FrameworkSensorsTraceGuid, (B915AE22,198E,4CF7,BF4D,395FAD3F645A), \
WPP_DEFINE_BIT(EntryExit) \
WPP_DEFINE_BIT(DataFlow) \
WPP_DEFINE_BIT(Verbose) \
WPP_DEFINE_BIT(Information) \
WPP_DEFINE_BIT(Warning) \
WPP_DEFINE_BIT(Error) \
WPP_DEFINE_BIT(Fatal) \
WPP_DEFINE_BIT(DriverStatus) \
)

#define WPP_FLAG_LEVEL_LOGGER(flag, level) WPP_LEVEL_LOGGER(flag)
Expand Down
19 changes: 9 additions & 10 deletions FrameworkSensors/SimpleDeviceOrientationClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#include "SimpleDeviceOrientationClient.tmh"

#define SENSORV2_POOL_TAG_LINEAR_ACCELEROMETER 'sodS'
#define FWK_SENSORS_POOL_TAG_ORIENTATION 'irOF'

#define SimpleDeviceOrientationDevice_Default_MinDataInterval (4)
#define SimpleDeviceOrientationDevice_Default_Axis_Threshold (1.0f)
Expand All @@ -21,10 +21,9 @@
#define SimpleDeviceOrientationDevice_Axis_Maximum (2.0f) // in g

// Simple Device Orientation ID
// {4A303B3E-332A-4044-A35A-282F3D6D56E5}
// {D1FCD247-5848-433A-9129-4C0B93979BE4}
DEFINE_GUID(GUID_SimpleDeviceOrientationDevice_UniqueID,
0x4a303b3e, 0x332a, 0x4044, 0xa3, 0x5a, 0x28, 0x2f, 0x3d, 0x6d, 0x56,
0xe5);
0xd1fcd247, 0x5848, 0x433a, 0x91, 0x29, 0x4c, 0xb, 0x93, 0x97, 0x9b, 0xe4);

// Sensor data
typedef enum
Expand Down Expand Up @@ -108,7 +107,7 @@ SimpleDeviceOrientationDevice::Initialize(
MemoryAttributes.ParentObject = SensorInstance;
Status = WdfMemoryCreate(&MemoryAttributes,
PagedPool,
SENSORV2_POOL_TAG_LINEAR_ACCELEROMETER,
FWK_SENSORS_POOL_TAG_ORIENTATION,
Size,
&MemoryHandle,
(PVOID*)&m_pEnumerationProperties);
Expand Down Expand Up @@ -160,7 +159,7 @@ SimpleDeviceOrientationDevice::Initialize(
MemoryAttributes.ParentObject = SensorInstance;
Status = WdfMemoryCreate(&MemoryAttributes,
PagedPool,
SENSORV2_POOL_TAG_LINEAR_ACCELEROMETER,
FWK_SENSORS_POOL_TAG_ORIENTATION,
Size,
&MemoryHandle,
(PVOID*)&m_pSupportedDataFields);
Expand Down Expand Up @@ -192,7 +191,7 @@ SimpleDeviceOrientationDevice::Initialize(
MemoryAttributes.ParentObject = SensorInstance;
Status = WdfMemoryCreate(&MemoryAttributes,
PagedPool,
SENSORV2_POOL_TAG_LINEAR_ACCELEROMETER,
FWK_SENSORS_POOL_TAG_ORIENTATION,
Size,
&MemoryHandle,
(PVOID*)&m_pData);
Expand Down Expand Up @@ -237,7 +236,7 @@ SimpleDeviceOrientationDevice::Initialize(
MemoryAttributes.ParentObject = SensorInstance;
Status = WdfMemoryCreate(&MemoryAttributes,
PagedPool,
SENSORV2_POOL_TAG_LINEAR_ACCELEROMETER,
FWK_SENSORS_POOL_TAG_ORIENTATION,
Size,
&MemoryHandle,
(PVOID*)&m_pProperties);
Expand Down Expand Up @@ -280,7 +279,7 @@ SimpleDeviceOrientationDevice::Initialize(
MemoryAttributes.ParentObject = SensorInstance;
Status = WdfMemoryCreate(&MemoryAttributes,
PagedPool,
SENSORV2_POOL_TAG_LINEAR_ACCELEROMETER,
FWK_SENSORS_POOL_TAG_ORIENTATION,
Size,
&MemoryHandle,
(PVOID*)&m_pDataFieldProperties);
Expand Down Expand Up @@ -320,7 +319,7 @@ SimpleDeviceOrientationDevice::Initialize(
MemoryAttributes.ParentObject = SensorInstance;
Status = WdfMemoryCreate(&MemoryAttributes,
PagedPool,
SENSORV2_POOL_TAG_LINEAR_ACCELEROMETER,
FWK_SENSORS_POOL_TAG_ORIENTATION,
Size,
&MemoryHandle,
(PVOID*)&m_pThresholds);
Expand Down