diff mbox series

[v2,05/10] iio: add modifers for pitch, yaw, roll

Message ID 20211028101840.24632-6-andrea.merello@gmail.com (mailing list archive)
State Changes Requested
Headers show
Series Add support for Bosch BNO055 IMU | expand

Commit Message

Andrea Merello Oct. 28, 2021, 10:18 a.m. UTC
This patch adds modifiers for reporting rotations as euler angles (i.e.
yaw, pitch and roll).

Signed-off-by: Andrea Merello <andrea.merello@iit.it>
---
 drivers/iio/industrialio-core.c | 5 ++++-
 include/uapi/linux/iio/types.h  | 3 +++
 2 files changed, 7 insertions(+), 1 deletion(-)

Comments

Jonathan Cameron Oct. 28, 2021, 10:47 a.m. UTC | #1
On Thu, 28 Oct 2021 12:18:35 +0200
Andrea Merello <andrea.merello@gmail.com> wrote:

> This patch adds modifiers for reporting rotations as euler angles (i.e.
> yaw, pitch and roll).
> 
> Signed-off-by: Andrea Merello <andrea.merello@iit.it>
Same comment on tools update, and a few editorial things inline.

Jonathan

> ---
>  drivers/iio/industrialio-core.c | 5 ++++-
>  include/uapi/linux/iio/types.h  | 3 +++
>  2 files changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
> index a79cb32207e4..d2ebbfa8b9fc 100644
> --- a/drivers/iio/industrialio-core.c
> +++ b/drivers/iio/industrialio-core.c
> @@ -136,7 +136,10 @@ static const char * const iio_modifier_names[] = {
>  	[IIO_MOD_O2] = "o2",
>  	[IIO_MOD_ACCEL_LINEAR_X] = "linear_x",
>  	[IIO_MOD_ACCEL_LINEAR_Y] = "linear_y",
> -	[IIO_MOD_ACCEL_LINEAR_Z] = "linear_z"
> +	[IIO_MOD_ACCEL_LINEAR_Z] = "linear_z",

Move the comman to the previous patch.

> +	[IIO_MOD_PITCH] = "pitch",
> +	[IIO_MOD_YAW] = "yaw",
> +	[IIO_MOD_ROLL] = "roll"
>  };
>  
>  /* relies on pairs of these shared then separate */
> diff --git a/include/uapi/linux/iio/types.h b/include/uapi/linux/iio/types.h
> index db00f7c45f48..fc9909ca4f95 100644
> --- a/include/uapi/linux/iio/types.h
> +++ b/include/uapi/linux/iio/types.h
> @@ -98,6 +98,9 @@ enum iio_modifier {
>  	IIO_MOD_ACCEL_LINEAR_X,
>  	IIO_MOD_ACCEL_LINEAR_Y,
>  	IIO_MOD_ACCEL_LINEAR_Z,
> +	IIO_MOD_PITCH,
> +	IIO_MOD_YAW,
> +	IIO_MOD_ROLL

And add a comma here to make extending this in future easy.

>  };
>  
>  enum iio_event_type {
diff mbox series

Patch

diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
index a79cb32207e4..d2ebbfa8b9fc 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -136,7 +136,10 @@  static const char * const iio_modifier_names[] = {
 	[IIO_MOD_O2] = "o2",
 	[IIO_MOD_ACCEL_LINEAR_X] = "linear_x",
 	[IIO_MOD_ACCEL_LINEAR_Y] = "linear_y",
-	[IIO_MOD_ACCEL_LINEAR_Z] = "linear_z"
+	[IIO_MOD_ACCEL_LINEAR_Z] = "linear_z",
+	[IIO_MOD_PITCH] = "pitch",
+	[IIO_MOD_YAW] = "yaw",
+	[IIO_MOD_ROLL] = "roll"
 };
 
 /* relies on pairs of these shared then separate */
diff --git a/include/uapi/linux/iio/types.h b/include/uapi/linux/iio/types.h
index db00f7c45f48..fc9909ca4f95 100644
--- a/include/uapi/linux/iio/types.h
+++ b/include/uapi/linux/iio/types.h
@@ -98,6 +98,9 @@  enum iio_modifier {
 	IIO_MOD_ACCEL_LINEAR_X,
 	IIO_MOD_ACCEL_LINEAR_Y,
 	IIO_MOD_ACCEL_LINEAR_Z,
+	IIO_MOD_PITCH,
+	IIO_MOD_YAW,
+	IIO_MOD_ROLL
 };
 
 enum iio_event_type {