How to access HID functions?


#1

Hi, i bought a USB (computer) keyboard and would like to use it as a button box for axoloti.

I'm aware that is hard to find a fits for all solution, however i'd like to get some advice for making custom objects.

Is there any code i should know? Something like the

outlet_left = hid_buttons[0];
outlet_right = hid_buttons[1];
outlet_middle = hid_buttons[2];
outlet_x = hid_mouse_x;
outlet_y = hid_mouse_y;

Inside the usb/mouse object


#2

Ive already commented on this here:

there is already low level support in the STM firmware, and this has been extended up to the axoloti firmware.
However, we have not exposed it i.e. to get to the hid_buttons level which objects can use.

it would be pretty trivial to add, and certainly would work for your needs (i.e. just outputting ascii or keyboard codes), but for boarder needs it gets a bit more complicated.

if your interested the file is:
firmware/usbh_conf.c
and the structure is defined in:
firmware/STM32_USB_Host_Library/Class/HID/Inc/usbh_hid_keybd.h

at the trivial level, is just a matter of exposing the structure, and then creating an axo object to use it.

one small point, the firmware has a limitation of: AZERTY or QWERTY mappings (and the firmware has to be compiled differently for each), and a max of 6 simultaneous keys.


Coding a HID-Spacenavigator object
#3

Could this also be done to expose touch-screen absolute X/Y positions?


#4

ah, indeed I found that changing the
hid_mouse_x+=
into
hid_mouse_x=
(and for y the same)
does do the job partly for the y axis, although it only goes from 0 to 7 and the x axis goes all over the place.
so.. ehm.. change the bit-inputs for the x/y axis?