Giter Site home page Giter Site logo

siorpaes / stm32-spinner Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 4.47 MB

Implementation of a USB arcade spinner to be used, for example, in Arkanoid gameplay

License: MIT License

C 99.83% Assembly 0.17%
arcade-controller arkanoid spinner stm32f042 usb-controller ea-jm01

stm32-spinner's Introduction

stm32-spinner

The aim of this project is the development of an stm32-based arcade spinner to be used, for example, in Arkanoid gameplay. Spinner acceleration table can be customized by editing the map in compute_steps2() function.

Bill of materials

Setup

First off, set all Spinner dip-switches to ON position. This will enable UART data transfer with 1ms period. The protocol is simple: when spinning clockwise the string 0xff 0x00 0x00 0x01 is emitted and the blue LED flashes. When spinning counterclockwise, the string 0xff 0x00 0x00 0xFE is emitted and the red LED flashes. The UART settings are usual 115200 8N1. Looking the the female connector with the nothces upwards, its pinout is: Vin-GND-TX-RX. Spinner Vin must be 5V. 3V3 won't work. Spinner RX signal is not used. There is also the possibility to use simple pulses instead of UART protocol by connecting the the K+ and K- signals. See relevant logic analyzer dumps in the logs directory for more details.
Snooping a USB mouse USB HID traffic with Wireshark, it can be noted that HID reports are emitted every 8ms. Tests showed that reports emitted at a faster pace are ignored by the USB host. Therefore, a 8ms timer triggers the USB reporting. The contents of the report depend on the number of pulses received by the spinner during the 8ms slot in a non-linear way so to enable acceleration effect. See also dumps coming from a real Dell mouse in the logs directory.

Pinout

Signal STM32 IO Nucleo connector
USB DP (Green) PA12 CN3-5 [D2]
USB DM (White) PA11 CN3-13 [D10]
Spinner UART PA10 CN3-2 [D0]
Fire Button PA0 CN4-12 [A0]
Onboard LED PB3 CN4-15 [D13]
Debug1 PB4 CN3-15 [D12]
Debug2 PB5 CN3-14 [D11]
+5V CN4-4
GND CN3-4
GND CN4-2

TODO

  • Use interrupt-driven UART acquisition
  • Add spinner acceleration support
  • Add precise timer-based USB report triggering instead of SysTick
  • Add documentation on hardware setup
  • Add Wireshark and Saleae logs
  • Add support for button

stm32-spinner's People

Contributors

siorpaes avatar

Watchers

 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.