RandomInsano / pscontroller-rs

Rust driver for the Sony PlayStation controllers using embedded-hal
Apache License 2.0
15 stars 6 forks source link

Remove the need for `unsafe` for users #14

Closed RandomInsano closed 6 years ago

RandomInsano commented 6 years ago

Currently, the forced coercion from a read into the Guitar Hero or Mad Maestro controllers require you to access raw parts of the ControllerData union. While this is safe from crashing the app, users shouldn't need to know how to do this or do their own error checking.

So! We should do that for them. Ideally with a safety check that the controller identifier matches the device they're trying to coerce.

After this is done, gh and b fields of the union should be made private again.

RandomInsano commented 6 years ago

Heh. This is a duplicate of #13