adafruit / Adafruit_VEML6070

Arduino Library for VEML6070 Digital UV sensors
14 stars 19 forks source link

Implement ACK feature and follow best practice to avoid device non-responsiveness #4

Closed eecharlie closed 6 years ago

eecharlie commented 6 years ago

I've added library functions for using the interrupt feature of the device, and in turn used those functions to follow best practice of clearing a possible interrupt condition before every update to the device configuration. As noted in comments, the datasheet (rev. 1.7) p. 7 mentions this.

This change is meant to address the issue I raised in your project, although it does not include a unit test that actually reproduces the infrequently-occurring problem caused by the device initializing to a command register state with the interrupt enabled and then triggering.

The reason for this is that I've found the device to cause I2C bus lockups after a power cycle, and a cold boot is needed to cause possibly problematic initialization of the configuration register. I have yet to resolve the power cycling lockup issue.

Summary of impact:

ladyada commented 6 years ago

looks good, what hardware did you try this with?

eecharlie commented 6 years ago

A RedBoard (sorry had it laying around!) / Uno compatible

eecharlie commented 6 years ago

Looks like I made Travis happy. Anything else?

Side note, UV measurement accuracy depends on integration time which depends on Rset, so hopefully you're using 1% tolerance 270k resistors in your BOM :)

ladyada commented 6 years ago

yep we use 1%

ladyada commented 6 years ago

ill merge, lets see how it goes :)

eecharlie commented 6 years ago

Awesome. If it's Limor at the keyboard over there, it's an honor.

ladyada commented 6 years ago

huzzah!