GithubHelp home page GithubHelp logo

mica-angeli / lufahybridfightstick Goto Github PK

View Code? Open in Web Editor NEW

This project forked from crazyredmachine/lufahybridfightstick

0.0 1.0 0.0 75 KB

Nintendo switch AND XInput controller for Arduino Leonardo and Pro Micro

C 74.32% C++ 25.68%

lufahybridfightstick's Introduction

LUFA Switch/XInput hybrid Fightstick (SNES Edition)

This code can be used to make a SNES Gamepad work on Nintendo Switch and XBox360 (or PC in XInput mode).

I've put an arduino pro micro directly inside the controller, but you could also go non-destructive and use this code to make an external usb adapter.

Acknowledgments

This work is based on fluffymadness' ATMega32U4-Switch-Fightstick and bootsector's XInputPadMicro, with a couple QoL improvements I needed.

The SNES pad read code is based on Anthony Burkholder's USBSNES controller.

Features

Gamepad modes

Hold "select" as you plug the controller to make it a Nintendo Switch controller.

Hold "start" as you plug the controller to make it an XInput controller.

Gamepad mode is persistent across plugging and unplugging the controller, so if you don't press anything while plugging the controller, it will stay in the last used mode.

DPAD modes

You can switch seamlessly between the 3 stick modes by pressing START+SELECT.

  • DPAD
  • Fake Left Analog (DPad is mapped to L-Analog)
  • Fake Right Analog (DPad is mapped to R-Analog)

DPAD mode is also persistent.

Simulated home button

Because the SNES pad doesn't have a home button, I also added some code so that holding start+select during more than 1 second presses the home button. You can customize the delay with #define HOME_DELAY 1000 in the .ino file.

Building Instructions

  • Download Arduino IDE,
  • Download Arduino Lufa from https://github.com/Palatis/Arduino-Lufa and follow the instructions to install and activate it
  • Build and Flash for your ATMEGA32U4 Board
  • Have Fun

Pinout

When looking at the plug of the controller cable :

 1 2 3 4 | 5 6 7 >
 
 V C L D | x x G >
 
 1: 5V                    -> to arduino 5V
 2: clock (normally high) -> to arduino digital pin 6
 3: latch (normally LOW)  -> to arduino digital pin 3
 4: data  (normally high) -> to arduino digital pin 4
 7: GND                   -> to arduino GND

lufahybridfightstick's People

Contributors

crazyredmachine avatar mica-angeli avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.