diff options
author | JP Abgrall <jpa@google.com> | 2012-10-03 20:16:57 -0700 |
---|---|---|
committer | JP Abgrall <jpa@google.com> | 2012-10-03 20:16:57 -0700 |
commit | 33ce91b37062fa63af192f5643de93f3beebe854 (patch) | |
tree | ba6a03c7954a32ce23b00c6d46cd3d524f4d7007 /libsensors_iio/software/simple_apps/common/helper.c | |
parent | 64ca18f95225d0a86f7ccfd1d21c23971b9f77ae (diff) | |
download | android_hardware_invensense-33ce91b37062fa63af192f5643de93f3beebe854.tar.gz android_hardware_invensense-33ce91b37062fa63af192f5643de93f3beebe854.tar.bz2 android_hardware_invensense-33ce91b37062fa63af192f5643de93f3beebe854.zip |
MotionApps 5.1.1 release, with MA 5.1.0 for further merge review.cm-10.1.3-RC2cm-10.1.3-RC1cm-10.1.3cm-10.1.2cm-10.1.1cm-10.1.0-RC5cm-10.1.0-RC4cm-10.1.0-RC3cm-10.1.0-RC2cm-10.1.0-RC1cm-10.1.0cm-10.1-M3cm-10.1-M2cm-10.1-M1mr1.1-stagingcm-10.1
1. Removed all #ifdef in HAL's member APIs.
2. Added necessary comments as reference.
3. Made changes for coding style, optimization and so on per prior comments.
4. Now raw/calibrated gyroscope sensors could co-exist
Default sensor would be calibrated gyroscope sensor
for getDefaultSensor() call in Android.
* Correctly handle onPower()/masterEnable().
* Use the support functions for reading/writing sysfs.
1 line instead of 9 all over the place.
* Fix return code for {read,write}_sysfs_int():
was > 0 in case of failure instead of < 0.
Bug: 7211625
Change-Id: Ib49dab8ca0f48f45a2838de72f4f8ac011d0e68f
Diffstat (limited to 'libsensors_iio/software/simple_apps/common/helper.c')
-rw-r--r-- | libsensors_iio/software/simple_apps/common/helper.c | 110 |
1 files changed, 0 insertions, 110 deletions
diff --git a/libsensors_iio/software/simple_apps/common/helper.c b/libsensors_iio/software/simple_apps/common/helper.c deleted file mode 100644 index 4d634bd..0000000 --- a/libsensors_iio/software/simple_apps/common/helper.c +++ /dev/null @@ -1,110 +0,0 @@ -/* - $License: - Copyright (C) 2011 InvenSense Corporation, All Rights Reserved. - $ - */ -/******************************************************************************* - * - * $Id: helper.c 4367 2010-12-21 03:02:55Z prao $ - * - *******************************************************************************/ - -#include <stdio.h> -#ifdef _WIN32 -#include <windows.h> -#include <conio.h> -#endif -#ifdef LINUX -#include <sys/select.h> -#endif -#include <time.h> -#include <string.h> - -#include "ml.h" -#include "slave.h" -#include "mldl.h" -#include "mltypes.h" -#include "mlstates.h" -#include "compass.h" - -#include "mlsl.h" -#include "ml.h" - -#include "helper.h" -#include "mlsetup.h" -#include "fopenCMake.h" -#include "int.h" -#include "mlos.h" - -#include "log.h" -#undef MPL_LOG_TAG -#define MPL_LOG_TAG "MPL-helper" - -#ifdef AIO -extern inv_error_t MLSLSetYamahaCompassDataMode(unsigned char mode); -#endif - -// Keyboard hit function -int ConsoleKbhit(void) -{ -#ifdef _WIN32 - return _kbhit(); -#else - struct timeval tv; - fd_set read_fd; - - tv.tv_sec=0; - tv.tv_usec=0; - FD_ZERO(&read_fd); - FD_SET(0,&read_fd); - - if(select(1, &read_fd, NULL, NULL, &tv) == -1) - return 0; - - if(FD_ISSET(0,&read_fd)) - return 1; - - return 0; -#endif -} - -char ConsoleGetChar(void) { -#ifdef _WIN32 - return _getch(); -#else - return getchar(); -#endif -} -struct mpuirq_data** InterruptPoll(int *handles, int numHandles, long tv_sec, long tv_usec) -{ - struct mpuirq_data **data; - void *tmp; - int ii; - const int irq_data_size = sizeof(**data) * numHandles + - sizeof(*data) * numHandles; - - tmp = (void *)inv_malloc(irq_data_size); - memset(tmp, 0, irq_data_size); - data = (struct mpuirq_data **)tmp; - for (ii = 0; ii < numHandles; ii++) { - data[ii] = (struct mpuirq_data *)((unsigned long)tmp + - (sizeof(*data) * numHandles) + sizeof(**data) * ii); - } - - if (IntProcess(handles, numHandles, data, tv_sec, tv_usec) > 0) { - for (ii = 0; ii < numHandles; ii++) { - if (data[ii]->interruptcount) { - inv_interrupt_handler(ii); - } - } - } - - /* Return data incase the application needs to look at the timestamp or - other part of the data */ - return data; -} - -void InterruptPollDone(struct mpuirq_data ** data) -{ - inv_free(data); -} |