Skip to content

Conversation

@batkay
Copy link
Contributor

@batkay batkay commented Oct 13, 2025

Description

This PR updates the APDS9960 gesture sensor with the ability to process gestures from it's gesture engine.

Specific Changes

  • Added KConfig option to enable gestures and set a detection threshold.
  • Added private enum for gesture channel and its results.
  • Added logic to read the gesture diode FIFO, and interpret results into UP, DOWN, LEFT, and RIGHT gestures.
  • Updated sample program to display gestures (starts disabled to not disrupt previous behavior).

Testing

Testing was done with a nRF52840dk, with the following device overlay:

&i2c0 {

	apds9960: avago_apds9960@39 {
		compatible = "avago,apds9960";
		// int-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>;
		reg = <0x39>;
	};
};

In addition, in the prj.conf file, the following line was modified:
'CONFIG_APDS9960_ENABLE_GESTURE=y'

The new sample program output shows the following output with gestures:
unknown

@batkay batkay force-pushed the apds9960_gesture branch 4 times, most recently from 526e4b1 to 708436b Compare October 13, 2025 10:04
@sonarqubecloud
Copy link

Comment on lines 144 to 152
config APDS9960_GESTURE_PROXIMITY
int "Gesture Proximity Enter Threshold"
range 0 255
default 40

config APDS9960_GESTURE_DIFFERENCE
int "Minimum IR diode difference for gesture"
range 0 255
default 5
Copy link
Member

Choose a reason for hiding this comment

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

Let's put this on dts-bindings, as it may vary for different instances of the same sensor type.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think with the way the sensor is setup currently, there can only be one sensor on the i2c bus. For example, gain is also defined in the Kconfig. I can try to move these to the dts, would you like all the other parameters such as gain, pulse length, and led boost also be moved to the dts?

Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't gesture detection be a trigger as well?

Allow for multiple apds9960s to be present

Signed-off-by: Thomas Lang <[email protected]>
Created sensor specific channels and Kconfig for gesture sensing.

Signed-off-by: Thomas Lang <[email protected]>
Created logic to calculate gestures from the APDS9960 sensor

Signed-off-by: Thomas Lang <[email protected]>
Added a new channel fetch to demonstrate reading gestures

Signed-off-by: Thomas Lang <[email protected]>
@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 7, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants