Skip to content
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

API access to APDS-9960 gestures #2

Open
davidjsherman opened this issue Mar 3, 2021 · 0 comments
Open

API access to APDS-9960 gestures #2

davidjsherman opened this issue Mar 3, 2021 · 0 comments

Comments

@davidjsherman
Copy link

The apds9960 library provides an interface for retrieving gestures from the ADPS-9960 IC, in particular swiping up, down, left, and right. Providing these discrete values to clients should make it easier to

  • Follow a narrow line with one corner sensor, or stay between two lines using two corner sensors
  • Detect relative motion past an object, rather than remembering the previous state and detecting a change
  • Make course corrections when following a moving object

The changes to the API in rosa/rpi/io_controller.py should be straightforward, essentially

if apds.isGestureAvailable():
    # return constant from liske/python-apds9960/apds9960/const.py#L155
    #  APDS9960_DIR_LEFT = 1
    #  APDS9960_DIR_RIGHT = 2
    #  APDS9960_DIR_UP = 3
    #  APDS9960_DIR_DOWN = 4
    return apds.readGesture()

Although since the Rosa is polled by WsIOHandler.StateGetter, probably that should be two separate methods.

Testing will be difficult in CI because there is not (yet) a mock for the hardware

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant