dualshock4

Crates.iodualshock4
lib.rsdualshock4
version0.1.1
sourcesrc
created_at2018-02-28 18:03:01.933993
updated_at2018-03-20 06:33:19.489943
descriptionRead Dualshock4 controller data by using hidapi
homepagehttps://bitbucket.org/unessa/dualshock4-rust
repositoryhttps://bitbucket.org/unessa/dualshock4-rust.git
max_upload_size
id53212
size26,824
(nikoviik)

documentation

https://bitbucket.org/unessa/dualshock4-rust

README

Dualshock4 controller

This library is used to read dualshock4 controller data.

Dualshock4 event data documentation: http://www.psdevwiki.com/ps4/DS4-USB

Usage

Connect dualshock4 controller to your computer by using USB or bluetooth connection.

Add the following dependencies:

[dependencies]
hidapi = "0.4.1"
dualshock4 = "0.1.0"

Start reading device data:

extern crate hidapi;
extern crate dualshock4;

use hidapi::{HidApi};

fn main() {
    let api = HidApi::new().expect("Failed to create HID API instance.");
    let controller = dualshock4::get_device(&api).expect("Failed to open device");

    loop {
        let data = dualshock4::read(&controller)
            .expect("Failed to read data");
        println!("{:?}", data);
    }
}
Commit count: 0

cargo fmt