-
Notifications
You must be signed in to change notification settings - Fork 15
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
Switch events to properties #42
Comments
I tinkered with this a little bit on this branch: https://github.com/FoamyGuy/Adafruit_CircuitPython_ADXL34x/tree/seperate_events_props, adding these properties:
With a basic code.py that checks both in it's main loop:
I found that having the individual properties like this seems to clear out the event trigger data when you read any property. So reading the If the user code is only intending to check for a single kind of event then this is fine, but if the user code is interested in multiple event types using the individual properties would cause it to miss events of some types depending on which order they check them in. With the
Shows True for motion and tap events at the appropriate times. I'm unsure if that behavior changes the desire to have them broken out into separate properties or not. If we do still want that I'd be happy to work on it. I'll set this down for now though and await more direction. |
spoke with @ladyada about this one a bit during the meeting tonight. She suggested keeping them together since they clear each other, but maybe returning an int instead of a dictionary and user code would need to use bitwise to check which events have happened. |
Right now there is an
events
property that returns a dictionary of what events are enabled. There are separateenable_
anddisable_
functions for each event type. Instead, we should removeevents
in favor of a property for each event. To know if it is enable, then you can read it. To change it, the value can be set.The 37x library should be updated to match. https://github.com/adafruit/Adafruit_CircuitPython_ADXL37x
The text was updated successfully, but these errors were encountered: