Skip to content

Instantly share code, notes, and snippets.

@reidrac
Created April 15, 2012 20:51
Show Gist options
  • Save reidrac/2394765 to your computer and use it in GitHub Desktop.
Save reidrac/2394765 to your computer and use it in GitHub Desktop.
#include<stdio.h>
#define BUTTON1 1
#define BUTTON2 3
#define BUTTON3 6
#define BUTTON4 12
/* button, value */
#define IS_PRESSED(x, y) (y >> 4 == x)
int
main()
{
int values[]={25, 29, 55, 56, 106, 109, 194, 195, 0};
int i;
for(i=0; values[i]!=0; i++)
{
printf("is pressed %d? %d\n", BUTTON1, IS_PRESSED(BUTTON1, values[i]));
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment