1 Star 0 Fork 4.9K

bill / docs

forked from OpenHarmony / docs 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
sensor-driver-development-guidelines.md 2.29 KB
一键复制 编辑 原始数据 按行查看 历史
NEEN 提交于 2021-03-12 17:59 . !197 Docs Update version 1.0.1

Sensor Driver Development Guidelines

Regardless of the OS and system on a chip (SoC), the sensor driver is developed based on the HDF, platform, and OSAL APIs to provide a unified driver model for sensor devices. This section uses the acceleration sensor as an example to describe how to develop a sensor driver.

How to Develop

  1. Register the acceleration sensor driver. The HDF provides a unified driver management model. The HDF identifies and loads the target module driver based on the configuration information of the acceleration sensor module.
  2. Initialize and deinitialize the acceleration sensor driver. Using the init function, the HDF starts loading the sensor device driver and allocating configuration resources for sensor device data, respectively. Using the release function, the HDF releases the resources and configurations loaded by the driver.
  3. Parse the configurations of the acceleration sensor register group. For different types of sensors, you need to configure their respective HCS configuration files in the HCS, check whether the sensor device is in position during the device driver startup, and then load the corresponding configuration file to generate the configuration structure object.
  4. Implement APIs for acceleration sensor driver operations. The driver APIs for various types of sensors, such as init, GetInfo, Enable, Disable, SetBatch, SetMode, SetOption, and ReadSensorData, are normalized to deliver sensor driver configurations and report sensor data.

NOTE: The sensor driver model provides a collection of APIs to implement sensor driver capabilities, including the driver device management capabilities, abstract bus and platform operation capabilities, general configuration capabilities, and configuration parsing capabilities. For details about the APIs, see Table 2. You need to implement the following APIs: some operations to perform on sensors (Table 3), differentiated data configuration of the sensor HCS, and verification of basic driver functions.

1
https://gitee.com/ximeibaba/docs.git
git@gitee.com:ximeibaba/docs.git
ximeibaba
docs
docs
master

搜索帮助