资源简介
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 “lsm303dlh_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)
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 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破解补丁
- 下一篇:Spark开发指南
相关资源
- 基于OpenCV和Halcon的交通冲突视频自动
- HALCON简单介绍 20181126
- halcon 8 matrox imaging library7.5(MIL-LITE7
- halcon倾斜车牌识别源代码
- Halcon软件提取轮廓功能
- labview 调用halcon
- halcon_17 深度学习
- 电子罗盘HMC5883L自校准程序
- halcon写的spoke找圆
- hmc5883l 电子罗盘430单片机程序
- HALCON连接多摄像头以及图像合并
- halcon10.zip
- HALCON视频-教程
- Halcon抓直线
- HAL库stm32F429IG正交编码器
- The Whale Optimization Algorithm.
- labview把图片转halcon图片
- halcon----mnist
- halcon例程.txt
- 超详细 halcon 相机标定 !!
- halcon全套资料.txt
- halcon轮廓定位模板定位的专利资料含
- iNEMO-V2LSM303DLHC(3轴加速度+3轴地磁)
- STM32矩阵键盘HAL库实现,轮询方式,方
- 利用halcon及水星SDK开发控制相机
- Halcon图像的清晰度计算
- halcon的自定义创建直线和圆形矩阵抓
- test30.zip
- lcc
- S25FL512SAGMFI011.rar
评论
共有 条评论