Re: [PATCH 4/4] iio: pressure: Add triggered buffer support for BMP280 driver

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

 



On Sun, Mar 03, 2024 at 05:53:00PM +0100, Vasileios Amoiridis wrote:
> Add a buffer struct that will hold the values of the measurements
> and will be pushed to userspace. Modify all read_* functions in order
> to just read and compensate the data without though converting to the
> required IIO measurement units which are used for the oneshot captures.

> +#include <linux/iio/buffer.h>
>  #include <linux/iio/iio.h>
>  #include <linux/iio/sysfs.h>
> +#include <linux/iio/trigger.h>
> +#include <linux/iio/trigger_consumer.h>
> +#include <linux/iio/triggered_buffer.h>

Yes, taking into account the comment against patch 1, this will become the part
of iio/* group.

...

> +	/* val might be NULL if we're called by the buffer handler */
> +	if (val) {
> +		*val = comp_press;
> +		/* Compensated pressure is in cPa (centipascals) */
> +		*val2 = 100000;

Here and everywhere else where it makes sense

		*val2 = CENTI * 1000; // (What is 1000 here?)

from units.h?

> +		return IIO_VAL_FRACTIONAL;
> +	}

...

> +	struct {
> +		s32 temperature;
> +		u32 pressure;
> +		u32 humidity;

> +		s64 timestamp;

Shouldn't this be aligned properly?

> +	} iio_buffer;

-- 
With Best Regards,
Andy Shevchenko






[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