資源簡介
lsm303dlh電子羅盤傳感器hal程序,包括源代碼和編譯好的so文件

代碼片段和文件信息
/*
?*?Copyright?(C)?2011?Freescale?Semiconductor?Inc.
?*?Copyright?(C)?2008?The?Android?Open?Source?Project
?*
?*?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.
?*/
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?“AccelSensor.h“
//+++++++++++++++++++add
#define?ACCEL_SENSOR_NAME?“l(fā)sm303dlh_acc_sysfs“
//+++++++++++++++++++by?Jay
/*****************************************************************************/
AccelSensor::AccelSensor()
:?Sensorbase(NULL?NULL)
??????mEnabled(0)
??????mPendingMask(0)
??????mInputReader(32)
??????mMinPollDelay(0)
??????mMaxPollDelay(0)
{
#if?defined(ACCELEROMETER_SENSOR_MMA8451)
????data_name?=?“mma8451“;
#elif?defined(ACCELEROMETER_SENSOR_MMA8450)
????data_name?=?“mma8450“;
//++++++++++++++add
#elif?defined(ACCELEROMETER_SENSOR_LSM)
data_name?=?ACCEL_SENSOR_NAME;
//++++++++++++++by?Jay
#else
#error?you?must?define?accelerometer?properly
data_name?=NULL;
????data_fd?=?-1;
#endif
????if?(data_name)?{
????????data_fd?=?openInput(data_name);
????????getPollFile(data_name);
????}
????memset(mPendingEvents?0?sizeof(mPendingEvents));
????mPendingEvents[Accelerometer].version?=?sizeof(sensors_event_t);
????mPendingEvents[Accelerometer].sensor?=?ID_A;
????mPendingEvents[Accelerometer].type?=?SENSOR_TYPE_ACCELEROMETER;
????mPendingEvents[Accelerometer].acceleration.status?=?SENSOR_STATUS_ACCURACY_HIGH;
????//?read?the?actual?value?of?all?sensors?if?they‘re?enabled?already
????struct?input_absinfo?absinfo;
????short?flags?=?0;
????if?(accel_is_sensor_enabled(SENSOR_TYPE_ACCELEROMETER))??{
????????mEnabled?|=?1< ????????if?(!ioctl(data_fd?EVIOCGABS(EVENT_TYPE_ACCEL_X)?&absinfo))?{
????????????mPendingEvents[Accelerometer].acceleration.x?=?absinfo.value?*?CONVERT_A_X;
????????}
????????if?(!ioctl(data_fd?EVIOCGABS(EVENT_TYPE_ACCEL_Y)?&absinfo))?{
????????????mPendingEvents[Accelerometer].acceleration.y?=?absinfo.value?*?CONVERT_A_Y;
????????}
????????if?(!ioctl(data_fd?EVIOCGABS(EVENT_TYPE_ACCEL_Z)?&absinfo))?{
????????????mPendingEvents[Accelerometer].acceleration.z?=?absinfo.value?*?CONVERT_A_Z;
????????}
????}
}
AccelSensor::~AccelSensor()
{
}
int?AccelSensor::enable(int32_t?handle?int?en)
{
????int?what?=?-1;
????switch?(handle)?{
????????case?ID_A:?what?=?Accelerometer;?break;
????}
????if?(uint32_t(what)?>=?numSensors)
????
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件???????8860??2013-05-17?14:50??hal\compass_hal\AccelSensor.cpp
?????文件???????2206??2013-05-17?14:50??hal\compass_hal\AccelSensor.h
?????文件???????1297??2013-05-17?14:50??hal\compass_hal\Android.mk
?????文件???????2313??2013-05-17?14:50??hal\compass_hal\InputEventReader.cpp
?????文件???????1444??2013-05-17?14:50??hal\compass_hal\InputEventReader.h
?????文件???????9271??2013-05-17?14:50??hal\compass_hal\MagneticSensor.cpp
?????文件???????2309??2013-05-17?14:50??hal\compass_hal\MagneticSensor.h
?????文件???????3225??2013-05-17?14:50??hal\compass_hal\Sensorba
?????文件???????1855??2013-05-17?14:50??hal\compass_hal\Sensorba
?????文件???????9542??2013-05-17?14:50??hal\compass_hal\sensors.cpp
?????文件???????3249??2013-05-17?14:50??hal\compass_hal\sensors.h
?????文件??????18304??2013-05-17?14:39??hal\sensors.default.so
?????文件?????????41??2013-05-17?14:54??hal\新建?文本文檔.txt
?????目錄??????????0??2013-05-17?15:06??hal\compass_hal
?????目錄??????????0??2013-05-17?15:06??hal
-----------?---------??----------?-----??----
????????????????63916????????????????????15
- 上一篇:eagle 9.2.2破解補(bǔ)丁
- 下一篇:Spark開發(fā)指南
評論
共有 條評論