Re: [PATCH v8 2/3] iio: accel: Add driver support for ADXL355

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed,  4 Aug 2021 19:33:08 +0530
Puranjay Mohan <puranjay12@xxxxxxxxx> wrote:

> ADXL355 is 3-axis MEMS Accelerometer. It offers low noise density,
> low 0g offset drift, low power with selectable measurement ranges.
> It also features programmable high-pass and low-pass filters.
> 
> Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/adxl354_adxl355.pdf
> Signed-off-by: Puranjay Mohan <puranjay12@xxxxxxxxx>
Hi Puranjay,

One comment below, but it's a follow up on a discussion going on in the ADXL313 driver
review. I might just make that change whilst applying this, or leave it for
another day. Either way, no need for you to change anything unless you are
doing a v9 for another reason.

...

> +
> +/*
> + * The datasheet defines an intercept of 1885 LSB at 25 degC
> + * and a slope of -9.05 LSB/C. The following formula can be used to find the
> + * temperature:
> + * Temp = ((RAW - 1885)/(-9.05)) + 25 but this doesn't follow the format of
> + * the IIO which is Temp = (RAW + OFFSET) * SCALE. Hence using some rearranging
> + * we get the scale as -110.49723 and offset as -2111.25
> + */
> +#define TEMP_SCALE_VAL -110
> +#define TEMP_SCALE_VAL2 497238
> +#define TEMP_OFFSET_VAL -2111
> +#define TEMP_OFFSET_VAL2 250000
> +
> +/*
> + * At +/- 2g with 20-bit resolution, scale is given in datasheet as
> + * 3.9ug/LSB = 0.0000039 * 9.80665 = 0.00003824593 m/s^2
> + */
> +#define ADXL355_NSCALE	38245

This just came up in another review and wasn't something I've been picking
up on in reviews before now.

These scale defines would be better dropped and the values moved inline
(along with the comments).  It avoids possible unit misunderstandings etc
In short the key thing is, sometimes a number is just a number and
using a define to give it a name is not always helpful, particularly if
it's only used in one place in the code.




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux