Skip to content
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

Add support for APDS-9960 with ID 0xA8 #35

Open
DMohammed opened this issue Feb 6, 2024 · 0 comments
Open

Add support for APDS-9960 with ID 0xA8 #35

DMohammed opened this issue Feb 6, 2024 · 0 comments
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement

Comments

@DMohammed
Copy link

DMohammed commented Feb 6, 2024

Hi,
In some models of the APDS9960, the ID might show up as '0xA8' instead of '0xAB'. When encountering this ID, the existing library won't function properly. To address this, you can modify the begin function as shown below:

  if (!((id == 0xA8) || (id == 0xAB)))
    return false;

Upon investigation, it was discovered that the register '0x80' is set to '9', which doesn't support gestures. Changing it to '7F' activates all modes.
Additionally, it was observed that the '0xA8' model doesn't work with the interrupt pin. Hence, the gestureAvailable function needed an adjustment:

int APDS9960::gestureAvailable()
{
  if (gestureFIFOAvailable() <= 0)
  {
    return 0;
  }

  handleGesture();
  if (_proximityEnabled)
  {
    setGestureMode(false);
  }
  return (_detectedGesture == GESTURE_NONE) ? 0 : 1;
}

After these modifications, the model works flawlessly.
It's important to note that when setting the '0x80' register to '0x7F', the RGB detector gets disabled.
To address this, a new function activeAll is added to enable all functionalities from the code:

void APDS9960::activeAll()
{
  setENABLE(0x7F);
}
@per1234 per1234 added type: enhancement Proposed improvement topic: code Related to content of the project itself labels Feb 6, 2024
@per1234 per1234 changed the title Problem gestures APDS9960 Add support for APDS-9960 with ID 0xA8 Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

No branches or pull requests

2 participants