All Projects → STMicroelectronics → STMems_Linux_IIO_drivers

STMicroelectronics / STMems_Linux_IIO_drivers

Licence: other
DISCONTINUED (October 2022): the maintenance for this repository has been discontinued. Please refer to https://github.com/STMicroelectronics/st-mems-android-linux-drivers-iio for the up-to-date drivers repository. This repository contains Linux Kernel (v3.10, v3.14, v3.18, v4.9, v4.14, v4.19) including STMicroelectronics MEMS IIO sensor support

Programming Languages

c
50402 projects - #5 most used programming language
assembly
5116 projects
Makefile
30231 projects
perl
6916 projects
shell
77523 projects
python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to STMems Linux IIO drivers

Onewirehub
OneWire slave device emulator
Stars: ✭ 195 (+178.57%)
Mutual labels:  sensor
Xiaomi miot raw
Universal Xiaomi MIoT integration for Home Assistant
Stars: ✭ 240 (+242.86%)
Mutual labels:  sensor
Radar
Arduino Servo controller with Ultrasonic sensor, that will send distance value from sensor to Node.js via USB serial and leveraging socket.io to send the data to browser in realtime.
Stars: ✭ 24 (-65.71%)
Mutual labels:  sensor
React Native Proximity
📱 A React Native wrapper that provides access to the proximity sensor on iOS and Android.
Stars: ✭ 201 (+187.14%)
Mutual labels:  sensor
Volumetriccapture
A multi-sensor capture system for free viewpoint video.
Stars: ✭ 243 (+247.14%)
Mutual labels:  sensor
Qwiic Spectral Sensor AS726X
Qwiic breakout for the AS7261/AS7262/AS7263 spectral sensors from AMS.
Stars: ✭ 20 (-71.43%)
Mutual labels:  sensor
I2c Moisture Sensor
I2C based soil moisture sensor
Stars: ✭ 194 (+177.14%)
Mutual labels:  sensor
rssd
Rohde & Schwarz SCPI Driver (in Python)
Stars: ✭ 25 (-64.29%)
Mutual labels:  sensor
Terrariumpi
Home automated terrarium/aquarium or other enclosed environment with a Raspberry Pi
Stars: ✭ 249 (+255.71%)
Mutual labels:  sensor
433MHz Tx Rx
Arduino based 433MHz Tx and Rx combo using Manchester protocol
Stars: ✭ 27 (-61.43%)
Mutual labels:  sensor
Sense Js
📱 html5 sensor interaction library for mobile
Stars: ✭ 219 (+212.86%)
Mutual labels:  sensor
React Parallax Tilt
👀 Easily apply tilt hover effect on React components - lightweight/zero dependencies
Stars: ✭ 243 (+247.14%)
Mutual labels:  sensor
rs485-moist-sensor
Digital (RS485 - based) soil moisture and temperature sensor
Stars: ✭ 51 (-27.14%)
Mutual labels:  sensor
Gravity View
Introducing Gravity View: Because swiping is so yesterday!
Stars: ✭ 200 (+185.71%)
Mutual labels:  sensor
SDR Matlab LTE
📡 Using Software Designed Radio to transmit LTE downlink signals at 2.4 GHz
Stars: ✭ 21 (-70%)
Mutual labels:  iio
Micropython Fusion
Sensor fusion calculating yaw, pitch and roll from the outputs of motion tracking devices
Stars: ✭ 194 (+177.14%)
Mutual labels:  sensor
Anniversaries
Anniversary Countdown Sensor for Home Assistant
Stars: ✭ 128 (+82.86%)
Mutual labels:  sensor
TLV493D-A1B6-3DMagnetic-Sensor
Library for the TLV493D-A1B6 3D magnetic sensor for Arduino.
Stars: ✭ 27 (-61.43%)
Mutual labels:  sensor
io
Go drivers for pheripheral I/O on Linux.
Stars: ✭ 20 (-71.43%)
Mutual labels:  iio
falcon-operator
artifacthub.io/packages/olm/falcon-operator/falcon-operator
Stars: ✭ 28 (-60%)
Mutual labels:  sensor

Important Notice

DISCONTINUED (October 2022): the maintenance for this repository has been discontinued.

Please refer to:

https://github.com/STMicroelectronics/st-mems-android-linux-drivers-iio

for the up-to-date drivers repository.

Index

* Introduction
* Integration details
* More information
* Copyright

Introduction

This repository contains Linux kernel v4.4 with STMicroelectronics MEMS sensor support. STM sensor drivers are located under the directory drivers/iio organized by sensor type:

Inertial Module Unit (IMU):

LSM6DS3, LSM6DS3H, LSM6DSL, LSM6DSM, LSM9DS0, LSM9DS1, ISM330DLC, LSM6DSO, ASM330LHH, LSM6DSR, ISM330DHCX, LSM6DSO32, LSM6DSOX, LSM6DSRX, LSM6DSO32X, ASM330LHHX

Accelerometer:

LIS2DH, LIS2DH12, LIS3DH, LIS2DG, LSM303AH, LIS2DS12, LIS2HH12, LIS2DW12, LIS3LV02DL, LSM303DLH, LSM303DLHC, LSM330D, LSM330DL, LSM330DLC, LIS331DL, LIS331DLH, LSM303DL, LSM303DLM, LSM330, LSM303AGR, LIS3DHH, IIS2DH, ISM303DAC, IIS3DHHC, IIS2DLPC, AIS2IH

Gyroscope:

L3G4200D, LSM330D, LSM330DL, L3GD20, L3GD20H, L3G4IS, LSM330, LSM330DLC

Magnetometer:

LIS3MDL, LSM9DS1, LSM303AH, LSM303AGR, LSM303DLH, LSM303DLHC, LSM303DLM, LIS2MDL, IIS2MDC, ISM303DAC

Humidity:

HTS221

Pressure:

LPS22HB, LPS22HD, LPS25H, LPS331AP, LPS001WP, LPS33HW, LPS35HW, LPS22HH, LPS27HHW, LPS22DF

Temperature

STTS22H

Data collected by STM sensors are pushed to userland through the kernel buffers of Linux IIO framework. User space applications can get sensor events by reading the related IIO devices created in the /dev directory (/dev/iio{x}). Please see IIO for more information.

All STM MEMS sensors support I2C/SPI digital interface. Please refer to I2C and SPI for detailed documentation.

Integration details

In order to explain how to integrate STM sensors in a different kernel, please consider the following LSM6DSM IMU example

Source code integration

  • Copy driver source code into the target directory (e.g. drivers/iio/imu)
  • Edit related Kconfig (e.g. drivers/iio/imu/Kconfig) to include LSM6DSM support:
    source "drivers/iio/imu/st_lsm6dsm/Kconfig"
  • Edit related Makefile (e.g. drivers/iio/imu/Makefile) adding the following line:
    obj-y += lsm6dsm/
  • Add custom events into include/uapi/linux/iio/types.h (follow a sample patch for kernel 4.4):
    @@ -85,6 +93,7 @@ enum iio_event_type {
              IIO_EV_TYPE_THRESH_ADAPTIVE,
              IIO_EV_TYPE_MAG_ADAPTIVE,
              IIO_EV_TYPE_CHANGE,
    +         IIO_EV_TYPE_FIFO_FLUSH,
    };

    @@ -92,6 +101,8 @@ enum iio_event_direction {
              IIO_EV_DIR_RISING,
              IIO_EV_DIR_FALLING,
              IIO_EV_DIR_NONE,
    +         IIO_EV_DIR_FIFO_EMPTY,
    +         IIO_EV_DIR_FIFO_DATA,
    };
  • Add custom channel types include/uapi/linux/iio/types.h depending on the custom sensor implemented into driver (follow a sample patch for kernel 4.4):
     @@ -37,6 +37,14 @@ enum iio_chan_type {
              IIO_VELOCITY,
              IIO_CONCENTRATION,
              IIO_RESISTANCE,
    +         IIO_SIGN_MOTION,
    +         IIO_STEP_DETECTOR,
    +         IIO_STEP_COUNTER,
    +         IIO_TILT,
    +         IIO_TAP,
    +         IIO_TAP_TAP,
    +         IIO_WRIST_TILT_GESTURE,
    +         IIO_GESTURE,
    +         IIO_WKUP,
    +         IIO_FREE_FALL,
    };

Device Tree configuration

To enable driver probing, add the lsm6dsm node to the platform device tree as described below.

Required properties:

- compatible: "st,lsm6dsm"

- reg: the I2C address or SPI chip select the device will respond to

- interrupt-parent: phandle to the parent interrupt controller as documented in interrupts

- interrupts: interrupt mapping for IRQ as documented in interrupts

Recommended properties for SPI bus usage:

- spi-max-frequency: maximum SPI bus frequency as documented in SPI

Optional properties:

- st,drdy-int-pin: MEMS sensor interrupt line to use (default 1)

Device Tree Integration Examples

I2C example (based on Raspberry PI 3):

  &i2c0 {
  	status = "ok";
  	#address-cells = <0x1>;
  	#size-cells = <0x0>;
  	lsm6dsm@6b {
  		compatible = "st,lsm6dsm";
  		reg = <0x6b>;
  		interrupt-parent = <&gpio>;
  		interrupts = <26 IRQ_TYPE_LEVEL_HIGH>;
  };

SPI example (based on Raspberry PI 3):

  &spi0 {
  	status = "ok";
  	#address-cells = <0x1>;
  	#size-cells = <0x0>;
  	lsm6dsm@0 {
  		spi-max-frequency = <500000>;
  		compatible = "st,lsm6dsm";
  		reg = <0>;
  		interrupt-parent = <&gpio>;
  		interrupts = <26 IRQ_TYPE_LEVEL_HIGH>;
  	};

Kernel configuration

Configure kernel with make menuconfig (alternatively use make xconfig or make qconfig)

  Device Drivers  --->
  	<M> Industrial I/O support  --->
  		Inertial measurement units  --->
  		<M>   STMicroelectronics LSM6DSM/LSM6DSL sensor  --->

More Information

http://st.com

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/iio

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/i2c

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/spi

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bings/interrupt-controller/interrupts.txt

Copyright

Copyright (C) 2019 STMicroelectronics

This software is distributed under the GNU General Public License - see the accompanying COPYING file for more details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].