Sensor Hub 初探

核心定义结构:hardware/libhardware/include/hardware/sensors.h

  sensor_type 类型定义:

    1、#define SENSOR_TYPE_ACCELEROMETER

    2、#define SENSOR_TYPE_GEOMAGNETIC_FIELD

    3、#define SENSOR_TYPE_ORIENTATION

  结构体:

    1、struct sensors_vec_t // sensor event data

    2、struct uncalibrated_event_t //无标定事件,uncalibrated gyroscope and magnetometer event data

    3、struct meta_data_event // meta data event data

    4、struct heart_rate_event_t   //心跳频率

    5、struct sensors_event_t  // union of the various types of sensor data that can be returned

    6、struct sensors_module_t //every hardware module must have a data structure named HAL_MODULE_INFO_SYM

    7、struct sensor_t  // the detail info of a sensor

    8、struct sensors_poll_device_t // it is used with SENSORS_DEVICE_API_VERSION_0_1

    9、struct sensors_poll_device_1  // it is compatible with sensors_poll_device_t. it is used in HAL versions >= SENSORS_DEVICE_API_VERSION_1_0

 

  函数:  (convenience API for opening and closing a device)

    1、sensors_open()  

    2、sensors_close()

    3、sensors_open_1()

    4、sensors_close_1()

 

 

Android does not define how the different physical sensors are connected to the system on chip (SoC).

Often, sensor chips are connected to the SoC through a sensor hub, allowing some low-power monitoring and processing of the data.

Often, Inter-Integrated Circuit (I2C) or Serial Peripheral Interface (SPI) is used as the transport mechanism.

 

Android sensors provide data as a series of sensor events.

Each event contains:

  • a handle to the sensor that generated it
  • the timestamp at which the event was detected or measured
  • and some data

 

Control flows from the applications down to the sensors, and data flows from the sensors up to the applications.

 

 Sensor Stack

  SDK:

    Applications access sensors through the Sensors SDK (Software Development Kit) API. The SDK contains functions to list available sensors and to register to a sensor.

    the application specifies its preferred sampling frequency and its latency requirements. //指定采样频率和延迟请求

  Framework:

    The framework is in charge of linking the several applications to the HAL.  //管理应用程序链接到HAL层

    When a first application registers to a sensor, the framework sends a request to the HAL to activate the sensor. //第一个注册或绑定该sensor

    When the last application registered to one sensor unregisters from it, the frameworks sends a request to the HAL to deactivate the sensor so power is not consumed unnecessarily.  //应用解绑时,deactivity,使之省电

  Impact of multiplexing: //复用的影响

    当多个application 对于同一个sensor,设置不同的sampling frequency时,sensor实际采样是以最快的为准。同时,设置比较慢的application也会收到 快速的rate。

    相对应的,latency也以最短的算。 //即 采样频率以最快的算,延迟时间以最短的算。

    There is no mechanism to send data down from the applications to the sensors or their drivers. This ensures one application cannot modify the behavior of the sensors, breaking other applications. //

  

  Sensor fusion

    

  JNI

    The framework uses a Java Native Interface (JNI) associated with android.hardware and located in the frameworks/base/core/jni/ directory. This code calls the lower level native code to obtain access to the sensor hardware.

  Native Framework:

    The native framework calls the Binder IPC proxies to obtain access to sensor-specific services.

 

 

 

   

 

转载于:https://www.cnblogs.com/zhongyuan/p/4349791.html

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
MTK SensorHub 架构是指联发科技(MediaTek)在其芯片中采用的传感器集成解决方案。SensorHub 是一种低功耗、高性能的处理器,专门用于处理和管理各种传感器数据。下面是 MTK SensorHub 架构的一般概述: 1. 传感器集成:MTK SensorHub 包含了多个传感器,如加速度计、陀螺仪、磁力计、光传感器等。这些传感器可以用于检测设备的运动、环境亮度、方向等信息。 2. 低功耗设计:SensorHub 采用了低功耗设计,使其能够在后台持续运行而不会对设备电池寿命造成过大的影响。它通常会进入休眠状态,并在需要时通过中断或其他触发方式被唤醒。 3. 数据处理和算法:SensorHub 内部集成了处理器和存储器,可以进行传感器数据的实时处理和算法运算。它可以对传感器数据进行滤波、校准、姿态计算等操作,以提供更准确和可靠的传感器输出。 4. 与主处理器通信:SensorHub 与主处理器(如应用处理器)之间通过总线或其他通信接口进行通信。主处理器可以向 SensorHub 发送命令,配置传感器参数,并获取传感器数据。这种分离的架构可以减轻主处理器的负担,提高系统性能和能效。 5. 传感器数据融合:MTK SensorHub 支持传感器数据的融合,即将多个传感器的数据进行整合和处理,以获得更全面和准确的环境感知。例如,通过加速度计和陀螺仪的数据融合,可以实现更精确的运动检测和姿态跟踪。 总的来说,MTK SensorHub 架构提供了一种高效、低功耗的解决方案,用于管理和处理传感器数据。它可以为各种应用场景提供更好的用户体验,如智能手表、智能手机、智能家居等。具体的实现细节可能因不同的芯片型号和版本而有所不同。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值