I may be making an idiotic mistake here but please bear with me and i'll try to give as much info as possible
The short version is I can't figure out bitmasking
When called, a function called REG_KEYINPUT returns a value which by default is 0x3FF, the keys are defined as
KEY_A = (1<<0), /*!< keypad A button */
KEY_B = (1<<1), /*!< keypad B button */
when button A is pressed REG_KEYINPUT returns 0x3FE
when button B is pressed REG_KEYINPUT returns 0x3FD
when button A+B is pressed REG_KEYINPUT returns 0x3FC
nothing wrong there
The first case works because i've given it a value for A, but the second case doesn't work, probably becasue it's defined as being bit 1, what i'de like is to able to say is
case KEY_B: do something
but don't know how to do it without lots of if statements which isn't ideal.
I hope this makes some sense
That approach is less generic, as it requires that REG_KEYINPUT has to return something in its last 10 digits. The approach I gave you allows the returned bits to be anywhere (in REG_KEYINPUT).
As long as you don't need to handle multiple keys being depressed simultaneously, I don't see why you can't just define a const for the return value corresponding to each key pressed in isolation and put those in a switch statement, pretty much as you were doing.
If you want to handle multiple keys then I would use a loop, bitshift and bitmask to test whether each bit was set and call a function to handle that keypress; in that function you could use a switch (key number) to determine which of the buttons was being dealt with.