OSDN Git Service

libsensors: Added Pressure sensor configuration for BYT-M.
authorArchana <archana.patni@linux.intel.com>
Tue, 11 Feb 2014 12:28:58 +0000 (07:28 -0500)
committerLilja, Ola <ola.lilja@intel.com>
Thu, 20 Feb 2014 12:04:20 +0000 (04:04 -0800)
This patch adds the Pressure sensor configuration changes
for BYT-M.

Signed-off-by: Archana Patni <archana.patni@intel.com>
Change-Id: I5166274a4bdeb8fe06d50e319526e13c1f1816e8
Reviewed-on: https://android.intel.com/162308
Tested-by: sys_abtbuild <sys_abtbuild@intel.com>
Reviewed-by: Lilja, Ola <ola.lilja@intel.com>
bytm/Android.mk
bytm/BoardConfig.cpp
bytm/SensorConfig.h

index fc3a612..f42ddc2 100644 (file)
@@ -36,6 +36,7 @@ sensor_src_files := $(common_src_path)/HidSensor_Accel3D.cpp \
                    $(common_src_path)/HidSensor_Gyro3D.cpp \
                    $(common_src_path)/HidSensor_Compass3D.cpp \
                    $(common_src_path)/HidSensor_ALS.cpp \
+                   $(common_src_path)/HidSensor_Pressure.cpp \
                    $(common_src_path)/RotVecSensor.cpp \
                    $(common_src_path)/SynthCompassSensor.cpp \
                    $(common_src_path)/OrientationSensor.cpp \
index 9b9352b..8b7aa30 100644 (file)
@@ -28,6 +28,7 @@
 #include "HidSensor_Gyro3D.h"
 #include "HidSensor_Compass3D.h"
 #include "HidSensor_ALS.h"
+#include "HidSensor_Pressure.h"
 #include "OrientationSensor.h"
 #include "RotVecSensor.h"
 #include "SynthCompassSensor.h"
@@ -37,6 +38,7 @@ static const struct sensor_t sSensorList[] = {
     GyroSensor::sSensorInfo_gyro3D,
     SynthCompassSensor::sSensorInfo_compass,
     ALSSensor::sSensorInfo_als,
+    PressureSensor::sSensorInfo_pressure,
     RotVecSensor::sSensorInfo_rotvec,
     OrientationSensor::sSensorInfo_orientation,
 };
@@ -99,6 +101,7 @@ void BoardConfig::initSensors(SensorBase* sensors[])
     sensors[gyro] = new GyroSensor();
     sensors[compass] = new CompassSensor();
     sensors[light] = new ALSSensor();
+    sensors[pressure] = new PressureSensor();
     sensors[rotvec] = new RotVecSensor();
     sensors[syncompass] = new SynthCompassSensor();
     sensors[orientation] = new OrientationSensor();
@@ -112,6 +115,7 @@ int BoardConfig::handleToDriver(int handle)
     case ID_M:
         return compass;
     case ID_PR:
+       return pressure;
     case ID_T:
         return -EINVAL;
     case ID_GY:
index b3d81ff..a47bbe9 100644 (file)
@@ -30,6 +30,7 @@ enum {
     rotvec,
     syncompass,
     orientation,
+    pressure,
     numSensorDrivers,
     numFds,
 };
@@ -180,6 +181,9 @@ inline float convert_from_vtf_format(int size, int exponent, unsigned int value)
 #define CONVERT_M_MG_VTF16E14_Y(s,d,x) (convert_from_vtf_format(s,d,x)/10)
 #define CONVERT_M_MG_VTF16E14_Z(s,d,x) (convert_from_vtf_format(s,d,x)/10)
 
+/* from bar to mbar(= hPA) */
+#define CONVERT_PR_HPA_VTF16E14(s,d,x) ((1000.0f)*convert_from_vtf_format(s,d,x))
+
 /*****************************************************************************/
 
 #endif  // SENSOR_CONFIG_H