• Stars
    star
    102
  • Rank 335,584 (Top 7 %)
  • Language
    C
  • Created almost 10 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

STM32 HID keyboard, mouse and joysticks for arcade builds

arcadehid

STM32 HID device for arcade builds

Compound HID device containing keyboard, mouse, two joysticks and a virtual com port. Plug into a retropie or something and wire cool buttons and joysticks and whatnot.

See /cad - here you'll find a reference design with 26 pins for an STM32F1 128kB flash variant. Any STM32F1 board would do, as long as pin-headers are broken out.

Each pin can be configured with combinations of a keyboard keypress, mouse movement or click, or joystick movement or button press.

Every pin can hold up to eight different combinations. There is also ternary support meaning a pin's config can change depending on if another pin is active or not.

Accelerators for mouse and joystick are supported.

Everything is configured in the command line interface, either via UART pins or via virtual com port.

Different configurations can be saved and loaded, using the internal flash of the STM32F1 (128 kb variant) - no extra storage chip needed.

Depends on pellepl/generic_embedded and pellepl/niffs.

Now also with the Annoyatron support, drive your friends mad...

CLI pin definition examples

// define pin 1 to send keyboard character A
def pin1 = a
// define pin 2 to move mouse up
def pin2 = mouse_y(-1)
// define pin 3 to move mouse right if pin 4 is pressed else left
def pin3 = pin4 ? mouse_x(1) : mouse_x(-1)
// define pin 5 to send keyboard sequence CTRL+ALT+DEL
def pin5 = LEFT_CTRL LEFT_ALT DELETE

For certain definitions, numerators are possible. A numerators normally tells how much to move something, e.g. a mouse or joystick. In addition, all numerators can have accelerators, meaning the control will move more and more over time. A numerator <num> is defined as (ACC)[(+)|-][1..127].

// move joystick 10 steps right on x axis
def pin7 = joy1_x(10)
// move joystick accelerating from 1 to 10 steps right on x axis
def pin8 = joy1_x(ACC10)
// and left
def pin8 = joy1_x(ACC-10)

Accelerator speed is controlled by cli commands

set_mouse_pos_acc
set_mouse_wheel_acc
set_joy_acc

Following is a list of all definitions possible.

KEYBOARD SYMBOLS:
  A                   B                   C                   D                   
  E                   F                   G                   H                   
  I                   J                   K                   L                   
  M                   N                   O                   P                   
  Q                   R                   S                   T                   
  U                   V                   W                   X                   
  Y                   Z                   1                   2                   
  3                   4                   5                   6                   
  7                   8                   9                   0                   
  ENTER               ESCAPE              BACKSPACE           TAB                 
  SPACE               MINUS               EQUAL               LEFTBRACKET         
  RIGHTBRACKET        BACKSLASH           NONUS_HASH          SEMICOLON           
  QUOTE               GRAVE               COMMA               DOT                 
  SLASH               CAPSLOCK            F1                  F2                  
  F3                  F4                  F5                  F6                  
  F7                  F8                  F9                  F10                 
  F11                 F12                 PRINTSCREEN         SCROLLLOCK          
  PAUSE               INSERT              HOME                PGUP                
  DELETE              END                 PGDOWN              RIGHT               
  LEFT                DOWN                UP                  NUMLOCK             
  KP_SLASH            KP_ASTERISK         KP_MINUS            KP_PLUS             
  KP_ENTER            KP_1                KP_2                KP_3                
  KP_4                KP_5                KP_6                KP_7                
  KP_8                KP_9                KP_0                KP_DOT              
  NONUS_BACKSLASH     APPLICATION         POWER               KP_EQUAL            
  F13                 F14                 F15                 F16                 
  F17                 F18                 F19                 F20                 
  F21                 F22                 F23                 F24                 
  EXECUTE             HELP                MENU                SELECT              
  STOP                AGAIN               UNDO                CUT                 
  COPY                PASTE               FIND                MUTE                
  VOLUME_UP           VOLUME_DOWN         LOCKING_CAPS        LOCKING_NUM         
  LOCKING_SCROLL      KP_COMMA            KP_EQUAL_AS400      INT1                
  INT2                INT3                INT4                INT5                
  INT6                INT7                INT8                INT9                
  LANG1               LANG2               LANG3               LANG4               
  LANG5               LANG6               LANG7               LANG8               
  LANG9               ALT_ERASE           SYSREQ              CANCEL              
  CLEAR               PRIOR               RETURN              SEPARATOR           
  OUT                 OPER                CLEAR_AGAIN         CRSEL               
  EXSEL               SYSTEM_POWER        SYSTEM_SLEEP        SYSTEM_WAKE         
  AUDIO_MUTE          AUDIO_VOL_UP        AUDIO_VOL_DOWN      MEDIA_NEXT_TRACK    
  MEDIA_PREV_TRACK    MEDIA_STOP          MEDIA_PLAY_PAUSE    MEDIA_SELECT        
  MEDIA_EJECT         MAIL                CALCULATOR          MY_COMPUTER         
  WWW_SEARCH          WWW_HOME            WWW_BACK            WWW_FORWARD         
  WWW_STOP            WWW_REFRESH         WWW_FAVORITES       MEDIA_FAST_FORWARD  
  MEDIA_REWIND        LEFT_CTRL           LEFT_SHIFT          LEFT_ALT            
  LEFT_GUI            RIGHT_CTRL          RIGHT_SHIFT         RIGHT_ALT           
  RIGHT_GUI           

MOUSE SYMBOLS:
  MOUSE_X(<num>)      MOUSE_Y(<num>)      MOUSE_BUTTON1       MOUSE_BUTTON2       
  MOUSE_BUTTON3       MOUSE_WHEEL(<num>)  

JOYSTICK SYMBOLS:
  JOY1_X(<num>)       JOY1_Y(<num>)       JOY1_BUTTON1        JOY1_BUTTON2        
  JOY1_BUTTON3        JOY1_BUTTON4        JOY1_BUTTON5        JOY1_BUTTON6        
  JOY1_BUTTON7        JOY1_BUTTON8        JOY1_BUTTON9        JOY1_BUTTON10       
  JOY1_BUTTON11       JOY1_BUTTON12       JOY1_BUTTON13       JOY1_BUTTON14       
  JOY2_X(<num>)       JOY2_Y(<num>)       JOY2_BUTTON1        JOY2_BUTTON2        
  JOY2_BUTTON3        JOY2_BUTTON4        JOY2_BUTTON5        JOY2_BUTTON6        
  JOY2_BUTTON7        JOY2_BUTTON8        JOY2_BUTTON9        JOY2_BUTTON10       
  JOY2_BUTTON11       JOY2_BUTTON12       JOY2_BUTTON13       JOY2_BUTTON14

Building

Make sure you clone submodules.

human-entity@machine ~$ git clone --recursive https://github.com/pellepl/arcadehid

You'll need an arm toolchain, let's say it lies in /home/human-entity/toolchain/arm-none-eabi-toolchain-gcc-6.3.0. Then you simply do this:

human-entity@machine ~$ cd arcadehid
human-entity@machine ~/arcadehid$ make clean
human-entity@machine ~/arcadehid$ CROSS_COMPILE=/home/human-entity/toolchain/arm-none-eabi-toolchain-gcc-6.3.0/bin/arm-none-eabi- make all

Alternatively. you tinker a bit with the makefile.

This will produce target files in elf, binary, and ihex flavours in the build folder. Flash using your favourite dongle and tool. I use OpenOCD, there are some scripts in the repo which might be helpful to others.

More Repositories

1

spiffs

Wear-leveled SPI flash file system for embedded devices
C
1,508
star
2

spiflash_driver

Hardware agnostic generic spi flash driver
C
74
star
3

tinyheap

Heap for small embedded targets
C
27
star
4

niffs

Wear leveled embedded NOR internal flash file system
C
26
star
5

generic_embedded

generic embedded stuff used throughout hobby projs
C
21
star
6

stm32_spiffs

STM32 target playground for spiffs
C
17
star
7

baremetal

C
14
star
8

verisure1512

Workshop@work
C
9
star
9

nrf52-btlamp

BLE lamp - nrf52832 + ws2812b led ring
C
9
star
10

softsynth

software old school synthesizer
C
4
star
11

bitmanio

Bit manipulation IO - break free of the fixed bit size tyranny
C
4
star
12

cnc_stm32

Own CNC driver, proprietary protocols deluxe
C
4
star
13

tuscedo

serial terminal with a LOT of sugar
Java
1
star
14

comm

Simple comm stack suitable for rf/udp/esp
C
1
star
15

png2arr

converts png images and fonts to bit arrays for monochrome displays
C
1
star
16

pyadventure

Silly python game made as a university course exam
Python
1
star
17

nrfdfu_ng

mirror of https://gitlab.com/visti_how/nrfdfu_ng
C
1
star
18

uweb

Super simple mini web server
C
1
star
19

wisleep

smart lamp - ws2812b led ring, esp8266, stm32f1, accelerometer & magnetometer
C
1
star
20

spfs

tbd todo fixme
C
1
star
21

java-utils

Generic java stuff
Java
1
star
22

larvbot

stm32f4 robotics
C
1
star
23

spiffsview

graphical java utility for examining spiffs dumps
Java
1
star
24

spybot

RC car with spycam+sensors on it, prequel to larvot
C
1
star
25

verisure1612

workshop 2016
C
1
star
26

msp430bsl

C
1
star
27

minecraft-texedit

Minecraft texture pack editor for them kidz
Java
1
star
28

umac

under construction
Java
1
star
29

cnc_ctrl

CNC Java backend for cnc_stm32 controller
nesC
1
star
30

burglarm

1
star
31

saico

SAI command operations - STM32F7 SAI playground
C
1
star