Making a custom pro controller with a teensy board?

Discussion in 'Switch - Console, Accessories & Hardware' started by Alpha_GX, Apr 24, 2019.

  1. Alpha_GX
    OP

    Alpha_GX Member

    Newcomer
    2
    Dec 11, 2016
    France
    Hi all, I just happened to use ShinyQuagsire splat post printer with a teensy++ 2.0, and as I saw several people making their own bots for the switch I wondered if there was a way to turn the tennsy board in an actual pro controller, I mean taking in some analog input and button press on the board and made them being recognize by the switch as controller input. The ideal would be something like:

    if button(0) is pressed {
    Switch_button(0) is pressed
    }

    First I though I could do that myself, but after looking at the source code, I realized that I didn't understood half of it, I have a very limited knowledge, hence I come here asking for help.
    I also happen to find this project: https://github.com/grantal/teensy-switch
    But don't understand how to get it working (I installed the cores but then I don't understand if there are any special step required)
    Anyways I hope some people will be able to help me.
    Thanks in advance
     
  2. mattytrog

    mattytrog You don`t want to listen to anything I say.

    Member
    12
    Apr 27, 2018
    United Kingdom
    You could use a teensy, with an HC05 bluetooth module. Program the HC05 up with a FTDI usb to serial maybe? Will look into this.
     
    peteruk likes this.
  3. Alpha_GX
    OP

    Alpha_GX Member

    Newcomer
    2
    Dec 11, 2016
    France
    Thanks but that's not what I would like to do, I prefer using usb cable '^^
     
  4. fluffymadness

    fluffymadness Newbie

    Newcomer
    1
    Mar 30, 2019
    Austria
    @Alpha_GX. gbatemp.net/threads/diy-switch-fightstick.534779/ Its for a pro micro not teensy. Haven't added any true analog support, just fake analog since its considered for fightsticks.
    Its completely finished. You'd just need to connect buttons.
     
    Last edited by fluffymadness, Apr 25, 2019
  5. Alpha_GX
    OP

    Alpha_GX Member

    Newcomer
    2
    Dec 11, 2016
    France
    Thanks, I'll looks into it and see what I can do with it :)
     
  6. fluffymadness

    fluffymadness Newbie

    Newcomer
    1
    Mar 30, 2019
    Austria
    On a second look. Teensy 2.0 not the plus version also has an atmega32u4, I think one of these works too.
     
  7. Alpha_GX
    OP

    Alpha_GX Member

    Newcomer
    2
    Dec 11, 2016
    France
    I tried to verify the code with the arduino software for the teensy 2.0 and 2.0++ boards and didn't got any results, as it work for most other Arduino cards, I guess it's not an error on my end, but the board that are incompatiles rn.
    Here is the error message if you wanna take a look:
    Error Message
    Advanced Error Message
    So if I were to switch to a Pro Micro board, is this one good ? https://fr.aliexpress.com/item/Free...-Module-with-2-row-pin-header/1348800135.html
     
  8. fluffymadness

    fluffymadness Newbie

    Newcomer
    1
    Mar 30, 2019
    Austria
    Looks pretty similar to what I bought. I think the clones are pretty much the same. I have the model with 5v/16mhz.

    edit: Yeah...I guess there's some incompatibility there with the teensy
     
    Last edited by fluffymadness, Apr 25, 2019
  9. Alpha_GX
    OP

    Alpha_GX Member

    Newcomer
    2
    Dec 11, 2016
    France
    Well thanks, I'll buy one and see how it goes in about 50 days. ;-;
    I'm still open to others solution if anyone else happen to read this.
     
  10. fluffymadness

    fluffymadness Newbie

    Newcomer
    1
    Mar 30, 2019
    Austria
    That's the thing with usb libraries. They are very microcontroller specific :/ The teensy 3.0 for example also has its own usb stack. I played around with some xinput stuff before i moved to the pro micro.
    There's also a lightweight usb stack for stm microcontrollers. You kinda have to port some code, switching usb stack, when using a different microcontroller.
    The basic function of the controller itself is just a hid usb descriptor, and some binary data that contains the pressed buttons.

    edit: if you want to do a bit of reading: eleccelerator.com/tutorial-about-usb-hid-report-descriptors/
     
    Last edited by fluffymadness, Apr 25, 2019
    Alpha_GX likes this.
  11. Alpha_GX
    OP

    Alpha_GX Member

    Newcomer
    2
    Dec 11, 2016
    France
    Hey I actually got it to work, I looked again in the Joystick.c file and by modifying the content of void GetNextReport and cleaning up the useles stuff, I manage to make everything work.
    Here is how it looks like now:
    GetNextReport
    analogRead and map functions
    The controls are a bit special cause it's only based on two analog read, but that's my controller limitation, nothing with the code itself.
    I'll probably do a little tiny write up so people that will have the same problems as me would find a quick answer.
    Guess I can close the thread now ¯\_(ツ)_/¯
    Edit: I don't know how to do that
     
    Last edited by Alpha_GX, Apr 26, 2019
    fluffymadness and peteruk like this.
Loading...