Trellis M4 hid error : Launch Deck Trellis M4

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
davidb21
 
Posts: 49
Joined: Mon Mar 24, 2014 9:13 am

Trellis M4 hid error : Launch Deck Trellis M4

Post by davidb21 »

Hello,

I am trying to get some hid examples (see below) working but keep hitting library errors.

Can some point me towards a bundle for the Launch Deck Trellis M4 that has hid working.
==
# Launch Deck Trellis M4
# USB HID button box for launching applications, media control, camera switching and more
# Use it with your favorite keyboard controlled launcher, such as Quicksilver and AutoHotkey

import adafruit_trellism4
import time
import random
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keycode import Keycode
from adafruit_hid.consumer_control import ConsumerControl
from adafruit_hid.consumer_control_code import ConsumerControlCode

== snip ==



Line 84: kbd = Keyboard()

code.py output:
Traceback (most recent call last):
File "code.py", line 84, in <module>
TypeError: function takes 2 positional arguments but 1 were given

User avatar
kattni
 
Posts: 132
Joined: Fri Aug 18, 2017 6:33 pm

Re: Trellis M4 hid error : Launch Deck Trellis M4

Post by kattni »

It's not the bundle that is the issue, it is the code. I don't have an exact updated version of the code you're using, but here is a snippet of the setup from a working example.

Code: Select all

import usb_hid
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS
from adafruit_hid.keycode import Keycode
 
keyboard = Keyboard(usb_hid.devices)
keyboard_layout = KeyboardLayoutUS(keyboard)
You need to import usb_hid, and provide usb_hid.devices to the Keyboard() object.

User avatar
davidb21
 
Posts: 49
Joined: Mon Mar 24, 2014 9:13 am

Re: Trellis M4 hid error : Launch Deck Trellis M4

Post by davidb21 »

I found out I was using a old version of the hid library. It now works but now am having with the Mac keyboard mappings.

I have the 0,0 pushbutton working which brings up the Mac screen capture.

I can't get the Mac 'F3' button (code config below) to work which makes all the windows be visible.

Any ideas.

keymap = {
(0,0): (0x001100, KEY, (Keycode.COMMAND, Keycode.SHIFT, Keycode.FIVE)),
#(0,0): (0x001100, MEDIA, ConsumerControlCode.PLAY_PAUSE),

(1,0): (0x110011, KEY, (Keycode.F3)),

User avatar
kattni
 
Posts: 132
Joined: Fri Aug 18, 2017 6:33 pm

Re: Trellis M4 hid error : Launch Deck Trellis M4

Post by kattni »

I'm not sure. Is it possibly related to Macs often needing the function key to be pressed to access the Fx keys? Or that you're utilising a Mac shortcut that isn't directly assigned to F3, but instead to the alternate keymapping of that key?

Beyond that, I'm uncertain. I would recommend creating a new forum post if you can't sort it out so that your new question doesn't get lost in this topic.

User avatar
davidb21
 
Posts: 49
Joined: Mon Mar 24, 2014 9:13 am

Re: Trellis M4 hid error : Launch Deck Trellis M4

Post by davidb21 »

I found a work around. I am using (1,0): (0x110011, KEY, (Keycode.CONTROL, Keycode.UP_ARROW)). Thanks!

User avatar
davidb21
 
Posts: 49
Joined: Mon Mar 24, 2014 9:13 am

Re: Trellis M4 hid error : Launch Deck Trellis M4

Post by davidb21 »

I purchased another Trellis M4 kit and downloaded the bundle for the 8 step learn example.

It did not work and there was an error with the neopixle library. I did a md5sum on the neopixle library from the bundle example for the learn application launcher library and saw a different hash.

I placed the neopixle library from the application launch bundle and that fixed the problem.

So it seems like the learn example bundle for the 8 step has an issue.

Locked
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”