VulcanoLE/headers/VulcanoLE/Keyboards/Vulcan121.h

52 lines
1.4 KiB
C++

#pragma once
#include <VulcanoLE/API/HIDHelper.h>
#include <VulcanoLE/Colors/Type.h>
#define NUM_KEYS 144
#define NUM_ROWS 6
#define NUM_COLS 21
typedef struct subArray {
int count = 0;
int *index = nullptr; // will init in code! and returned
} keys;
typedef struct led_map_type {
rgba key[NUM_KEYS];
} led_map;
class Vulcan121 {
public:
explicit Vulcan121(HIDHelper *helper);
~Vulcan121();
int sendLedMap(led_map *src, bool deleteMap = false);
int sendToLEDs(rgba rgb);
bool sendInitSequence();
bool queryCtrlReport(unsigned char id);
bool sendCtrlReport(unsigned char id);
bool waitForCtrlDev();
static led_map *createEmptyLEDMap();
struct DATA {
int num_rows = NUM_ROWS;
int num_cols = NUM_COLS;
int num_keys = 144;
};
int getColumnsForRow(int row);
int getRowsForColumns(int col);
const keys * getColumn(int col);
const keys * getRow(int row);
int getIndex(int row, int col);
// PLEASE MAKE SURE YOU KNOW THE LIMITS!
int getIndexNoCheck(int row, int col);
static void fadeOutMap(led_map* map, double factor);
protected:
void setupMap();
// we need some mapping feature! rows and cols dont have the same amount of keys. so the struct needs
HIDHelper *m_helper;
rgba *m_fixed[NUM_KEYS]{};
rgba m_colorOff = { 0x0000, 0x0000, 0x0000 };
keys *keyMapRow[NUM_ROWS];
keys *keyMapCol[NUM_COLS]; // need to find out the count!
};