summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaadi Maalem <saadi.maalem@intel.com>2015-10-28 18:20:50 +0800
committerZhengyin Qian <qianzy@google.com>2015-10-29 11:26:51 -0700
commitdb6e001aa1a7beff7549d2515946189599487a8f (patch)
treeb6e2c81cfee287e03fc33d1b861a170fe76056f1
parent7193963e58558e4ee8518c68766e40e463bf9041 (diff)
downloadsensors-db6e001aa1a7beff7549d2515946189599487a8f.tar.gz
sensor: fix step counter data type casting
Change-Id: Ic3ead5d7b985c643a5da67e4105a76f589e71b22 Tracked-On: https://jira.ndg.intel.com/browse/MARVIN-966 Signed-off-by: Fei Li <feix.f.li@intel.com>
-rw-r--r--libsensors_iio/src/StepCounter.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/libsensors_iio/src/StepCounter.cpp b/libsensors_iio/src/StepCounter.cpp
index ec14292..32575b3 100644
--- a/libsensors_iio/src/StepCounter.cpp
+++ b/libsensors_iio/src/StepCounter.cpp
@@ -75,7 +75,8 @@ int StepCounter::SetDelay(int handle, int64_t period_ns, int64_t timeout)
void StepCounter::ProcessData(SensorBaseData *data)
{
- sensor_event.u64.step_counter = (uint64_t)data->raw[0];
+#define STEP_COUNTER_DATA_MASK 0xFFFF
+ sensor_event.u64.step_counter = (uint64_t)data->raw[0] & STEP_COUNTER_DATA_MASK;
sensor_event.timestamp = data->timestamp;
HWSensorBase::WriteDataToPipe();