Skip to content

drivers: sensor: lsm6dso: add support for tilt and tap triggers #89205

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

ivanwagner
Copy link
Contributor

This patch adds support for tilt, tap and double tap triggers. As an example ST IIS2DLPC sensor was taken as an example. In fact DT new properties are taken from there with the same philosophy.

A new sensor trigger value has been added: SENSOR_TRIG_TILT

When the interrupt handler is called, access to 5 registers will determine information regarding any interrupt flag available on this devices. This adds extensibility for future features at a cost of accessing 5 registers.

Tilt or Tap can be selected via config and further tap parameters can be
configured via DT.

Signed-off-by: Ivan Wagner <[email protected]>
@ivanwagner ivanwagner force-pushed the lsm6dso-add-tilt-and-tap branch from 0c23de8 to c0a6b5a Compare April 28, 2025 15:21
@ivanwagner
Copy link
Contributor Author

Anyone willing to take a look a this?

MaureenHelm
MaureenHelm previously approved these changes May 21, 2025
Copy link
Member

@MaureenHelm MaureenHelm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@avisconti can you take a look?

@kartben
Copy link
Collaborator

kartben commented May 30, 2025

@ivanwagner can you take a look at the recent comments? Thanks!

@ivanwagner
Copy link
Contributor Author

ivanwagner commented May 30, 2025

@ivanwagner can you take a look at the recent comments? Thanks!

I will make changes and test it next week and push everything so you can have a look. Thank you

Improvements include: check error codes, log level adjustments,
removed unreachable code, disable tilt when not used, call optimized
interrupt handler when tilt and tap are not used.

Signed-off-by: Ivan Wagner <[email protected]>
yperess
yperess previously approved these changes Jun 3, 2025
@@ -206,10 +516,11 @@ static void lsm6dso_handle_interrupt(const struct device *dev)
#endif
}

gpio_pin_interrupt_configure_dt(&cfg->gpio_drdy,
GPIO_INT_EDGE_TO_ACTIVE);
gpio_pin_interrupt_configure_dt(&cfg->gpio_drdy, GPIO_INT_EDGE_TO_ACTIVE);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally you don't want to turn on/off the edge triggers. This is outside of the scope of this PR, but I recommend revisiting this for this driver. On level interrupts you want to turn it off because it'll keep firing until you read the status register. With edge interrupts it's safe to leave it on this way you're not missing events.

@ivanwagner ivanwagner requested a review from yperess June 4, 2025 05:32
Copy link
Collaborator

@avisconti avisconti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look almost good. Just small nits

Added comments ad the end of preprocessor if else endif blocks

Signed-off-by: Ivan Wagner <[email protected]>
@ivanwagner ivanwagner force-pushed the lsm6dso-add-tilt-and-tap branch from 3c24ae5 to 4770837 Compare June 4, 2025 15:11
Copy link

sonarqubecloud bot commented Jun 4, 2025

Please retry analysis of this Pull-Request directly on SonarQube Cloud

@kartben kartben dismissed their stale review June 5, 2025 21:34

Addressed

@dleach02 dleach02 merged commit e571f8b into zephyrproject-rtos:main Jun 6, 2025
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants