Configure Teensy HID device from PC?

Status
Not open for further replies.

gregevans209

New member
I was planning on using a Teensy 4.1 as part of a DIY simulator setup but apparently none of the software that I as looking at using to control the setup works on the Teensy for various reasons (MMjoy2 & FreeJoy). How do I go about making the Teensy 4.1 configurable via software to change button mappings and keycodes without going into the IDE? I'm willing to code this from scratch if there's not already something I can use with the newer Teensy models otherwise I'm going to have to redo the whole project and change some circuits if I switch MCU's.

EDIT: To clarify, I want to write a GUI or command line application that allows me to remap the inputs of my controller from PC. the controller uses Joystick + Keyboard HID mode. The keyboard keycodes are primarily what need changed from pc. Similar to what MMJoy2, Freejoy, and the U-HID and Bodnar board software can do. I'm not asking for help coding the mapping software per se, but more specifically how to communicate and configure the software on the Teensy. I know how to go about doing this with standard arduino/atmel chips where the bootloader can be modified but cant figure out how to do this on the teensy where the doesnt appear to be the case.
 
Last edited:
Hey @gregevans209 !

I discovered Freejoy just yesterday but already have a couple of Teensy's around, and planned to use them for just that kind of project, using Teensy LC and Teensy 4.1. I think what would be interesting is to first define the protocol (over USB serial) between the Teensy and the application. I don't know if it might be worth using the same as Freejoy or not, I did not dig deep enough into Freejoy. It would be cool to be able to use a command line to up/download mappings to the Teensy, and to activate loaded profiles through tihs protocol too, so that scripts could automagically activate the correct one for a given game, for example.

My time is currently too short to code such things, but I'd definitely be willing to help on the specification and testing side if something completely new is being developed. Maybe I could also get my hands on a UX designer, at least for the GUI part.

One point I have not yet found how to easily change (by software configuration or with a jumper on a digital input for example, with a preference for the first option) is the USB product ID (they do it on Freejoy and I find it useful when several controllers are connected, to know which one is which) as it is just some constants in .c and .h files
 
EDIT: To clarify, I want to write a GUI or command line application that allows me to remap the inputs of my controller from PC. the controller uses Joystick + Keyboard HID mode. The keyboard keycodes are primarily what need changed from pc. Similar to what MMJoy2, Freejoy, and the U-HID and Bodnar board software can do. I'm not asking for help coding the mapping software per se, but more specifically how to communicate and configure the software on the Teensy. I know how to go about doing this with standard arduino/atmel chips where the bootloader can be modified but cant figure out how to do this on the teensy where the doesnt appear to be the case.

I hope I understood your question right... maybe, not...
I don't get what this has to do with the bootloader, how a bootloader can help to remap inputs, and what the bootloader should do exactly. Can you clearify that?
Normally the bootloader does what it name says... nothing more. Seems you want it to do something different?

how to communicate and configure
[/code]
Write a program for the Teensy that accepts your commands via hid or serial, or.. anything you want.

For the remapping: You can store the remapping in the eeprom and use that. On PC-Side you programm just needs to tell the Teensy what it should do.. Easiest via serial or HID protocol.
If you don't want the Arduino IDE, there are alternatives (I like Platformio)
 
One point I have not yet found how to easily change (by software configuration or with a jumper on a digital input for example, with a preference for the first option) is the USB product ID (they do it on Freejoy and I find it useful when several controllers are connected, to know which one is which) as it is just some constants in .c and .h files

Should be doable, but need some little changes to the core files... maybe Paul Stoffregen reads this and adds some macros...

Edit: The Teensy loader will not find it anymore but there's the 15 sec reset that erases all and puts it into the orginal state.
 
Last edited:
Should be doable, but need some little changes to the core files... maybe Paul Stoffregen reads this and adds some macros...

Edit: The Teensy loader will not find it anymore but there's the 15 sec reset that erases all and puts it into the orginal state.

OK let's see if Paul happens to stumble in that thread then. I suppose it would need a reboot of the Teensy, but that should not be an issue here. I did not get what you meant in your edit, sorry... :confused:
 
On Teensy 2.0, 3.2, and 3.6 I'm able to reconfigure my devices, but it involves a bit of hacking. I'm not going to give you all the details, but the reason it's possible is because the EEPROM can be read before the Teensy is enumerated. If you look around for some of my old posts from several years back you'll see some of the details about how to make it work.
 
Last edited:
Neat, thanks for the hint @yeahtuna ! EEPROM would definitely be a good candidate to store the USB product ID if it can be read at startup.
 
I have an instrument panel with encoders that send xplane commands to adjust the different instruments. I have one Air Manager panel that has a normal heading indicator and another that has an HSI and puts NAV2 into the NAV1 position (there are other differences). I have a mode switch on my "audo panel" that I use to switch the panel controller from one to the other, and a multi-color LED above it that says which mode it is in. Then, my code decides which XP command it's going to send for which encooder based on the mode it is in.
 
Status
Not open for further replies.
Back
Top