1
0
mirror of https://github.com/MatMoul/g810-led.git synced 2026-01-06 12:56:58 +00:00

Multiple changes of datatypes being past overflowing constants (most char needed to be changed to unsigned char or uint8_t). Also changed the include style of the <libusb.h> to be controlled through the makefile setting

This commit is contained in:
Charles
2016-12-12 14:06:45 -06:00
parent ecef158d35
commit 54897d9a5a
3 changed files with 45 additions and 33 deletions

View File

@@ -2,7 +2,7 @@
#define DEF_KEYBOARD
#include <iostream>
#include "/usr/include/libusb-1.0/libusb.h"
#include <libusb.h>
class Keyboard {
@@ -32,8 +32,8 @@ class Keyboard {
};
enum class KeyGroup { logo, indicators, multimedia, fkeys, modifiers, arrows, numeric, functions, keys, gkeys};
struct KeyColors { char red; char green; char blue; };
struct KeyAddress { KeyAddressGroup addressGroup; char id; };
struct KeyColors { uint8_t red; uint8_t green; uint8_t blue; };
struct KeyAddress { KeyAddressGroup addressGroup; uint8_t id; };
struct KeyValue { KeyAddress key; KeyColors colors; };
bool isAttached();
@@ -48,7 +48,7 @@ class Keyboard {
bool setPowerOnEffect(PowerOnEffect powerOnEffect);
bool setKey(KeyValue keyValue);
bool setKey(Key key, KeyColors colors);
bool setKeys(KeyValue keyValue[], int keyValueCount);
bool setKeys(KeyValue keyValue[], size_t keyValueCount);
bool setAllKeys(KeyColors colors);
bool setGroupKeys(KeyGroup keyGroup, KeyColors colors);
@@ -63,8 +63,8 @@ class Keyboard {
libusb_context *ctx = NULL;
bool populateAddressGroupInternal(KeyAddressGroup addressGroup, unsigned char *data);
bool sendDataInternal(unsigned char *data, int data_size);
bool setKeysInternal(KeyAddressGroup addressGroup, KeyValue keyValues[], int keyValueCount);
bool sendDataInternal(unsigned char *data, uint16_t data_size);
bool setKeysInternal(KeyAddressGroup addressGroup, KeyValue keyValues[], size_t keyValueCount);
};