0

NeoTrellis 4X4 as HID hotkeys via Trinket M0 (HID library fa
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

NeoTrellis 4X4 as HID hotkeys via Trinket M0 (HID library fa

by TheEnder42 on Tue Feb 12, 2019 1:40 am

I'm attempting to use a NeoTrellis 4X4 as a hotkey pad for some computer games. My code is a heavily modified version of the neotrellis_simpletest.py example from the Adafruit_CircuitPython_NeoTrellis-master library. The trellis interface works fine over a JST cable: the colors are how I want them and the colors change responding to being pressed how they should.

The problem is the HID library.

My import statements are:
Code: Select all | TOGGLE FULL SIZE
import time
from board import SCL, SDA
import busio
from adafruit_neotrellis.neotrellis import NeoTrellis
#from adafruit_hid.keyboard import Keyboard
#from adafruit_hid.keycode import Keycode

and further down I have:

Code: Select all | TOGGLE FULL SIZE
# Make keyboard
time.sleep(1)
#kbd = Keyboard()

When I un-comment any of these 3 lines the trellis buttons stop responding to presses, the colors don't change and the whole thing seems to freeze in place. Un-commenting the #kbd = Keyboard() will clearly cause an error because the keyboard() isn't imported, but the import statements will both cause the "crash" individually.

Has anyone else encountered this before?

Other information (in case it's relevant):
-Using Mu editor
-Trinket M0 has a tiny memory so I had to delete unused files from the libraries.
----Of the adafruit_hid library I cut out consumer_control.mpy, consumer_control_code.mpy, gamepad.mpy, and mouse.mpy. I never import these files but are they still necessary to the library as a whole?

TheEnder42
 
Posts: 1
Joined: Tue Feb 12, 2019 1:17 am

Re: NeoTrellis 4X4 as HID hotkeys via Trinket M0 (HID librar

by adafruit_support_mike on Sun Feb 17, 2019 5:21 am

[moved to the CircuitPython forum]

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

Re: NeoTrellis 4X4 as HID hotkeys via Trinket M0 (HID librar

by tannewt2 on Tue Feb 19, 2019 3:06 am

Hi TheEnder42,
Deleting the extra files from the library should be fine. You'll get an import error if a file is needed.

What version of CircuitPython are you running on the Trinket. It's always good to update to the latest (currently 3.1.2).

The HID library is pretty large so you may need to delete some of the contents of the libraries as well to make them fit into the Trinket's RAM.

~Scott

tannewt2
 
Posts: 981
Joined: Thu Oct 06, 2016 8:48 pm

Please be positive and constructive with your questions and comments.