From b1aa9b030da6791a37aaa034a540ed5dd222648b Mon Sep 17 00:00:00 2001 From: NicoHood Date: Sun, 11 Oct 2015 10:42:51 +0200 Subject: [PATCH] Fixed Consumer warning --- src/HID-APIs/ConsumerAPI.h | 1 + src/HID-APIs/ConsumerAPI.hpp | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/HID-APIs/ConsumerAPI.h b/src/HID-APIs/ConsumerAPI.h index a71b2c5..50c6a5b 100644 --- a/src/HID-APIs/ConsumerAPI.h +++ b/src/HID-APIs/ConsumerAPI.h @@ -63,6 +63,7 @@ typedef union { uint8_t whole8[]; uint16_t whole16[]; uint32_t whole32[]; + uint16_t keys[4]; struct { uint16_t key1; uint16_t key2; diff --git a/src/HID-APIs/ConsumerAPI.hpp b/src/HID-APIs/ConsumerAPI.hpp index 55cd864..42f0282 100644 --- a/src/HID-APIs/ConsumerAPI.hpp +++ b/src/HID-APIs/ConsumerAPI.hpp @@ -47,8 +47,8 @@ void ConsumerAPI::write(uint16_t m) { void ConsumerAPI::press(uint16_t m) { // search for a free spot for (uint8_t i = 0; i < sizeof(HID_ConsumerControlReport_Data_t) / 2; i++) { - if (_report.whole16[i] == 0x00) { - _report.whole16[i] = m; + if (_report.keys[i] == 0x00) { + _report.keys[i] = m; break; } } @@ -58,8 +58,8 @@ void ConsumerAPI::press(uint16_t m) { void ConsumerAPI::release(uint16_t m) { // search and release the keypress for (uint8_t i = 0; i < sizeof(HID_ConsumerControlReport_Data_t) / 2; i++) { - if (_report.whole16[i] == m) { - _report.whole16[i] = 0x00; + if (_report.keys[i] == m) { + _report.keys[i] = 0x00; // no break to delete multiple keys } }