Publish LumaOps source

This commit is contained in:
LumaOps release export
2026-09-03 01:18:36 +02:00
commit 7f1c0e5f71
2363 changed files with 501543 additions and 0 deletions
@@ -0,0 +1,354 @@
/*---------------------------------------------------------*\
| DasKeyboardController.cpp |
| |
| Driver for Das Keyboard keyboard |
| |
| Frank Niessen (denk_mal) 16 Dec 2020 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include <cstring>
#include "DasKeyboardController.h"
#include "StringUtils.h"
using namespace std::chrono_literals;
DasKeyboardController::DasKeyboardController(hid_device *dev_handle, const char *path, std::string dev_name)
{
dev = dev_handle;
location = path;
name = dev_name;
version = "";
useTraditionalSendData = false;
SendInitialize();
}
DasKeyboardController::~DasKeyboardController()
{
hid_close(dev);
}
std::string DasKeyboardController::GetLayoutString()
{
/*-----------------------------------------------------------*\
| Experimental for now; should be '16 or 63' for US and '28' |
| for EU layout |
\*-----------------------------------------------------------*/
if(version.length() < 17)
{
return("NONE");
}
std::string layout_id = version.substr(3, 2);
if(layout_id == "16" || layout_id == "63")
{
return("US");
}
return("EU");
}
std::string DasKeyboardController::GetLocationString()
{
return("HID: " + location);
}
std::string DasKeyboardController::GetNameString()
{
return(name);
}
std::string DasKeyboardController::GetSerialString()
{
wchar_t serial_string[128];
int ret = hid_get_serial_number_string(dev, serial_string, 128);
if(ret != 0)
{
return("");
}
return(StringUtils::wstring_to_string(serial_string));
}
std::string DasKeyboardController::GetVersionString()
{
if(version.length() < 17)
{
return(version);
}
std::string fw_version = "V";
fw_version += version.substr(6, 2);
fw_version += ".";
fw_version += version.substr(15, 2);
fw_version += ".0";
return(fw_version);
}
void DasKeyboardController::SendColors(unsigned char key_id, unsigned char mode,
unsigned char red, unsigned char green, unsigned char blue)
{
if(key_id < 130)
{
unsigned char usb_buf[] = {0xEA,
0x08,
0x78,
0x08,
static_cast<unsigned char>(key_id),
mode,
red,
green,
blue};
SendData(usb_buf, sizeof(usb_buf));
}
else
{
/*-----------------------------------------------------*\
| Special handling for the Q-Button; only color, no mode|
\*-----------------------------------------------------*/
unsigned char usb_buf[] = {0xEA,
0x06,
0x78,
0x06,
red,
green,
blue};
SendData(usb_buf, sizeof(usb_buf));
}
}
void DasKeyboardController::SendInitialize()
{
unsigned char usb_buf[65];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
int cnt_receive = 0;
while(!cnt_receive)
{
/*-----------------------------------------------------*\
| Set up Initialize connection |
\*-----------------------------------------------------*/
unsigned char usb_init[] = {0xEA, 0x02, 0xB0};
SendData(usb_init, sizeof(usb_init));
/*-----------------------------------------------------*\
| Get Version String |
\*-----------------------------------------------------*/
cnt_receive = ReceiveData(usb_buf, sizeof(usb_buf));
/*-----------------------------------------------------*\
| check if the faster modern transfer method is working |
\*-----------------------------------------------------*/
if(!cnt_receive)
{
if(useTraditionalSendData)
{
break;
}
useTraditionalSendData = true;
}
}
std::string fw_version(reinterpret_cast<char *>(&usb_buf[2]));
version = fw_version;
}
void DasKeyboardController::SendApply()
{
/*-----------------------------------------------------*\
| Set up Terminate Color packet |
\*-----------------------------------------------------*/
unsigned char usb_buf_send[] = {0xEA, 0x03, 0x78, 0x0a};
unsigned char usb_buf_receive[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
SendData(usb_buf_send, sizeof(usb_buf_send));
ReceiveData(usb_buf_receive, sizeof(usb_buf_receive));
}
void DasKeyboardController::SendData(const unsigned char *data, const unsigned int length)
{
if(useTraditionalSendData)
{
SendDataTraditional(data, length);
}
else
{
SendDataModern(data, length);
}
}
void DasKeyboardController::SendDataModern(const unsigned char *data, const unsigned int length)
{
/*-----------------------------------------------------*\
| modern SendData (send whole bytes in one transfer) |
\*-----------------------------------------------------*/
unsigned char usb_buf[65];
unsigned int err_cnt = 3;
int res = -1;
while(res == -1)
{
/*-----------------------------------------------------*\
| Fill data into send buffer |
\*-----------------------------------------------------*/
unsigned int chk_sum = 0;
usb_buf[0] = 1;
for(unsigned int idx = 0; idx < length; idx++)
{
usb_buf[idx + 1] = data[idx];
chk_sum ^= data[idx];
}
usb_buf[length + 1] = chk_sum;
res = hid_send_feature_report(dev, usb_buf, length + 2);
if(res == -1)
{
if(!err_cnt--)
{
return;
}
}
/*-----------------------------------------------------*\
| Hack to work around a firmware bug in v21.27.0 |
\*-----------------------------------------------------*/
std::this_thread::sleep_for(0.3ms);
}
}
void DasKeyboardController::SendDataTraditional(const unsigned char *data, const unsigned int length)
{
/*-----------------------------------------------------*\
| traditional SendData (split into chunks of 8 byte) |
\*-----------------------------------------------------*/
unsigned char usb_buf[9];
/*-----------------------------------------------------*\
| Fill data into send buffer |
\*-----------------------------------------------------*/
unsigned int err_cnt = 3;
unsigned int chk_sum = 0;
usb_buf[8] = 0;
for(unsigned int idx = 0; idx < length + 1; idx += 7)
{
usb_buf[0] = 1;
for(unsigned int fld_idx = 1; fld_idx < 8; fld_idx++)
{
unsigned int tmp_idx = idx + fld_idx - 1;
if(tmp_idx < length)
{
usb_buf[fld_idx] = data[tmp_idx];
chk_sum ^= data[tmp_idx];
}
else if(tmp_idx == length)
{
usb_buf[fld_idx] = chk_sum;
}
else
{
usb_buf[fld_idx] = 0;
}
}
int res = hid_send_feature_report(dev, usb_buf, 8);
if(res == -1)
{
idx = 0;
if(!err_cnt--)
{
return;
}
}
/*-----------------------------------------------------*\
| Hack to work around a firmware bug in v21.27.0 |
\*-----------------------------------------------------*/
std::this_thread::sleep_for(0.3ms);
}
}
int DasKeyboardController::ReceiveData(unsigned char *data, const unsigned int max_length)
{
unsigned char usb_buf[9];
std::vector<unsigned char> receive_buf;
/*-----------------------------------------------------*\
| Fill data from receive buffer |
\*-----------------------------------------------------*/
unsigned int chk_sum = 0;
do
{
memset(usb_buf, 0x00, sizeof(usb_buf));
usb_buf[0x00] = 0x01;
int res = hid_get_feature_report(dev, usb_buf, 8);
if(res == -1)
{
break;
}
if(usb_buf[0])
{
for(unsigned int ii = 0; ii < 8; ii++)
{
receive_buf.push_back(usb_buf[ii]);
chk_sum ^= usb_buf[ii];
}
}
} while(usb_buf[0]);
/*-----------------------------------------------------*\
| clean up data buffer |
\*-----------------------------------------------------*/
for(unsigned int ii = 0; ii < max_length; ii++)
{
data[ii] = 0;
}
/*-----------------------------------------------------*\
| If checksum is not correct, return with empty buffer |
\*-----------------------------------------------------*/
if(chk_sum)
{
return(-1);
}
unsigned int response_size = 0;
if(receive_buf.size() > 1)
{
response_size = receive_buf.at(1);
if(response_size + 2 > receive_buf.size())
{
return(-1);
}
if(response_size > max_length)
{
response_size = max_length;
}
/*-----------------------------------------------------*\
| Remove first two bytes (signature?) and content length|
\*-----------------------------------------------------*/
for(unsigned int ii = 0; ii < response_size - 1; ii++)
{
data[ii] = receive_buf.at(ii + 2);
}
}
return(response_size);
}
@@ -0,0 +1,51 @@
/*---------------------------------------------------------*\
| DasKeyboardController.h |
| |
| Driver for Das Keyboard keyboard |
| |
| Frank Niessen (denk_mal) 16 Dec 2020 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#pragma once
#include <string>
#include <hidapi.h>
#include "RGBController.h"
class DasKeyboardController
{
public:
DasKeyboardController(hid_device *dev_handle, const char *path, std::string dev_name);
~DasKeyboardController();
std::string GetLayoutString();
std::string GetLocationString();
std::string GetNameString();
std::string GetSerialString();
std::string GetVersionString();
void SendColors(unsigned char key_id, unsigned char mode, unsigned char red, unsigned char green, unsigned char blue);
void SendApply();
private:
hid_device *dev;
std::string location;
std::string name;
std::string version;
bool useTraditionalSendData;
void SendInitialize();
void SendData(const unsigned char *data, unsigned int length);
void SendDataTraditional(const unsigned char *data, unsigned int length);
void SendDataModern(const unsigned char *data, unsigned int length);
int ReceiveData(unsigned char *data, unsigned int max_length);
};
@@ -0,0 +1,61 @@
/*---------------------------------------------------------*\
| DasKeyboardControllerDetect.cpp |
| |
| Detector for Das Keyboard keyboard |
| |
| Frank Niessen (denk_mal) 16 Dec 2020 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include "Detector.h"
#include "DasKeyboardController.h"
#include "RGBController_DasKeyboard.h"
#include <hidapi.h>
/*-----------------------------------------------------*\
| Das Keyboard vendor ID |
\*-----------------------------------------------------*/
#define DAS_KEYBOARD_VID 0x24F0
/*-----------------------------------------------------*\
| Keyboard product IDs |
\*-----------------------------------------------------*/
#define DAS_KEYBOARD_Q4_PID 0x2037
#define DAS_KEYBOARD_Q5_PID 0x2020
#define DAS_KEYBOARD_Q5S_PID 0x209A
/******************************************************************************************\
* *
* DetectDasKeyboardControllers *
* *
* Tests the USB address to see if a Das Keyboard RGB controller exists there. *
* We need the second interface to communicate with the keyboard *
* *
\******************************************************************************************/
void DetectDasKeyboardControllers(hid_device_info *info, const std::string &name)
{
hid_device *dev = hid_open_path(info->path);
if(dev)
{
DasKeyboardController *controller = new DasKeyboardController(dev, info->path, name);
if(controller->GetLayoutString() == "NONE")
{
delete controller;
}
else
{
RGBController_DasKeyboard *rgb_controller = new RGBController_DasKeyboard(controller);
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
}
} /* DetectDasKeyboardControllers() */
REGISTER_HID_DETECTOR_IPU("Das Keyboard Q4 RGB", DetectDasKeyboardControllers, DAS_KEYBOARD_VID, DAS_KEYBOARD_Q4_PID, 1, 0x01, 0x80);
REGISTER_HID_DETECTOR_I ("Das Keyboard Q5 RGB", DetectDasKeyboardControllers, DAS_KEYBOARD_VID, DAS_KEYBOARD_Q5_PID, 1);
REGISTER_HID_DETECTOR_I ("Das Keyboard Q5S RGB", DetectDasKeyboardControllers, DAS_KEYBOARD_VID, DAS_KEYBOARD_Q5S_PID, 1);
@@ -0,0 +1,357 @@
/*---------------------------------------------------------*\
| RGBController_DasKeyboard.cpp |
| |
| RGBController for Das Keyboard keyboard |
| |
| Frank Niessen (denk_mal) 16 Dec 2020 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include "RGBControllerKeyNames.h"
#include "RGBController_DasKeyboard.h"
using namespace std::chrono_literals;
//0xFFFFFFFF indicates an unused entry in matrix
#define NA 0xFFFFFFFF
// US Layout
static unsigned int matrix_map_us[7][21] =
{
{NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA},
{ 5, NA, 17, 23, 29, 35, 41, 47, 53, 59, 65, 71, 77, 83, 89, 95, 101, 127, 128, 129, 130},
{ 4, 10, 16, 22, 28, 34, 40, 46, 52, 58, 64, 70, 76, 82, 88, 94, 100, 106, 112, 118, 124},
{ 3, 9, 15, 21, 27, 33, 39, 45, 51, 57, 63, 69, 75, 7, 87, 93, 99, 105, 111, 117, 123},
{ 2, 8, 14, 20, 26, 32, 38, 44, 50, 56, 62, 68, NA, 80, NA, NA, NA, 104, 110, 116, NA},
{ 1, NA, 13, 19, 25, 31, 37, 43, 49, 55, 61, 67, 79, NA, NA, 91, NA, 103, 109, 115, 122},
{ 0, 6, 12, NA, NA, NA, 36, NA, NA, NA, 60, 66, 72, 78, 84, 90, 96, 102, NA, 114, NA}
};
// EU Layout
static unsigned int matrix_map_eu[7][21] =
{
{NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 126, NA, NA, NA},
{ 5, NA, 17, 23, 29, 35, 41, 47, 53, 59, 65, 71, 77, 83, 89, 95, 101, 127, 128, 129, 130},
{ 4, 10, 16, 22, 28, 34, 40, 46, 52, 58, 64, 70, 76, 82, 88, 94, 100, 106, 112, 118, 124},
{ 3, 9, 15, 21, 27, 33, 39, 45, 51, 57, 63, 69, 75, NA, 87, 93, 99, 105, 111, 117, 123},
{ 2, 8, 14, 20, 26, 32, 38, 44, 50, 56, 62, 68, 81, 80, NA, NA, NA, 104, 110, 116, NA},
{ 1, 7, 13, 19, 25, 31, 37, 43, 49, 55, 61, 67, 79, NA, NA, 91, NA, 103, 109, 115, 122},
{ 0, 6, 12, NA, NA, NA, 36, NA, NA, NA, 60, 66, 72, 78, 84, 90, 96, 102, NA, 114, NA}
};
static const char *zone_names[] =
{
ZONE_EN_KEYBOARD
};
static zone_type zone_types[] =
{
ZONE_TYPE_MATRIX,
};
static const unsigned int zone_sizes[] =
{
131
};
// UK Layout
static const char *led_names[] =
{
KEY_EN_LEFT_CONTROL,
KEY_EN_LEFT_SHIFT,
KEY_EN_CAPS_LOCK,
KEY_EN_TAB,
KEY_EN_BACK_TICK,
KEY_EN_ESCAPE,
KEY_EN_LEFT_WINDOWS,
KEY_EN_ANSI_BACK_SLASH,
KEY_EN_A,
KEY_EN_Q,
KEY_EN_1,
KEY_EN_UNUSED,
KEY_EN_LEFT_ALT,
KEY_EN_Z,
KEY_EN_S,
KEY_EN_W,
KEY_EN_2,
KEY_EN_F1,
KEY_EN_UNUSED,
KEY_EN_X,
KEY_EN_D,
KEY_EN_E,
KEY_EN_3,
KEY_EN_F2,
KEY_EN_UNUSED,
KEY_EN_C,
KEY_EN_F,
KEY_EN_R,
KEY_EN_4,
KEY_EN_F3,
KEY_EN_UNUSED,
KEY_EN_V,
KEY_EN_G,
KEY_EN_T,
KEY_EN_5,
KEY_EN_F4,
KEY_EN_SPACE,
KEY_EN_B,
KEY_EN_H,
KEY_EN_Y,
KEY_EN_6,
KEY_EN_F5,
KEY_EN_UNUSED,
KEY_EN_N,
KEY_EN_J,
KEY_EN_U,
KEY_EN_7,
KEY_EN_F6,
KEY_EN_UNUSED,
KEY_EN_M,
KEY_EN_K,
KEY_EN_I,
KEY_EN_8,
KEY_EN_F7,
KEY_EN_UNUSED,
KEY_EN_COMMA,
KEY_EN_L,
KEY_EN_O,
KEY_EN_9,
KEY_EN_F8,
KEY_EN_RIGHT_ALT,
KEY_EN_PERIOD,
KEY_EN_SEMICOLON,
KEY_EN_P,
KEY_EN_0,
KEY_EN_F9,
KEY_EN_RIGHT_WINDOWS,
KEY_EN_FORWARD_SLASH,
KEY_EN_QUOTE,
KEY_EN_LEFT_BRACKET,
KEY_EN_MINUS,
KEY_EN_F10,
KEY_EN_MENU,
KEY_EN_UNUSED,
KEY_EN_UNUSED,
KEY_EN_RIGHT_BRACKET,
KEY_EN_EQUALS,
KEY_EN_F11,
KEY_EN_RIGHT_CONTROL,
KEY_EN_RIGHT_SHIFT,
KEY_EN_ANSI_ENTER,
KEY_EN_POUND,
KEY_EN_BACKSPACE,
KEY_EN_F12,
KEY_EN_LEFT_ARROW,
KEY_EN_UNUSED,
KEY_EN_UNUSED,
KEY_EN_DELETE,
KEY_EN_INSERT,
KEY_EN_PRINT_SCREEN,
KEY_EN_DOWN_ARROW,
KEY_EN_UP_ARROW,
KEY_EN_UNUSED,
KEY_EN_END,
KEY_EN_HOME,
KEY_EN_SCROLL_LOCK,
KEY_EN_RIGHT_ARROW,
KEY_EN_UNUSED,
KEY_EN_UNUSED,
KEY_EN_PAGE_DOWN,
KEY_EN_PAGE_UP,
KEY_EN_PAUSE_BREAK,
KEY_EN_NUMPAD_0,
KEY_EN_NUMPAD_1,
KEY_EN_NUMPAD_4,
KEY_EN_NUMPAD_7,
KEY_EN_NUMPAD_LOCK,
KEY_EN_UNUSED,
KEY_EN_UNUSED,
KEY_EN_NUMPAD_2,
KEY_EN_NUMPAD_5,
KEY_EN_NUMPAD_8,
KEY_EN_NUMPAD_DIVIDE,
KEY_EN_UNUSED,
KEY_EN_NUMPAD_PERIOD,
KEY_EN_NUMPAD_3,
KEY_EN_NUMPAD_6,
KEY_EN_NUMPAD_9,
KEY_EN_NUMPAD_TIMES,
KEY_EN_UNUSED,
KEY_EN_UNUSED,
KEY_EN_UNUSED,
KEY_EN_NUMPAD_ENTER,
KEY_EN_NUMPAD_PLUS,
KEY_EN_NUMPAD_MINUS,
KEY_EN_UNUSED,
"Key: Sleep",
"Key: Brightness",
KEY_EN_MEDIA_PLAY_PAUSE,
KEY_EN_MEDIA_NEXT,
"Key: Q-Button"
};
/**------------------------------------------------------------------*\
@name Das Keyboard
@category Keyboard
@type USB
@save :x:
@direct :white_check_mark:
@effects :white_check_mark:
@detectors DetectDasKeyboardControllers,DetectDas4QKeyboard
@comment
\*-------------------------------------------------------------------*/
RGBController_DasKeyboard::RGBController_DasKeyboard(DasKeyboardController* controller_ptr)
{
controller = controller_ptr;
for(unsigned int ii = 0; ii < zone_sizes[0]; ii++)
{
double_buffer.push_back(-1);
}
updateDevice = true;
name = controller->GetNameString();
vendor = "Metadot";
type = DEVICE_TYPE_KEYBOARD;
description = "Das Keyboard Device";
location = controller->GetLocationString();
serial = controller->GetSerialString();
version = controller->GetVersionString();
modes.resize(4);
modes[0].name = "Direct";
modes[0].value = DAS_KEYBOARD_MODE_DIRECT;
modes[0].flags = MODE_FLAG_HAS_PER_LED_COLOR;
modes[0].color_mode = MODE_COLORS_PER_LED;
modes[1].name = "Flashing";
modes[1].value = DAS_KEYBOARD_MODE_FLASHING;
modes[1].flags = MODE_FLAG_HAS_PER_LED_COLOR;
modes[1].color_mode = MODE_COLORS_PER_LED;
modes[2].name = "Breathing";
modes[2].value = DAS_KEYBOARD_MODE_BREATHING;
modes[2].flags = MODE_FLAG_HAS_PER_LED_COLOR;
modes[2].color_mode = MODE_COLORS_PER_LED;
modes[3].name = "Spectrum Cycle";
modes[3].value = DAS_KEYBOARD_MODE_SPECTRUM_CYCLE;
modes[3].flags = MODE_FLAG_HAS_PER_LED_COLOR;
modes[3].color_mode = MODE_COLORS_PER_LED;
SetupZones();
}
RGBController_DasKeyboard::~RGBController_DasKeyboard()
{
/*---------------------------------------------------------*\
| Delete the matrix map |
\*---------------------------------------------------------*/
unsigned int zone_size = (unsigned int)zones.size();
for(unsigned int zone_index = 0; zone_index < zone_size; zone_index++)
{
delete zones[zone_index].matrix_map;
}
delete controller;
}
void RGBController_DasKeyboard::SetupZones()
{
/*---------------------------------------------------------*\
| Set up zones |
\*---------------------------------------------------------*/
unsigned int total_led_count = 0;
for(unsigned int zone_idx = 0; zone_idx < 1; zone_idx++)
{
zone new_zone;
new_zone.name = zone_names[zone_idx];
new_zone.type = zone_types[zone_idx];
new_zone.leds_min = zone_sizes[zone_idx];
new_zone.leds_max = zone_sizes[zone_idx];
new_zone.leds_count = zone_sizes[zone_idx];
new_zone.matrix_map = new matrix_map_type;
new_zone.matrix_map->height = 7;
new_zone.matrix_map->width = 21;
if(controller->GetLayoutString() == "US")
{
new_zone.matrix_map->map = (unsigned int *) &matrix_map_us;
}
else
{
new_zone.matrix_map->map = (unsigned int *) &matrix_map_eu;
}
zones.push_back(new_zone);
total_led_count += zone_sizes[zone_idx];
}
for(unsigned int led_idx = 0; led_idx < total_led_count; led_idx++)
{
led new_led;
new_led.name = led_names[led_idx];
leds.push_back(new_led);
}
SetupColors();
}
void RGBController_DasKeyboard::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_DasKeyboard::DeviceUpdateLEDs()
{
UpdateZoneLEDs(0);
}
void RGBController_DasKeyboard::UpdateZoneLEDs(int /*zone*/)
{
updateDevice = false;
for(unsigned int led_idx = 0; led_idx < leds.size(); led_idx++)
{
UpdateSingleLED(static_cast<int>(led_idx));
}
updateDevice = true;
controller->SendApply();
}
void RGBController_DasKeyboard::UpdateSingleLED(int led)
{
mode selected_mode = modes[active_mode];
if(double_buffer[led] == colors[led])
{
return;
}
controller->SendColors(led, selected_mode.value,
RGBGetRValue(colors[led]),
RGBGetGValue(colors[led]),
RGBGetBValue(colors[led]));
double_buffer[led] = colors[led];
if(updateDevice)
{
controller->SendApply();
}
}
void RGBController_DasKeyboard::DeviceUpdateMode()
{
}
@@ -0,0 +1,45 @@
/*---------------------------------------------------------*\
| RGBController_DasKeyboard.h |
| |
| RGBController for Das Keyboard keyboard |
| |
| Frank Niessen (denk_mal) 16 Dec 2020 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#pragma once
#include "RGBController.h"
#include "DasKeyboardController.h"
enum
{
DAS_KEYBOARD_MODE_DIRECT = 0x01,
DAS_KEYBOARD_MODE_FLASHING = 0x1F,
DAS_KEYBOARD_MODE_BREATHING = 0x08,
DAS_KEYBOARD_MODE_SPECTRUM_CYCLE = 0x14
};
class RGBController_DasKeyboard : public RGBController
{
public:
RGBController_DasKeyboard(DasKeyboardController* controller_ptr);
~RGBController_DasKeyboard();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void DeviceUpdateMode();
private:
DasKeyboardController* controller;
std::vector<RGBColor> double_buffer;
bool updateDevice;
};