Skip to content

Latest commit

 

History

History
58 lines (42 loc) · 2.82 KB

File metadata and controls

58 lines (42 loc) · 2.82 KB

stm-sensors-hal-iio core documentation

Introduction

This is the documentation page for the core components of the sensors-hal iio.

Integration

The sensorhal core uses some custom defines that are defined in the Linux IIO drivers package for STMicroelectronics MEMS sensors.

These custom values were previously hardwired into the HAL, since version 6.1 of the kernel some of the custom values have been reused by the IIO framework and for this reason it was necessary to modify them accordingly also to the GKI requirements. It is recommended to always keep the IIO drivers aligned with the version of HAL to ensure full compatibility.

To be able to import these defines it will be necessary to copy the following two files in the <SENSORHAL_TOPDIR>/core/include/local/ directory of the core library:

stm_iio_types.h - this file (when available) is located in the common directory of STMicroelectronics Linux IIO drivers public github repository: [https://github.com/STMicroelectronics/st-mems-android-linux-drivers-iio/tree/master/drivers/iio/stm/common]

types.h - this file is generated by Android to remove all Linux kernel GPL2 licensing dependencies, usually it’s saved in aosp directory: <AOSP-TOPDIR>/bionic/libc/kernel/uapi/linux/iio/types.h

If these two files are not copied into the core/include/local directory of the sensor hal library, the values of the custom types will be assigned maintaining backward compatibility with the past, but the new drivers will not take advantage of some of the features implemented in this custom types.

Configuration

Configuration is performed at compile time using CFLAGS. Depending on which ‘wrapper’ you are building, changes have to be made in the correspondent Makefile (Android.bp, Android.mk, CMakeLists.txt)

List of general parameters:

HAL_MAX_ODR_HZ
[int] max odr value that will be used by HAL
HAL_ACCEL_MAX_RANGE_MS2
[int, m/s^2] max value that we would like to measure with accelerometer
HAL_MAGN_MAX_RANGE_UT
[int, uTesla] max value that we would like to measure with magnetometer
HAL_GYRO_MAX_RANGE_RPS
[int, radiants] max value that we would like to measure with gyroscope

The just listed parameters can also be changed dynamically at run-time. Check wrappers documentation for details.

Enable/Disable libraries (by default mock libraries):

HAL_ENABLE_ACCEL_CALIBRATION
[possible values: 0 (disabled) or not 0 (enabled)]
HAL_ENABLE_GYRO_CALIBRATION
[possible values: 0 (disabled) or not 0 (enabled)]
HAL_ENABLE_MAGN_CALIBRATION
[possible values: 0 (disabled) or not 0 (enabled)]
HAL_ENABLE_SENSORS_FUSION
[possible values: 0 (disabled) or not 0 (enabled)]
HAL_ENABLE_TIMESYNC
[possible values: 0 (disabled) or not 0 (enabled)]