From 9b44357d044f13f29bd2e21a02cb74d21a3a40e0 Mon Sep 17 00:00:00 2001 From: Kristian Lauszus Date: Sun, 16 Feb 2014 01:24:38 +0100 Subject: [PATCH] Added packed attribute to all structs in PS4Parser.h. This was needed for Teensy 3.x It was actually only necessary for finger in touchpadXY, but I added to all structs to prevent similar compile errors for future architectures --- PS4Parser.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/PS4Parser.h b/PS4Parser.h index cedbc0b4..1fe8ab2a 100644 --- a/PS4Parser.h +++ b/PS4Parser.h @@ -67,7 +67,7 @@ union PS4Buttons { uint8_t ps : 1; uint8_t touchpad : 1; uint8_t reportCounter : 6; - }; + } __attribute__((packed)); uint8_t val[3]; }; @@ -78,8 +78,8 @@ struct touchpadXY { uint8_t touching : 1; // The top bit is cleared if the finger is touching the touchpad uint16_t x : 12; uint16_t y : 12; - } finger[2]; // 0 = first finger, 1 = second finger -}; + } __attribute__((packed)) finger[2]; // 0 = first finger, 1 = second finger +} __attribute__((packed)); struct PS4Data { /* Button and joystick values */ @@ -100,7 +100,7 @@ struct PS4Data { // Note that if you read fast enough from the device, then only the first one will contain any data. // The last three bytes are always: 0x00, 0x80, 0x00 -}; +} __attribute__((packed)); enum DPADEnum { DPAD_UP = 0x0,