andrew/node-xbox-controller — pull request #8 by bolbola (2013-11-16 22:50:34+00:00)
Title: Configuration Function

Firstly I migrated the buttons and triggers objects into JSON files, and I created a third object in a JSON file named joysticks. I changed the leftx, rightx, lefty and righty vars to accept their values from the joysticks JSON file.Then I added a configure function that relies on a switch statement that determines what button to config,how many buffer reads to gather, what type it is (key,trigger or joystick) and the axis, if applicable. This then calls the analyze function which measures changes in the block and bitwise compared to a set of original buffer data. Then it calls the configure function again and so on until the config is done, at which point I use fs to overwrite the JSON files with all the values.