Giter Site home page Giter Site logo

sharplibmicroinput's Introduction

SharpLibMicroInput

Input emulation via microcontroller as a .NET library

Board support

I've been using Visual Micro to build firmwares from Visual Studio 2022. Though I guess you could in theory build them from the Arduino IDE too.

Teensy 4.0 setup

Here are instructions you need to follow to be able to build and flash your Teensy 4.0 with Micro Input firmware. Once your are done

Add Micro Input USB type to options menu

Edit the boards.txt typically located in %LOCALAPPDATA%\Arduino15\packages\teensy\hardware\avr\1.59.0 and locate the following lines:

teensy40.menu.usb.rawhid=Raw HID
teensy40.menu.usb.rawhid.build.usbtype=USB_RAWHID
teensy40.menu.usb.rawhid.upload_port.usbtype=USB_RAWHID
teensy40.menu.usb.rawhid.fake_serial=teensy_gateway

Insert those lines just after them

teensy40.menu.usb.microinput=Micro Input
teensy40.menu.usb.microinput.build.usbtype=USB_MICRO_INPUT
teensy40.menu.usb.microinput.upload_port.usbtype=USB_MICRO_INPUT
teensy40.menu.usb.microinput.fake_serial=teensy_gateway

Add USB descriptor type

Edit usb_desc.h typically located in %LOCALAPPDATA%\Arduino15\packages\teensy\hardware\avr\1.59.0\cores\teensy4 and insert the following lines after the USB_RAWHID configuration:

  #elif defined(USB_MICRO_INPUT)
    #define VENDOR_ID		0x2808
    #define PRODUCT_ID	0x0000
    #define BCD_DEVICE		0x0001
    #define RAWHID_USAGE_PAGE	0xFFAB  // recommended: 0xFF00 to 0xFFFF
    #define RAWHID_USAGE		0x0200  // recommended: 0x0100 to 0xFFFF
    #define MANUFACTURER_NAME	{'S','l','i','o','n','s'}
    #define MANUFACTURER_NAME_LEN	6
    #define PRODUCT_NAME		{'M','i','c','r','o','I','n','p','u','t'}
    #define PRODUCT_NAME_LEN	10
    #define EP0_SIZE		64
    #define NUM_ENDPOINTS         6
    #define NUM_INTERFACE         4	
    #define NUM_USB_BUFFERS	      24
    // RawHID	
    #define RAWHID_INTERFACE      0	
    #define RAWHID_TX_ENDPOINT    2
    #define RAWHID_TX_SIZE        64
    #define RAWHID_TX_INTERVAL    1	
    #define RAWHID_RX_ENDPOINT    3
    #define RAWHID_RX_SIZE        64
    #define RAWHID_RX_INTERVAL    1	 
    // Serial Emulation
    #define SEREMU_INTERFACE      1
    #define SEREMU_TX_ENDPOINT    4
    #define SEREMU_TX_SIZE        64
    #define SEREMU_TX_INTERVAL    1	 
    #define SEREMU_RX_ENDPOINT    4
    #define SEREMU_RX_SIZE        32
    #define SEREMU_RX_INTERVAL    2	 
    
    #define ENDPOINT2_CONFIG	ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
    #define ENDPOINT3_CONFIG	ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_UNUSED
    #define ENDPOINT4_CONFIG	ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
    
  // Keyboard
    #define KEYBOARD_INTERFACE    2	
    #define KEYBOARD_ENDPOINT     5
    #define KEYBOARD_SIZE         8
    #define KEYBOARD_INTERVAL     1
    // Keyboard Media Keys
    #define KEYMEDIA_INTERFACE    3	
    #define KEYMEDIA_ENDPOINT     6
    #define KEYMEDIA_SIZE         8
    #define KEYMEDIA_INTERVAL     4
    // Mouse
    /*
    #define MOUSE_INTERFACE       4	
    #define MOUSE_ENDPOINT        7
    #define MOUSE_SIZE            8
    #define MOUSE_INTERVAL        1
    */
    //SL: Joystick currently not working together with RawHID on Teensy 4.0
    /*
    #define JOYSTICK_INTERFACE    5	// Joystick
    #define JOYSTICK_ENDPOINT     7
    #define JOYSTICK_SIZE         12	//  12 = normal, 64 = extreme joystick
    #define JOYSTICK_INTERVAL     2
    */
    
    #define ENDPOINT5_CONFIG	ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
    #define ENDPOINT6_CONFIG	ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  // #define ENDPOINT7_CONFIG	ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
    //#define ENDPOINT8_CONFIG	ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT

sharplibmicroinput's People

Contributors

slion avatar

Watchers

 avatar  avatar  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.