summaryrefslogtreecommitdiff
path: root/6515/libsensors_iio/InputEventReader.h
diff options
context:
space:
mode:
authorNick Vaccaro <nvaccaro@google.com>2013-12-05 17:24:12 -0800
committerNick Vaccaro <nvaccaro@google.com>2013-12-05 17:24:12 -0800
commitc3d4ca9f2df5ddf9894b36d1554fdfc95d625d3f (patch)
tree3439e924808c8e2130a019dd91498d28e8a3b118 /6515/libsensors_iio/InputEventReader.h
parente6d9ab28b4f4e7684f6c07874ee819c9ea0002a2 (diff)
downloadinvensense-c3d4ca9f2df5ddf9894b36d1554fdfc95d625d3f.tar.gz
Motion Apps 5.2.0 HAL Release
Add latest 5.2.0 version of InvenSense HAL for the mpu9250 into it's own unique folder named 6515 so that Hammerhead still uses it's original 65xx HAL. Change-Id: I90f1bbbc1de2283a8d337495b6af59261cd63f88 Signed-off-by: Nick Vaccaro <nvaccaro@google.com>
Diffstat (limited to '6515/libsensors_iio/InputEventReader.h')
-rw-r--r--6515/libsensors_iio/InputEventReader.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/6515/libsensors_iio/InputEventReader.h b/6515/libsensors_iio/InputEventReader.h
new file mode 100644
index 0000000..4e33af3
--- /dev/null
+++ b/6515/libsensors_iio/InputEventReader.h
@@ -0,0 +1,50 @@
+/*
+* Copyright (C) 2012 Invensense, Inc.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#ifndef ANDROID_INPUT_EVENT_READER_H
+#define ANDROID_INPUT_EVENT_READER_H
+
+#include <stdint.h>
+#include <errno.h>
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+#include "SensorBase.h"
+
+/*****************************************************************************/
+
+struct input_event;
+
+class InputEventCircularReader
+{
+ struct input_event* const mBuffer;
+ struct input_event* const mBufferEnd;
+ struct input_event* mHead;
+ struct input_event* mCurr;
+ ssize_t mFreeSpace;
+ int mLastFd;
+
+public:
+ InputEventCircularReader(size_t numEvents);
+ ~InputEventCircularReader();
+ ssize_t fill(int fd);
+ ssize_t readEvent(input_event const** events);
+ void next();
+};
+
+/*****************************************************************************/
+
+#endif // ANDROID_INPUT_EVENT_READER_H