Skip to content

Commit

Permalink
iio: introduce mag_referenced
Browse files Browse the repository at this point in the history
Some accelerometers that support activity and inactivity
events also support a referenced mode, in which the
gravitational acceleration is taken as a point of
reference before comparing the acceleration to the
specified activity and inactivity magnitude.

For example, in the case of the ADXL367, for activity
detection, the formula is:

abs(acceleration - reference) > magnitude

Add a new event type that makes this behavior clear.

Signed-off-by: Cosmin Tanislav <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jonathan Cameron <[email protected]>
  • Loading branch information
Demon000 authored and jic23 committed Feb 21, 2022
1 parent b38da7f commit a1a5cfe
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions drivers/iio/industrialio-event.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ static const char * const iio_ev_type_text[] = {
[IIO_EV_TYPE_THRESH_ADAPTIVE] = "thresh_adaptive",
[IIO_EV_TYPE_MAG_ADAPTIVE] = "mag_adaptive",
[IIO_EV_TYPE_CHANGE] = "change",
[IIO_EV_TYPE_MAG_REFERENCED] = "mag_referenced",
};

static const char * const iio_ev_dir_text[] = {
Expand Down
1 change: 1 addition & 0 deletions include/uapi/linux/iio/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ enum iio_event_type {
IIO_EV_TYPE_THRESH_ADAPTIVE,
IIO_EV_TYPE_MAG_ADAPTIVE,
IIO_EV_TYPE_CHANGE,
IIO_EV_TYPE_MAG_REFERENCED,
};

enum iio_event_direction {
Expand Down
1 change: 1 addition & 0 deletions tools/iio/iio_event_monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ static const char * const iio_ev_type_text[] = {
[IIO_EV_TYPE_THRESH_ADAPTIVE] = "thresh_adaptive",
[IIO_EV_TYPE_MAG_ADAPTIVE] = "mag_adaptive",
[IIO_EV_TYPE_CHANGE] = "change",
[IIO_EV_TYPE_MAG_REFERENCED] = "mag_referenced",
};

static const char * const iio_ev_dir_text[] = {
Expand Down

0 comments on commit a1a5cfe

Please sign in to comment.