Skip to contentSkip to conversation

iio: what does in_accel_x_thresh_rising_en ?

DISCUSSION Martin Kepplinger 3 participants 4 messages Jun 9, 2015 – Jun 12, 2015 IIO

lore
Share & tools
lore
#0 lore raw

hi

Is the in_accel_thresh_rising_value (or falling) threshold value signed or unsigned?

In other words: Is a RISING event fired on an absolute growing value in the positive range, and a FALLING event on an absolute growing value in the negative acceleration range (< 0g)?

Or is a RISING event fired on a signed rising value, no matter if the threshold is positive or negative, and a FALLING event on a decreasing signed value, also when the threshold is positive?

thanks

martin

maintainer
#1 lore raw
Quoted 9 lines · Martin Kepplinger

hi

Is the in_accel_thresh_rising_value (or falling) threshold value signed or unsigned?

In other words: Is a RISING event fired on an absolute growing value in the positive range, and a FALLING event on an absolute growing value in the negative acceleration range (< 0g)?

Quoted 8 lines

Or is a RISING event fired on a signed rising value, no matter if the threshold is positive or negative, and a FALLING event on a decreasing signed value, also when the threshold is positive?

thanks

martin

Hi Martin,

The two relevant abi elements are:
in_accel_thresh_rising_value and
in_accel_mag_rising_value
Once you know the second one exists then you can probably work out the meaning of thresh ;)

Thresh is the value, mag(nitude) is the absolute value, so if you get one that is thresh, then if the channel can go negative, negative values are definitely possible. On an accelerometer, you can get either implemented. mag_rising is typically to allow motion detection, thresh_rising might be used to detect a change of orientation (put bounds around each axis at a particular point in time.

There are also roc (rate of change) type event detectors on some accelerometers.

Hope that clear the mud up ;)

Jonathan

#2 lore raw

Am 2015-06-10 um 22:49 schrieb Jonathan Cameron:

Quoted 33 lines · Martin Kepplinger
Quoted 9 lines

hi

Is the in_accel_thresh_rising_value (or falling) threshold value signed or unsigned?

In other words: Is a RISING event fired on an absolute growing value in the positive range, and a FALLING event on an absolute growing value in the negative acceleration range (< 0g)?

Quoted 8 lines

Or is a RISING event fired on a signed rising value, no matter if the threshold is positive or negative, and a FALLING event on a decreasing signed value, also when the threshold is positive?

thanks

martin

Hi Martin,

The two relevant abi elements are:
in_accel_thresh_rising_value and
in_accel_mag_rising_value
Once you know the second one exists then you can probably work out the meaning of thresh ;)

Thresh is the value, mag(nitude) is the absolute value, so if you get one that is thresh, then if the channel can go negative, negative values are definitely possible. On an accelerometer, you can get either implemented. mag_rising is typically to allow motion detection, thresh_rising might be used to detect a change of orientation (put bounds around each axis at a particular point in time.

Quoted 6 lines

There are also roc (rate of change) type event detectors on some accelerometers.

Hope that clear the mud up ;)

Jonathan

Hi Jonathan,

Oh I overlooked, this is clear now. So events/in_accel_x&y&z_mag_falling_en for example is
a classic freefall detection. Would an implementation here just use in_accel_mag_falling_value ? I'm not yet sure how an iio_event_spec would look like in that case. Freefall is what I could do in my driver.

But this was very helpful, thanks for your time!

martin

#3 lore raw
Quoted 53 lines · Martin Kepplinger

Am 2015-06-10 um 22:49 schrieb Jonathan Cameron:

Quoted 4 lines · Martin Kepplinger
Quoted 3 lines

hi

Is the in_accel_thresh_rising_value (or falling) threshold value

signed

Quoted 3 lines
Quoted 3 lines

or unsigned?

In other words: Is a RISING event fired on an absolute growing value

in

Quoted 1 line
Quoted 1 line

the positive range, and a FALLING event on an absolute growing value

in

Quoted 3 lines
Quoted 3 lines

the negative acceleration range (< 0g)?

Or is a RISING event fired on a signed rising value, no matter if

the

Quoted 1 line
Quoted 1 line

threshold is positive or negative, and a FALLING event on a

decreasing

Quoted 4 lines
Quoted 4 lines

signed value, also when the threshold is positive?

thanks

Quoted 8 lines
Quoted 2 lines

martin

Hi Martin,

The two relevant abi elements are:
in_accel_thresh_rising_value and in_accel_mag_rising_value
Once you know the second one exists then you can probably work out

the

Quoted 3 lines

meaning of thresh ;)

Thresh is the value, mag(nitude) is the absolute value, so if you get

one

Quoted 1 line

that is thresh, then if the channel can go negative, negative values

are

Quoted 1 line

definitely possible. On an accelerometer, you can get either

implemented.

Quoted 1 line

mag_rising is typically to allow motion detection, thresh_rising

might

Quoted 1 line

be used to detect a change of orientation (put bounds around each

axis

Quoted 3 lines

at a particular point in time.

There are also roc (rate of change) type event detectors on some

accelerometers.

Quoted 5 lines

Hope that clear the mud up ;)

Jonathan

Quoted 6 lines

Hi Jonathan,

Oh I overlooked, this is clear now. So events/in_accel_x&y&z_mag_falling_en for example is
a classic freefall detection. Would an implementation here just use in_accel_mag_falling_value ?

Either that or the one for the particular event (with the x&y&z )both are valid and
user space should check for them.
Note some accelerometers use the sum of squares for free fall detection though I
guess your one doesn't!

I'm not yet sure how an iio_event_specbit)ould look like in that case. Freefall is what I could do in my driver.
Err can't remember exact syntax but you have two entries. One with
the enable and one with the value part.
Should be other drivers doing this though normally because a single value is used
for multiple separate threshold detectors.

Quoted 4 lines

But this was very helpful, thanks for your time!

martin

Signature · 1 line
Sent from my Android device with K-9 Mail. Please excuse my brevity.