On Sat, 13 Aug 2022 01:34:40 +0300
Andy Shevchenko [off-list ref] wrote:
On Fri, Aug 12, 2022 at 7:52 PM Dmitry Rokosov [off-list ref] wrote:
quoted
MSA311 is a tri-axial, low-g accelerometer with I2C digital output for
sensitivity consumer applications. It has dynamic user-selectable full
scales range of +-2g/+-4g/+-8g/+-16g and allows acceleration measurements
with output data rates from 1Hz to 1000Hz.
quoted
Spec: https://cdn-shop.adafruit.com/product-files/5309/MSA311-V1.1-ENG.pdf
Can you use Datasheet: tag below (just before your SoB tag)?
quoted
This driver supports following MSA311 features:
- IIO interface
- Different power modes: NORMAL and SUSPEND (using pm_runtime)
- ODR (Output Data Rate) selection
- Scale and samp_freq selection
- IIO triggered buffer, IIO reg access
- NEW_DATA interrupt + trigger
Below features to be done:
- Motion Events: ACTIVE, TAP, ORIENT, FREEFALL
- Low Power mode
...
quoted
+static const struct {
+ int val;
+ int val2;
+} msa311_fs_table[] = {
+ {0, 9580}, {0, 19160}, {0, 38320}, {0, 76641}
+};
At least you may deduplicate the type definition for these data structures, like
struct iio_float {
iio_int_plus_micro maybe...
we have lots of fixed point types and they definitely are floats
then integer, micro
int integer;
int fract;
};