Giter Site home page Giter Site logo

ps2pi's Introduction

ps2pi

PS2 Controller Library for the Raspberry Pi

This project is built from bits and pieces I've found on the Internet, including, but not limited to Bill Porter madsci1016/Arduino-PS2X c-herring/PiPS2

For some reason, I couldn't get the PiPS2 library to work with my Chinese knockoff PS2 controller, so I sat down and hacked it beyond recognition. I've probably thrown a dozen babies out with the bath water, but now

IT WORKS FOR ME

To compile, you need the wiringPi library, and if you want to run the curstst program, you'll need the curses library. I've included two shell scripts for your convenience.

Usage

There's a messy way and a clean way.

The messy way

Create spaghetti code
LOOP
	Read PS2 Controller
	See if this button is pressed
	See if that button is pressed
	Clutter up the code with more of these
END LOOP

For an example, see the file messy.cpp

The clean way

Register all your functions as actions
LOOP
    Read PS2 Controller and dispatch actions
END

For an example, see the file clean.cpp

setXAction(xaction, user_data)

Register a function void xaction(int pressure, void *user_data) to be called when the X button is pressed. The pointer user_data can point to anything.

TODO

See if I can get pressure mode and native mode to work. Find a better way to ensure valid data

ps2pi's People

Contributors

turnimator avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

ybatsh

ps2pi's Issues

Pressure

Still can't detect button pressure

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.