Arduino_APDS9960 icon indicating copy to clipboard operation
Arduino_APDS9960 copied to clipboard

Add support for APDS-9960 with ID 0xA8

Open DMohammed opened this issue 1 year ago • 0 comments

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);
}

DMohammed avatar Feb 06 '24 08:02 DMohammed