This is a Linux industrial I/O (IIO) subsystem driver, targeting serial interface accelerometers. The industrial I/O subsystem provides a unified framework for drivers for many different types of converters and sensors using a number of different physical interfaces (i2c, spi, etc). See IIO for more information.
Function | File |
---|---|
core driver | drivers/iio/accel/adxl355_core.c |
spi driver | drivers/iio/accel/adxl355_spi.c |
i2c driver | drivers/iio/accel/adxl355_i2c.c |
header | drivers/iio/accel/adxl355.h |
Documentation | adi,adxl355.yaml |
Required devicetree properties:
Required properties for SPI bus usage:
Optional properties:
Example for a SPI device node:
#include <dt-bindings/gpio/gpio.h> #include <dt-bindings/interrupt-controller/irq.h> spi { #address-cells = <1>; #size-cells = <0>; accelerometer@0 { compatible = "adi,adxl355"; reg = <0>; spi-max-frequency = <1000000>; interrupt-parent = <&gpio>; interrupts = <25 IRQ_TYPE_EDGE_RISING>; interrupt-names = "DRDY"; }; };
Example for a I2C device node:
i2c { #address-cells = <1>; #size-cells = <0>; /* Example for a I2C device node */ accelerometer@1d { compatible = "adi,adxl355"; reg = <0x1d>; interrupt-parent = <&gpio>; interrupts = <25 IRQ_TYPE_EDGE_RISING>; interrupt-names = "DRDY"; }; };
This specifies any shell prompt running on the target
root:/> cd /sys/bus/iio/devices/ root:/sys/bus/iio/devices> ls iio:device0 root:/sys/bus/iio/devices> cd iio\:device0 root:/sys/bus/iio/devices/iio:device0> ls -l drwxr-xr-x 2 root root 0 Nov 11 15:44 buffer -rw-r--r-- 1 root root 4096 Nov 11 15:44 current_timestamp_clock -r--r--r-- 1 root root 4096 Nov 11 15:44 dev -rw-r--r-- 1 root root 4096 Nov 11 15:44 in_accel_filter_high_pass_3db_frequency -r--r--r-- 1 root root 4096 Nov 11 15:44 in_accel_filter_high_pass_3db_frequency_available -rw-r--r-- 1 root root 4096 Nov 11 15:44 in_accel_sampling_frequency -r--r--r-- 1 root root 4096 Nov 11 15:44 in_accel_sampling_frequency_available -rw-r--r-- 1 root root 4096 Nov 11 15:44 in_accel_scale -rw-r--r-- 1 root root 4096 Nov 11 15:44 in_accel_x_calibbias -rw-r--r-- 1 root root 4096 Nov 11 15:44 in_accel_x_raw -rw-r--r-- 1 root root 4096 Nov 11 15:44 in_accel_y_calibbias -rw-r--r-- 1 root root 4096 Nov 11 15:44 in_accel_y_raw -rw-r--r-- 1 root root 4096 Nov 11 15:44 in_accel_z_calibbias -rw-r--r-- 1 root root 4096 Nov 11 15:44 in_accel_z_raw -rw-r--r-- 1 root root 4096 Nov 11 15:44 in_temp_offset -rw-r--r-- 1 root root 4096 Nov 11 15:44 in_temp_raw -rw-r--r-- 1 root root 4096 Nov 11 15:44 in_temp_scale -r--r--r-- 1 root root 4096 Nov 11 15:44 name drwxr-xr-x 2 root root 0 Nov 11 15:44 power drwxr-xr-x 2 root root 0 Nov 11 15:44 scan_elements lrwxrwxrwx 1 root root 0 Nov 11 15:44 subsystem -> ../../bus/iio drwxr-xr-x 2 root root 0 Nov 11 15:44 trigger -rw-r--r-- 1 root root 4096 Nov 11 15:44 uevent
This specifies any shell prompt running on the target
root:/sys/bus/iio/devices/iio:device0> cat name adxl355
Description:
scale to be applied to in_accel_*_raw in order to obtain the acceleration.
This specifies any shell prompt running on the target
root:/sys/bus/iio/devices/iio:device0> cat in_accel_scale 0.000038245
Description:
Raw unscaled acceleration measurement on x axis
This specifies any shell prompt running on the target
root:/sys/bus/iio/devices/iio:device0> cat in_accel_x_raw -33631
This specifies any shell prompt running on the target
root:/sys/bus/iio/devices/iio:device0> cat in_accel_sampling_frequency_available 4000.000000 2000.000000 1000.000000 500.000000 250.000000 125.000000 62.500000 31.250000 15.625000 7.813000 3.906000 root:/sys/bus/iio/devices/iio:device0> cat in_accel_sampling_frequency 6400 root:/sys/bus/iio/devices/iio:device0> echo 4000 > in_accel_sampling_frequency root:/sys/bus/iio/devices/iio:device0> cat in_accel_sampling_frequency 4000.000000
This specifies any shell prompt running on the target
root:/sys/bus/iio/devices/iio:device0> cat in_accel_filter_low_pass_3db_frequency_available 0.000000 9.880000 2.483360 0.621800 0.154480 0.038160 0.009520 root:/sys/bus/iio/devices/iio:device0>
This specifies any shell prompt running on the target
root:/sys/bus/iio/devices/iio:device0> cat in_accel_filter_low_pass_3db_frequency_available 0.000000 9.880000 2.483360 0.621800 0.154480 0.038160 0.009520 root:/sys/bus/iio/devices/iio:device0> cat in_accel_filter_low_pass_3db_frequency 0 root:/sys/bus/iio/devices/iio:device0> echo 0.621800 > in_accel_filter_low_pass_3db_frequency root:/sys/bus/iio/devices/iio:device0> cat in_accel_filter_low_pass_3db_frequency 0.621800
This specifies any shell prompt running on the target
root:/sys/bus/iio/devices/iio:device0> cat trigger/current_trigger adxl355-dev-*
Description:
The scan_elements directory contains interfaces for elements that will be captured for a single triggered sample set in the buffer
This specifies any shell prompt running on the target
root:/sys/bus/iio/devices/iio:device0/scan_elements> ls -l -rw-r--r-- 1 root root 4096 Nov 11 15:44 in_accel_x_en -r--r--r-- 1 root root 4096 Nov 11 15:44 in_accel_x_index -r--r--r-- 1 root root 4096 Nov 11 15:44 in_accel_x_type -rw-r--r-- 1 root root 4096 Nov 11 15:44 in_accel_y_en -r--r--r-- 1 root root 4096 Nov 11 15:44 in_accel_y_index -r--r--r-- 1 root root 4096 Nov 11 15:44 in_accel_y_type -rw-r--r-- 1 root root 4096 Nov 11 15:44 in_accel_z_en -r--r--r-- 1 root root 4096 Nov 11 15:44 in_accel_z_index -r--r--r-- 1 root root 4096 Nov 11 15:44 in_accel_z_type -rw-r--r-- 1 root root 4096 Nov 11 15:44 in_temp_en -r--r--r-- 1 root root 4096 Nov 11 15:44 in_temp_index -r--r--r-- 1 root root 4096 Nov 11 15:44 in_temp_type -rw-r--r-- 1 root root 4096 Nov 11 15:44 in_timestamp_en -r--r--r-- 1 root root 4096 Nov 11 15:44 in_timestamp_index -r--r--r-- 1 root root 4096 Nov 11 15:44 in_timestamp_type root:/sys/bus/iio/devices/iio:device0/scan_elements>
This specifies any shell prompt running on the target
root:/sys/bus/iio/devices/iio:device0/buffer> ls data_available enable length watermark root:/sys/bus/iio/devices/iio:device0/buffer>
This specifies any shell prompt running on the target
root:/sys/bus/iio/devices/iio:device0/buffer> echo 1024 > length
This specifies any shell prompt running on the target
root:/sys/bus/iio/devices/iio:device0/buffer> echo 1 > enable
To read samples:
This specifies any shell prompt running on the target
root:/sys/bus/iio/devices/iio:device0/buffer> cat /dev/iio:device0