rdepena/node-dualshock-controller — pull request #18 by achingbrain (2014-04-17 08:41:06+00:00)
Title: Adds support for missing ds4 buttons, tests and coverage

I picked up a PS4 controller so have added support for the buttons.

The d-pad is a bit weird in that it shares the same block as the triangle, circle, etc buttons. The buttons are bitmasked values in the upper 8 bits and the d-pad uses the lower 8 bits however their values are not masked - there are discrete values for left, up+left, up, up+right, right, etc. The d-pad up button sets the lower 8 bits to 0 so I had to add some extra code to handle that too.

I've added unit tests for the above.

Finally I also added a `npm run coverage` script that uses [istanbul](https://github.com/gotwarlost/istanbul) to generate an html coverage report in `./coverage`

Happy to discuss any and all changes.