-
Notifications
You must be signed in to change notification settings - Fork 48
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
Interrupt not working #12
Comments
@microbuilder for this one maybe dont auto-sleep at all but put in the example how to sleep between reads (e.g. expose to user) |
I'm hoping to resurrect this issue. I tried implementing the changes haku15 suggested. I commented all calls to enable() and disable() from .cpp. I didn't make the changes to the AIEN in .h, since I don't mind having two interrupts. When I run the sketch it doesn't generate a signal from the interrupt pin. I have confirmed that my code will work with a button. I'm not really sure what else I'm missing. |
Maybe I've miss something ... but I'm testing the TSL2591 righ now and I'm not able to get a interrupt signal from INT pin ... |
@AnotherWayToDo have you read the description of this issue? PS: by the way why did you unassigne microbuilder? |
@AnotherWayToDo (did not remember that i have done even more in this...) |
Sorry I'vent seen it was unassigned ! I'vent specify it. I'll take a look to your proposed solution. |
Work great !!! |
With the current library and "tsl2591_interrupt.ino" example, the interrupt feature does not work.
This is because in the library the device gets powered on and powered off in every function by the enable() and disable().
To generate interrupts the tsl2591 cannot be in powered off state.
I resolved this by commenting all the enable() and disable() in the library and managing the power states in the Arduino sketch. If the Arduino goes to sleep and I want him to be woken up the the TSL, I call the enable() before the Arduino sleep call. Of course also before initializing the TSL or doing measurement I enable it.
This info should be at least be documented, if the library does not get changed. Also the Adafruit tutorial could be updated that now there is Interrupt function as well.
I used in the enable() function the following settings for the "Enable Register", so that I get only 1 interrupt (not two) from the No Persist Interrupt (and not also from the ALS Interrupt) for when the light level goes as soon as after 1 measurement below the lower threshold or higher than then upper threshold:
write8(TSL2591_COMMAND_BIT | TSL2591_REGISTER_ENABLE, TSL2591_ENABLE_POWERON | TSL2591_ENABLE_AEN | TSL2591_DISABLE_AIEN | TSL2591_ENABLE_NPIEN);
where TSL2591_DISABLE_AIEN must be added in the .h file as:
#define TSL2591_DISABLE_AIEN (0x00)
The text was updated successfully, but these errors were encountered: