Due to high demand expect some shipping delays at this time, orders may not ship for 1-2 business days.
0

Simulate joystick with gesture sensor in Arcada
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Simulate joystick with gesture sensor in Arcada

by mccollam on Mon May 17, 2021 5:46 pm

I'm using a CLUE to build a small wearable device. I'd like to be able to use the Arcada library to handle the display and to deal with inputs, specifically with allowing the wearer to select items from a menu. But since there are only two buttons (which would already be mapped to select and cancel) I need another way to handle menu navigation.

What I'd like to do is use the gesture sensor for this. I've verified already that I can read gestures from the APSD9960 (though it's rotated 90 degrees from the display orientation :) ) but I don't see a way to pass those gestures along as if they were joystick input.

Is there a way to use the APSD to simulate a joystick in Arcada? Or failing that, is there a way to programmatically simulate a joystick event in a way that Arcada will catch? (I can grab the gesture input if there's a method I can call like "arcada.joystick_left()".)

Of course if there are better ideas for handling menu navigation on the CLUE without me having to roll my own I'd love to know them!

mccollam
 
Posts: 6
Joined: Fri Mar 10, 2017 3:00 pm

Re: Simulate joystick with gesture sensor in Arcada

by blnkjns on Tue May 18, 2021 12:28 am

I always skip Arcada as it makes compilation times rather hefty. Most of the times you only need a couple of its features, mostly display and input, and those are easily installed by itself. Hardest part is to find the pin numbers. Input is no issue on the CLUE, as it is just basic switches connected to GND. Other boards like the PyBadge have a shift register for the inputs, not here.
So maybe you are fully served by just using the display library, GFX, and the gesture library.

blnkjns
 
Posts: 680
Joined: Fri Oct 02, 2020 3:33 am

Re: Simulate joystick with gesture sensor in Arcada

by adafruit_support_mike on Tue May 18, 2021 3:22 am

It's possible, but not trivial.

The Arcada menu code calls a function named .readButtons() defined here:

https://github.com/adafruit/Adafruit_Ar ... #L427-L558

You'd have to modify that to call your code that interprets gestures.

adafruit_support_mike
 
Posts: 63795
Joined: Thu Feb 11, 2010 2:51 pm

Re: Simulate joystick with gesture sensor in Arcada

by mccollam on Tue May 18, 2021 8:09 am

Thanks Mike.

To be honest, if I need to patch Arcada itself it's probably less effort overall to just roll my own anyway. Thanks for the info and the pointer!

mccollam
 
Posts: 6
Joined: Fri Mar 10, 2017 3:00 pm

Re: Simulate joystick with gesture sensor in Arcada

by adafruit_support_mike on Tue May 18, 2021 5:38 pm

The Arcada menu code uses the GFX libraries button class. You can probably steal the relevant code for your own version.

adafruit_support_mike
 
Posts: 63795
Joined: Thu Feb 11, 2010 2:51 pm

Please be positive and constructive with your questions and comments.