diff options
author | Ziyan <jaraidaniel@gmail.com> | 2015-10-16 22:43:15 +0200 |
---|---|---|
committer | Ziyan <jaraidaniel@gmail.com> | 2016-01-17 20:20:10 +0100 |
commit | 6498dace6ac5c668618bf0312fcf31612a93a748 (patch) | |
tree | a5689951ec2f6344fce76b9e6e5db51de6f14c4a | |
parent | 59acde2467e57965536cbd34ce625ad097ad13f5 (diff) | |
download | device_samsung_tuna-6498dace6ac5c668618bf0312fcf31612a93a748.zip device_samsung_tuna-6498dace6ac5c668618bf0312fcf31612a93a748.tar.gz device_samsung_tuna-6498dace6ac5c668618bf0312fcf31612a93a748.tar.bz2 |
invensense: remove support for unused sensors
-rw-r--r-- | invensense/libinvensense_hal/MPLSensor.cpp | 176 | ||||
-rw-r--r-- | invensense/libinvensense_hal/MPLSensor.h | 3 | ||||
-rw-r--r-- | invensense/libinvensense_hal/sensor_params.h | 88 | ||||
-rw-r--r-- | invensense/mlsdk/Android.mk | 4 |
4 files changed, 11 insertions, 260 deletions
diff --git a/invensense/libinvensense_hal/MPLSensor.cpp b/invensense/libinvensense_hal/MPLSensor.cpp index e80ce52..9ad911f 100644 --- a/invensense/libinvensense_hal/MPLSensor.cpp +++ b/invensense/libinvensense_hal/MPLSensor.cpp @@ -115,7 +115,7 @@ void mot_cb_wrapper(uint16_t val) void procData_cb_wrapper() { - if(gMPLSensor) { + if (gMPLSensor) { gMPLSensor->cbProcData(); } } @@ -266,7 +266,6 @@ MPLSensor::MPLSensor() : pthread_mutex_unlock(&mMplMutex); - } MPLSensor::~MPLSensor() @@ -319,7 +318,6 @@ void MPLSensor::setPowerStates(int enabled_sensors) bool irq_set[5] = { false, false, false, false, false }; do { - if (LA_ENABLED || GR_ENABLED || RV_ENABLED || O_ENABLED) { mLocalSensorMask = ALL_MPL_SENSORS_NP; break; @@ -347,7 +345,6 @@ void MPLSensor::setPowerStates(int enabled_sensors) } else { mLocalSensorMask &= ~(INV_THREE_AXIS_COMPASS); } - } while (0); //record the new sensor state @@ -418,7 +415,6 @@ void MPLSensor::setPowerStates(int enabled_sensors) mPollTime = -1; mCurFifoRate = -1; } - } /** @@ -482,7 +478,6 @@ void MPLSensor::initMPL() } setupCallbacks(); - } /** setup the fifo contents. @@ -522,7 +517,6 @@ void MPLSensor::setupFIFO() if (result != INV_SUCCESS) { ALOGE("Fatal error: inv_send_gyro returned %d\n", result); } - } /** @@ -669,7 +663,6 @@ void MPLSensor::rvHandler(sensors_event_t* s, uint32_t* pending_mask, s->gyro.v[0] = quat[1]; s->gyro.v[1] = quat[2]; s->gyro.v[2] = quat[3]; - } void MPLSensor::laHandler(sensors_event_t* s, uint32_t* pending_mask, @@ -758,7 +751,6 @@ void MPLSensor::orienHandler(sensors_event_t* s, uint32_t* pending_mask, *pending_mask |= (1 << index); else ALOGW("orienHandler: data not valid (%d)", (int) res); - } int MPLSensor::enable(int32_t handle, int en) @@ -981,7 +973,6 @@ int MPLSensor::readEvents(sensors_event_t* data, int count) numEventReceived++; } } - } pthread_mutex_unlock(&mMplMutex); @@ -1005,8 +996,7 @@ int MPLSensor::getTimerFd() const int MPLSensor::getPowerFd() const { - int hdl = (uintptr_t) inv_get_serial_handle(); - return hdl; + return (uintptr_t) inv_get_serial_handle(); } int MPLSensor::getPollTime() @@ -1083,21 +1073,19 @@ int MPLSensor::populateSensorList(struct sensor_t *list, size_t len) /* first add gyro, accel and compass to the list */ /* fill in accel values */ - unsigned short accelId = inv_get_accel_id(); - if(accelId == 0) { - ALOGE("Can not get accel id"); - } - fillAccel(accelId, list); + list[Accelerometer].maxRange = ACCEL_BMA250_RANGE; + list[Accelerometer].resolution = ACCEL_BMA250_RESOLUTION; + list[Accelerometer].power = ACCEL_BMA250_POWER; /* fill in compass values */ - unsigned short compassId = inv_get_compass_id(); - if(compassId == 0) { - ALOGE("Can not get compass id"); - } - fillCompass(compassId, list); + list[MagneticField].maxRange = COMPASS_YAS530_RANGE; + list[MagneticField].resolution = COMPASS_YAS530_RESOLUTION; + list[MagneticField].power = COMPASS_YAS530_POWER; /* fill in gyro values */ - fillGyro(MPU_NAME, list); + list[Gyro].maxRange = GYRO_MPU3050_RANGE; + list[Gyro].resolution = GYRO_MPU3050_RESOLUTION; + list[Gyro].power = GYRO_MPU3050_POWER; if(mNineAxisEnabled) { @@ -1123,148 +1111,6 @@ int MPLSensor::populateSensorList(struct sensor_t *list, size_t len) return numsensors; } -void MPLSensor::fillAccel(unsigned char accel, struct sensor_t *list) -{ - switch (accel) { - case ACCEL_ID_LIS331: - list[Accelerometer].maxRange = ACCEL_LIS331_RANGE; - list[Accelerometer].resolution = ACCEL_LIS331_RESOLUTION; - list[Accelerometer].power = ACCEL_LIS331_POWER; - break; - - case ACCEL_ID_LIS3DH: - list[Accelerometer].maxRange = ACCEL_LIS3DH_RANGE; - list[Accelerometer].resolution = ACCEL_LIS3DH_RESOLUTION; - list[Accelerometer].power = ACCEL_LIS3DH_POWER; - break; - - case ACCEL_ID_KXSD9: - list[Accelerometer].maxRange = ACCEL_KXSD9_RANGE; - list[Accelerometer].resolution = ACCEL_KXSD9_RESOLUTION; - list[Accelerometer].power = ACCEL_KXSD9_POWER; - break; - - case ACCEL_ID_KXTF9: - list[Accelerometer].maxRange = ACCEL_KXTF9_RANGE; - list[Accelerometer].resolution = ACCEL_KXTF9_RESOLUTION; - list[Accelerometer].power = ACCEL_KXTF9_POWER; - break; - - case ACCEL_ID_BMA150: - list[Accelerometer].maxRange = ACCEL_BMA150_RANGE; - list[Accelerometer].resolution = ACCEL_BMA150_RESOLUTION; - list[Accelerometer].power = ACCEL_BMA150_POWER; - break; - - case ACCEL_ID_BMA222: - list[Accelerometer].maxRange = ACCEL_BMA222_RANGE; - list[Accelerometer].resolution = ACCEL_BMA222_RESOLUTION; - list[Accelerometer].power = ACCEL_BMA222_POWER; - break; - - case ACCEL_ID_BMA250: - list[Accelerometer].maxRange = ACCEL_BMA250_RANGE; - list[Accelerometer].resolution = ACCEL_BMA250_RESOLUTION; - list[Accelerometer].power = ACCEL_BMA250_POWER; - break; - - case ACCEL_ID_ADXL34X: - list[Accelerometer].maxRange = ACCEL_ADXL34X_RANGE; - list[Accelerometer].resolution = ACCEL_ADXL34X_RESOLUTION; - list[Accelerometer].power = ACCEL_ADXL34X_POWER; - break; - - case ACCEL_ID_MMA8450: - list[Accelerometer].maxRange = ACCEL_MMA8450_RANGE; - list[Accelerometer].maxRange = ACCEL_MMA8450_RANGE; - list[Accelerometer].maxRange = ACCEL_MMA8450_RANGE; - break; - - case ACCEL_ID_MMA845X: - list[Accelerometer].maxRange = ACCEL_MMA845X_RANGE; - list[Accelerometer].resolution = ACCEL_MMA845X_RESOLUTION; - list[Accelerometer].power = ACCEL_MMA845X_POWER; - break; - - case ACCEL_ID_MPU6050: - list[Accelerometer].maxRange = ACCEL_MPU6050_RANGE; - list[Accelerometer].resolution = ACCEL_MPU6050_RESOLUTION; - list[Accelerometer].power = ACCEL_MPU6050_POWER; - break; - default: - ALOGE("unknown accel id -- accel params will be wrong."); - break; - } -} - -void MPLSensor::fillCompass(unsigned char compass, struct sensor_t *list) -{ - switch (compass) { - case COMPASS_ID_AK8975: - list[MagneticField].maxRange = COMPASS_AKM8975_RANGE; - list[MagneticField].resolution = COMPASS_AKM8975_RESOLUTION; - list[MagneticField].power = COMPASS_AKM8975_POWER; - break; - case COMPASS_ID_AMI30X: - list[MagneticField].maxRange = COMPASS_AMI30X_RANGE; - list[MagneticField].resolution = COMPASS_AMI30X_RESOLUTION; - list[MagneticField].power = COMPASS_AMI30X_POWER; - break; - case COMPASS_ID_AMI306: - list[MagneticField].maxRange = COMPASS_AMI306_RANGE; - list[MagneticField].resolution = COMPASS_AMI306_RESOLUTION; - list[MagneticField].power = COMPASS_AMI306_POWER; - break; - case COMPASS_ID_YAS529: - list[MagneticField].maxRange = COMPASS_YAS529_RANGE; - list[MagneticField].resolution = COMPASS_AMI306_RESOLUTION; - list[MagneticField].power = COMPASS_AMI306_POWER; - break; - case COMPASS_ID_YAS530: - list[MagneticField].maxRange = COMPASS_YAS530_RANGE; - list[MagneticField].resolution = COMPASS_YAS530_RESOLUTION; - list[MagneticField].power = COMPASS_YAS530_POWER; - break; - case COMPASS_ID_HMC5883: - list[MagneticField].maxRange = COMPASS_HMC5883_RANGE; - list[MagneticField].resolution = COMPASS_HMC5883_RESOLUTION; - list[MagneticField].power = COMPASS_HMC5883_POWER; - break; - case COMPASS_ID_MMC314X: - list[MagneticField].maxRange = COMPASS_MMC314X_RANGE; - list[MagneticField].resolution = COMPASS_MMC314X_RESOLUTION; - list[MagneticField].power = COMPASS_MMC314X_POWER; - break; - case COMPASS_ID_HSCDTD002B: - list[MagneticField].maxRange = COMPASS_HSCDTD002B_RANGE; - list[MagneticField].resolution = COMPASS_HSCDTD002B_RESOLUTION; - list[MagneticField].power = COMPASS_HSCDTD002B_POWER; - break; - case COMPASS_ID_HSCDTD004A: - list[MagneticField].maxRange = COMPASS_HSCDTD004A_RANGE; - list[MagneticField].resolution = COMPASS_HSCDTD004A_RESOLUTION; - list[MagneticField].power = COMPASS_HSCDTD004A_POWER; - break; - default: - ALOGE("unknown compass id -- compass parameters will be wrong"); - } -} - -void MPLSensor::fillGyro(const char* gyro, struct sensor_t *list) -{ - if ((gyro != NULL) && (strcmp(gyro, "mpu3050") == 0)) { - list[Gyro].maxRange = GYRO_MPU3050_RANGE; - list[Gyro].resolution = GYRO_MPU3050_RESOLUTION; - list[Gyro].power = GYRO_MPU3050_POWER; - } else { - list[Gyro].maxRange = GYRO_MPU6050_RANGE; - list[Gyro].resolution = GYRO_MPU6050_RESOLUTION; - list[Gyro].power = GYRO_MPU6050_POWER; - } - return; -} - - /* fillRV depends on values of accel and compass in the list */ void MPLSensor::fillRV(struct sensor_t *list) { diff --git a/invensense/libinvensense_hal/MPLSensor.h b/invensense/libinvensense_hal/MPLSensor.h index 052087d..b6b133e 100644 --- a/invensense/libinvensense_hal/MPLSensor.h +++ b/invensense/libinvensense_hal/MPLSensor.h @@ -126,9 +126,6 @@ private: /* added for dynamic get sensor list */ bool mNineAxisEnabled; - void fillAccel(unsigned char accel, struct sensor_t *list); - void fillCompass(unsigned char compass, struct sensor_t *list); - void fillGyro(const char* gyro, struct sensor_t *list); void fillRV(struct sensor_t *list); void fillOrientation(struct sensor_t *list); void fillGravity(struct sensor_t *list); diff --git a/invensense/libinvensense_hal/sensor_params.h b/invensense/libinvensense_hal/sensor_params.h index 4925ac4..056e587 100644 --- a/invensense/libinvensense_hal/sensor_params.h +++ b/invensense/libinvensense_hal/sensor_params.h @@ -26,109 +26,21 @@ #define SENSORS_MAGNETIC_FIELD_HANDLE (ID_M) #define SENSORS_ORIENTATION_HANDLE (ID_O) /******************************************/ -//COMPASS_ID_AKM -#define COMPASS_AKM8975_RANGE (9830.0f) -#define COMPASS_AKM8975_RESOLUTION (0.285f) -#define COMPASS_AKM8975_POWER (10.0f) -//COMPASS_ID_AMI30X -#define COMPASS_AMI30X_RANGE (5461.0f) -#define COMPASS_AMI30X_RESOLUTION (0.9f) -#define COMPASS_AMI30X_POWER (0.15f) -//COMPASS_ID_AMI306 -#define COMPASS_AMI306_RANGE (5461.0f) -#define COMPASS_AMI306_RESOLUTION (0.9f) -#define COMPASS_AMI306_POWER (0.15f) -//COMPASS_ID_YAS529 -#define COMPASS_YAS529_RANGE (19660.0f) -#define COMPASS_YAS529_RESOLUTION (0.012f) -#define COMPASS_YAS529_POWER (4.0f) //COMPASS_ID_YAS530 #define COMPASS_YAS530_RANGE (8001.0f) #define COMPASS_YAS530_RESOLUTION (0.012f) #define COMPASS_YAS530_POWER (4.0f) -//COMPASS_ID_HMC5883 -#define COMPASS_HMC5883_RANGE (10673.0f) -#define COMPASS_HMC5883_RESOLUTION (10.0f) -#define COMPASS_HMC5883_POWER (0.24f) -//COMPASS_ID_LSM303DLH -#define COMPASS_LSM303DLH_RANGE (10240.0f) -#define COMPASS_LSM303DLH_RESOLUTION (1.0f) -#define COMPASS_LSM303DLH_POWER (1.0f) -//COMPASS_ID_LSM303DLM -#define COMPASS_LSM303DLM_RANGE (10240.0f) -#define COMPASS_LSM303DLM_RESOLUTION (1.0f) -#define COMPASS_LSM303DLM_POWER (1.0f) -//COMPASS_ID_MMC314X -#define COMPASS_MMC314X_RANGE (400.0f) -#define COMPASS_MMC314X_RESOLUTION (2.0f) -#define COMPASS_MMC314X_POWER (0.55f) -//COMPASS_ID_HSCDTD002B -#define COMPASS_HSCDTD002B_RANGE (9830.0f) -#define COMPASS_HSCDTD002B_RESOLUTION (1.0f) -#define COMPASS_HSCDTD002B_POWER (1.0f) -//COMPASS_ID_HSCDTD004A -#define COMPASS_HSCDTD004A_RANGE (9830.0f) -#define COMPASS_HSCDTD004A_RESOLUTION (1.0f) -#define COMPASS_HSCDTD004A_POWER (1.0f) /*******************************************/ -//ACCEL_ID_LIS331 -#define ACCEL_LIS331_RANGE (2.480f*GRAVITY_EARTH) -#define ACCEL_LIS331_RESOLUTION (.001f*GRAVITY_EARTH) -#define ACCEL_LIS331_POWER (1.0f) -//ACCEL_ID_LSM303DLX -#define ACCEL_LSM303DLX_RANGE (2.480f*GRAVITY_EARTH) -#define ACCEL_LSM303DLX_RESOLUTION (0.001f*GRAVITY_EARTH) -#define ACCEL_LSM303DLX_POWER (1.0f) -//ACCEL_ID_LIS3DH -#define ACCEL_LIS3DH_RANGE (2.480f*GRAVITY_EARTH) -#define ACCEL_LIS3DH_RESOLUTION (0.001f*GRAVITY_EARTH) -#define ACCEL_LIS3DH_POWER (1.0f) -//ACCEL_ID_KXSD9 -#define ACCEL_KXSD9_RANGE (2.5006f*GRAVITY_EARTH) -#define ACCEL_KXSD9_RESOLUTION (0.001f*GRAVITY_EARTH) -#define ACCEL_KXSD9_POWER (1.0f) -//ACCEL_ID_KXTF9 -#define ACCEL_KXTF9_RANGE (1.0f*GRAVITY_EARTH) -#define ACCEL_KXTF9_RESOLUTION (0.033f*GRAVITY_EARTH) -#define ACCEL_KXTF9_POWER (0.35f) -//ACCEL_ID_BMA150 -#define ACCEL_BMA150_RANGE (2.0f*GRAVITY_EARTH) -#define ACCEL_BMA150_RESOLUTION (0.004f*GRAVITY_EARTH) -#define ACCEL_BMA150_POWER (0.2f) -//ACCEL_ID_BMA222 -#define ACCEL_BMA222_RANGE (2.0f*GRAVITY_EARTH) -#define ACCEL_BMA222_RESOLUTION (0.001f*GRAVITY_EARTH) -#define ACCEL_BMA222_POWER (0.1f) //ACCEL_ID_BMA250 #define ACCEL_BMA250_RANGE (2.0f*GRAVITY_EARTH) #define ACCEL_BMA250_RESOLUTION (0.00391f*GRAVITY_EARTH) #define ACCEL_BMA250_POWER (0.139f) -//ACCEL_ID_ADXL34X -#define ACCEL_ADXL34X_RANGE (2.0f*GRAVITY_EARTH) -#define ACCEL_ADXL34X_RESOLUTION (0.001f*GRAVITY_EARTH) -#define ACCEL_ADXL34X_POWER (1.0f) -//ACCEL_ID_MMA8450 -#define ACCEL_MMA8450_RANGE (2.0f*GRAVITY_EARTH) -#define ACCEL_MMA8450_RESOLUTION (0.001f*GRAVITY_EARTH) -#define ACCEL_MMA8450_POWER (1.0f) -//ACCEL_ID_MMA845X -#define ACCEL_MMA845X_RANGE (2.0f*GRAVITY_EARTH) -#define ACCEL_MMA845X_RESOLUTION (0.001f*GRAVITY_EARTH) -#define ACCEL_MMA845X_POWER (1.0f) -//ACCEL_ID_MPU6050 -#define ACCEL_MPU6050_RANGE (2.0f*GRAVITY_EARTH) -#define ACCEL_MPU6050_RESOLUTION (0.004f*GRAVITY_EARTH) -#define ACCEL_MPU6050_POWER (0.0f) /******************************************/ //GYRO MPU3050 #define RAD_P_DEG (3.14159f/180.0f) #define GYRO_MPU3050_RANGE (2000.0f*RAD_P_DEG) #define GYRO_MPU3050_RESOLUTION (32.8f*RAD_P_DEG) #define GYRO_MPU3050_POWER (6.1f) -//GYRO MPU6050 -#define GYRO_MPU6050_RANGE (2000.0f*RAD_P_DEG) -#define GYRO_MPU6050_RESOLUTION (16.4f*RAD_P_DEG) -#define GYRO_MPU6050_POWER (5.5f) #endif diff --git a/invensense/mlsdk/Android.mk b/invensense/mlsdk/Android.mk index 230d4f0..25e0907 100644 --- a/invensense/mlsdk/Android.mk +++ b/invensense/mlsdk/Android.mk @@ -72,9 +72,5 @@ LOCAL_SRC_FILES := \ mlutils/mputest.c \ mlutils/checksum.c -ifeq ($(HARDWARE),M_HW) - LOCAL_SRC_FILES += mllite/accel/mantis.c -endif - LOCAL_SHARED_LIBRARIES := libm libutils libcutils liblog libmlplatform include $(BUILD_SHARED_LIBRARY) |