try using endianness conversion functions instead of icky macros

This commit is contained in:
Ryan Pavlik
2011-09-02 16:14:27 -05:00
parent 8216db96f6
commit 44612529a7
7 changed files with 73 additions and 39 deletions

View File

@@ -138,7 +138,7 @@ void classic_ctrl_event(struct classic_ctrl_t* cc, byte* msg) {
for (i = 0; i < 6; ++i)
msg[i] = (msg[i] ^ 0x17) + 0x17;
classic_ctrl_pressed_buttons(cc, BIG_ENDIAN_SHORT(*(short*)(msg + 4)));
classic_ctrl_pressed_buttons(cc, from_big_endian_uint16_t(msg + 4));
/* left/right buttons */
l = (((msg[2] & 0x60) >> 2) | ((msg[3] & 0xE0) >> 5));