Closed mark255bits closed 3 years ago
yah i see what happened - we dont actually use this style of register manipulation anymore. did you test the example code to verify everything still works? we usually test on an UNO compatible!
The changes are working on another device(STM32), with another example code. But I did not test the example code on an UNO compatible device. I can do it at some point during this week
if ya could it would be greatly appreciated (and let us merge it sooner!)
Hi, Example is still working on Arduino Uno. But i have just noticed that further change may be needed to keep consistency, the getproxgain may have to be change: A bit shifted may be needed so the method getProxGain return the value of the bit field:
apds9960PGain_t Adafruit_APDS9960::getProxGain() { return (apds9960PGain_t)((read8(APDS9960_CONTROL) & 0x0C)>>2); }
ok thank you! wanna submit another PR for that change?
This pull request is in relation with the issue I opened recently, Link. Some registers has some bitfield definitions bit shifted, but the get method bit shifts them again. This results on overwriting other bit fields or writing incorrect values on such bit fields. The bug is easy to reproduce, just try to read, write, read any of the involved registers, for example getProxGain() setProxGain(0x01) getProxGain()
With these changes the bug is fixed, and the bit field definitions are alligned to the APDS9960 datasheet.