Messages in this thread | | | Subject | Re: [PATCH v3 06/13] iio: imu: inv_icm42600: add temperature sensor support | From | Lars-Peter Clausen <> | Date | Sun, 14 Jun 2020 17:10:51 +0200 |
| |
On 6/8/20 10:42 PM, Jean-Baptiste Maneyrol wrote: > + case IIO_CHAN_INFO_PROCESSED: > + ret = iio_device_claim_direct_mode(indio_dev); > + if (ret) > + return ret; > + ret = inv_icm42600_temp_read(st, &temp); > + iio_device_release_direct_mode(indio_dev); > + if (ret) > + return ret; > + *val = temp; > + return IIO_VAL_INT; > + case IIO_CHAN_INFO_SCALE: > + *val = 483; > + *val2 = 91787; > + return IIO_VAL_INT_PLUS_MICRO; > + case IIO_CHAN_INFO_OFFSET: > + *val = 25000; > + return IIO_VAL_INT;
If the data is returned processed there is no need to specify scale and offset.
But since the transformation to turn the data into standard units is a simple linear transform the preferred way to handle this is to return RAW data and specify scale and offset.
| |