/STM8-Gyrostick

STM8 USB HID controller with MPU6050 motion data

Primary LanguageC++

STM8 Gyrostick

This is a USB HID game controller inspired by Cemu Gyro Joystick project. The hardware is based on cheap MPU6050 modules used by Gyro_Joystick.

It uses a firmware based USB library on a STM8S003 similar to VUSB and has to live with the HID report limitations of 8 bytes for low speed devices. The 3 Accelerometers and 3 Gyroscopes are grouped logically under their own reportIDs and takes turn being sent. There is a long list of STM8 I2C peripheral errata, so I have no choice but to base mine on ST's heavy IRQ code from AN3281 - STM8 8-bit MCUs I2C optimized examples. A simple busy wait was all that was need to make both of them coexist.

My project page

STM8 VUSB

The firmware only USB stack is an unofficial fork from STM8S-VUSB-KEYBOARD

  • Works with current special edition of Cosmic C (4.4.10) and current version of STVD (4.3.12)

Note:

The USB stack calibrates the HSI clock while connected to the PC. The calibration is store in EEPROM. It may take a couple of minutes the first time before it functions correctly.

Licenses

Hardware

  • designed by me. License under Creative Common Attribution 4.0 International CC BY 4.0

Firmware

3rd party firmware used

  • STM8 USB stack is under GPL-2.0. It is based on work by Github user BBS215
  • MPU6050.h header file by Harinadha Reddy Chintalapalli harinath.ec@gmail.com is under MIT license
  • ST STM8 header file under "MCD-ST Liberty SW License Agreement V2" text here
  • I2C library are released as a published app. note by ST MCD Application Team. They can be used by ST STM8 customers. I modified and cleaned up their code and not claiming copyright.

Initial release - WIP. Hardware working with Windows, but not picked up by Cemu software. Hard to debug the massive amount of Node.JS framework brought in by CEMU without any documentations