Continued the work started by !62 with respect to adding support for Cooler Master keyboards using the libcmmk library.
Commits squashed and amended for code style by Adam Honse <calcprogrammer1@gmail.com>
This commit is contained in:
parent
7e4b9c0cb0
commit
7952a035b5
22 changed files with 2403 additions and 440 deletions
3
.gitmodules
vendored
3
.gitmodules
vendored
|
|
@ -1,6 +1,3 @@
|
|||
[submodule "razer-drivers-win32"]
|
||||
path = razer-drivers-win32
|
||||
url = https://github.com/rsandoz/razer-drivers-win32
|
||||
[submodule "dependencies/libcmmk"]
|
||||
path = dependencies/libcmmk
|
||||
url = https://github.com/chmod222/libcmmk.git
|
||||
|
|
|
|||
|
|
@ -4,34 +4,33 @@
|
|||
| Driver for Coolermaster MasterKeys Keyboards |
|
||||
| |
|
||||
| Lukas N (chmod222) 28th Jun 2020 |
|
||||
| Tam D (too.manyhobbies) 25th Apr 2021 |
|
||||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#include "CMMKController.h"
|
||||
|
||||
#include <locale>
|
||||
#include <codecvt>
|
||||
|
||||
CMMKController::CMMKController(hid_device_info* _dev_info, wchar_t *_vendor, wchar_t *_device_name, char *_path)
|
||||
CMMKController::CMMKController(hid_device* dev, hid_device_info* dev_info)
|
||||
{
|
||||
std::wstring tmp_vendor_str = _vendor;
|
||||
std::wstring tmp_device_str = _device_name;
|
||||
location = dev_info->path;
|
||||
|
||||
std::wstring full_name = _vendor + std::wstring{L" "} + _device_name;
|
||||
const int szTemp = 256;
|
||||
wchar_t tmpName[szTemp];
|
||||
|
||||
std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t> converter;
|
||||
hid_get_manufacturer_string(dev, tmpName, szTemp);
|
||||
std::wstring wName = std::wstring(tmpName);
|
||||
device_name = std::string(wName.begin(), wName.end());
|
||||
|
||||
device_name = converter.to_bytes(full_name);
|
||||
hid_get_product_string(dev, tmpName, szTemp);
|
||||
wName = std::wstring(tmpName);
|
||||
device_name.append(" ").append(std::string(wName.begin(), wName.end()));
|
||||
|
||||
cmmk_attach_path(&cmmk_handle, _dev_info->path, _dev_info->product_id, -1);
|
||||
cmmk_attach_path(&cmmk_handle, dev_info->path, dev_info->product_id, -1);
|
||||
|
||||
char buf[32] = {0};
|
||||
|
||||
cmmk_get_firmware_version(&cmmk_handle, buf, 32);
|
||||
|
||||
firmware_version = buf;
|
||||
|
||||
location = _path;
|
||||
}
|
||||
|
||||
CMMKController::~CMMKController()
|
||||
|
|
@ -39,17 +38,17 @@ CMMKController::~CMMKController()
|
|||
cmmk_detach(&cmmk_handle);
|
||||
}
|
||||
|
||||
std::string CMMKController::GetDeviceName() const
|
||||
std::string CMMKController::GetDeviceName()
|
||||
{
|
||||
return device_name;
|
||||
}
|
||||
|
||||
std::string CMMKController::GetLocation() const
|
||||
std::string CMMKController::GetLocation()
|
||||
{
|
||||
return location;
|
||||
}
|
||||
|
||||
std::string CMMKController::GetFirmwareVersion() const
|
||||
std::string CMMKController::GetFirmwareVersion()
|
||||
{
|
||||
return firmware_version;
|
||||
}
|
||||
|
|
@ -133,14 +132,21 @@ void CMMKController::SetMode(cmmk_effect_stars eff)
|
|||
cmmk_set_effect_stars(&cmmk_handle, &eff);
|
||||
}
|
||||
|
||||
bool CMMKController::PositionValid(int y, int x) const
|
||||
void CMMKController::SetMode(cmmk_effect_snake eff)
|
||||
{
|
||||
return cmmk_lookup_key_id(&cmmk_handle, y, x) >= 0;
|
||||
ActivateEffect(CMMK_EFFECT_SNAKE);
|
||||
cmmk_set_effect_snake(&cmmk_handle, &eff);
|
||||
}
|
||||
|
||||
bool CMMKController::PositionValid(int y, int x)
|
||||
{
|
||||
return(cmmk_lookup_key_id(&cmmk_handle, y, x) >= 0);
|
||||
}
|
||||
|
||||
void CMMKController::ActivateMode(int mode)
|
||||
{
|
||||
if (current_mode != mode) {
|
||||
if (current_mode != mode)
|
||||
{
|
||||
cmmk_set_control_mode(&cmmk_handle, mode);
|
||||
|
||||
current_mode = mode;
|
||||
|
|
@ -152,9 +158,10 @@ void CMMKController::ActivateEffect(int effect)
|
|||
{
|
||||
ActivateMode(CMMK_EFFECT);
|
||||
|
||||
if (current_effect != effect) {
|
||||
if (current_effect != effect)
|
||||
{
|
||||
cmmk_set_active_effect(&cmmk_handle, (enum cmmk_effect_id)effect);
|
||||
|
||||
current_effect = effect;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,10 +8,7 @@
|
|||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#include <string>
|
||||
#include <array>
|
||||
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
#include <libcmmk/libcmmk.h>
|
||||
|
||||
#pragma once
|
||||
|
|
@ -19,12 +16,12 @@
|
|||
class CMMKController
|
||||
{
|
||||
public:
|
||||
CMMKController(hid_device_info* _dev_info, wchar_t *_vendor, wchar_t *_device_name, char *_path);
|
||||
virtual ~CMMKController();
|
||||
CMMKController(hid_device* dev_handle, hid_device_info* dev_info);
|
||||
~CMMKController();
|
||||
|
||||
std::string GetDeviceName() const;
|
||||
std::string GetLocation() const;
|
||||
std::string GetFirmwareVersion() const;
|
||||
std::string GetDeviceName();
|
||||
std::string GetLocation();
|
||||
std::string GetFirmwareVersion();
|
||||
|
||||
void SetFirmwareControl();
|
||||
void SetManualControl();
|
||||
|
|
@ -42,15 +39,16 @@ public:
|
|||
void SetMode(cmmk_effect_cross eff);
|
||||
void SetMode(cmmk_effect_raindrops eff);
|
||||
void SetMode(cmmk_effect_stars eff);
|
||||
void SetMode(cmmk_effect_snake eff);
|
||||
|
||||
bool PositionValid(int y, int x) const;
|
||||
bool PositionValid(int y, int x);
|
||||
|
||||
private:
|
||||
void ActivateMode(int mode);
|
||||
void ActivateEffect(int effect);
|
||||
|
||||
int current_mode = -1;
|
||||
int current_effect = -1;
|
||||
int current_mode = -1;
|
||||
int current_effect = -1;
|
||||
|
||||
std::string device_name;
|
||||
std::string location;
|
||||
|
|
|
|||
|
|
@ -3,20 +3,28 @@
|
|||
#include "CMARGBcontroller.h"
|
||||
#include "CMSmallARGBController.h"
|
||||
#include "CMR6000Controller.h"
|
||||
#include "CMMKController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_CMMP750Controller.h"
|
||||
#include "RGBController_CMARGBController.h"
|
||||
#include "RGBController_CMSmallARGBController.h"
|
||||
#include "RGBController_CMR6000Controller.h"
|
||||
#include "RGBController_CMMKController.h"
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
#define COOLERMASTER_VID 0x2516
|
||||
|
||||
#define COOLERMASTER_MP750_XL_PID 0x0109
|
||||
#define COOLERMASTER_MP750_MEDIUM_PID 0x0105
|
||||
#define COOLERMASTER_ARGB_PID 0x1011
|
||||
#define COOLERMASTER_SMALL_ARGB_PID 0x1000
|
||||
#define COOLERMASTER_RADEON_6000_PID 0x014D
|
||||
#define COOLERMASTER_MP750_XL_PID 0x0109
|
||||
#define COOLERMASTER_MP750_MEDIUM_PID 0x0105
|
||||
#define COOLERMASTER_ARGB_PID 0x1011
|
||||
#define COOLERMASTER_SMALL_ARGB_PID 0x1000
|
||||
#define COOLERMASTER_RADEON_6000_PID 0x014D
|
||||
#define COOLERMASTER_MASTERKEYS_PRO_L_PID CMMK_USB_MASTERKEYS_MK750
|
||||
#define COOLERMASTER_MASTERKEYS_PRO_L_WHITE_PID CMMK_USB_MASTERKEYS_PRO_L_WHITE
|
||||
#define COOLERMASTER_MASTERKEYS_PRO_S_PID CMMK_USB_MASTERKEYS_PRO_S
|
||||
#define COOLERMASTER_MASTERKEYS_MK750_PID CMMK_USB_MASTERKEYS_MK750
|
||||
#define COOLERMASTER_MASTERKEYS_SK630_PID CMMK_USB_MASTERKEYS_SK630
|
||||
#define COOLERMASTER_MASTERKEYS_SK650_PID CMMK_USB_MASTERKEYS_SK650
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
|
|
@ -77,8 +85,27 @@ void DetectCoolerMasterGPU(hid_device_info* info, const std::string&)
|
|||
}
|
||||
}
|
||||
|
||||
REGISTER_HID_DETECTOR_PU ("Cooler Master MP750 XL", DetectCoolerMasterMousemats, COOLERMASTER_VID, COOLERMASTER_MP750_XL_PID, 0xFF00, 1);
|
||||
REGISTER_HID_DETECTOR_PU ("Cooler Master MP750 Medium", DetectCoolerMasterMousemats, COOLERMASTER_VID, COOLERMASTER_MP750_MEDIUM_PID, 0xFF00, 1);
|
||||
REGISTER_HID_DETECTOR_IPU("Cooler Master ARGB", DetectCoolerMasterARGB, COOLERMASTER_VID, COOLERMASTER_ARGB_PID, 0, 0xFF00, 1);
|
||||
REGISTER_HID_DETECTOR_IPU("Cooler Master Smalll ARGB", DetectCoolerMasterSmallARGB, COOLERMASTER_VID, COOLERMASTER_SMALL_ARGB_PID, 0, 0xFF00, 1);
|
||||
REGISTER_HID_DETECTOR_I ("Cooler Master Radeon 6000 GPU", DetectCoolerMasterGPU, COOLERMASTER_VID, COOLERMASTER_RADEON_6000_PID, 1);
|
||||
void DetectCoolerMasterKeyboards(hid_device_info* info, const std::string&)
|
||||
{
|
||||
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
if(dev)
|
||||
{
|
||||
CMMKController* controller = new CMMKController(dev, info);
|
||||
RGBController_CMMKController* rgb_controller = new RGBController_CMMKController(controller);
|
||||
// Constructor sets the name
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
||||
REGISTER_HID_DETECTOR_PU ("Cooler Master MP750 XL", DetectCoolerMasterMousemats, COOLERMASTER_VID, COOLERMASTER_MP750_XL_PID, 0xFF00, 1 );
|
||||
REGISTER_HID_DETECTOR_PU ("Cooler Master MP750 Medium", DetectCoolerMasterMousemats, COOLERMASTER_VID, COOLERMASTER_MP750_MEDIUM_PID, 0xFF00, 1 );
|
||||
REGISTER_HID_DETECTOR_IPU("Cooler Master MasterKeys Pro L", DetectCoolerMasterKeyboards, COOLERMASTER_VID, COOLERMASTER_MASTERKEYS_PRO_L_PID, 1, 0xFF00, 1);
|
||||
REGISTER_HID_DETECTOR_IPU("Cooler Master MasterKeys Pro L White", DetectCoolerMasterKeyboards, COOLERMASTER_VID, COOLERMASTER_MASTERKEYS_PRO_L_WHITE_PID, 1, 0xFF00, 1);
|
||||
REGISTER_HID_DETECTOR_IPU("Cooler Master MasterKeys Pro S", DetectCoolerMasterKeyboards, COOLERMASTER_VID, COOLERMASTER_MASTERKEYS_PRO_S_PID, 1, 0xFF00, 1);
|
||||
REGISTER_HID_DETECTOR_IPU("Cooler Master MK570", DetectCoolerMasterKeyboards, COOLERMASTER_VID, COOLERMASTER_MASTERKEYS_MK750_PID, 1, 0xFF00, 1);
|
||||
REGISTER_HID_DETECTOR_IPU("Cooler Master SK630", DetectCoolerMasterKeyboards, COOLERMASTER_VID, COOLERMASTER_MASTERKEYS_SK630_PID, 1, 0xFF00, 1);
|
||||
REGISTER_HID_DETECTOR_IPU("Cooler Master SK650", DetectCoolerMasterKeyboards, COOLERMASTER_VID, COOLERMASTER_MASTERKEYS_SK650_PID, 1, 0xFF00, 1);
|
||||
REGISTER_HID_DETECTOR_IPU("Cooler Master ARGB", DetectCoolerMasterARGB, COOLERMASTER_VID, COOLERMASTER_ARGB_PID, 0, 0xFF00, 1);
|
||||
REGISTER_HID_DETECTOR_IPU("Cooler Master Smalll ARGB", DetectCoolerMasterSmallARGB, COOLERMASTER_VID, COOLERMASTER_SMALL_ARGB_PID, 0, 0xFF00, 1);
|
||||
REGISTER_HID_DETECTOR_I ("Cooler Master Radeon 6000 GPU", DetectCoolerMasterGPU, COOLERMASTER_VID, COOLERMASTER_RADEON_6000_PID, 1 );
|
||||
|
|
|
|||
|
|
@ -0,0 +1,467 @@
|
|||
/*-------------------------------------------------------------------*\
|
||||
| RGBController_CMMKController.cpp |
|
||||
| |
|
||||
| Driver for Coolermaster MasterKeys keyboards |
|
||||
| |
|
||||
| Lukas N (chmod222) 28th Jun 2020 |
|
||||
| Tam D (too.manyhobbies) 25th Apr 2021 |
|
||||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#include "RGBController_CMMKController.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
#define CMMK_SPEED_MIN CMMK_SPEED0
|
||||
#define CMMK_SPEED_MID CMMK_SPEED2
|
||||
#define CMMK_SPEED_MAX CMMK_SPEED4
|
||||
#define CMMK_MODE_FIRMWARE 0xFF
|
||||
#define CMMK_MODE_MANUAL 0x7F
|
||||
|
||||
RGBController_CMMKController::RGBController_CMMKController(CMMKController* cmmk_ctrl)
|
||||
{
|
||||
cmmk = cmmk_ctrl;
|
||||
|
||||
name = cmmk->GetDeviceName();
|
||||
type = DEVICE_TYPE_KEYBOARD;
|
||||
description = "Cooler Master MasterKeys Device";
|
||||
version = cmmk->GetFirmwareVersion();
|
||||
serial = "";
|
||||
location = cmmk->GetLocation();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = CMMK_MODE_MANUAL;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
Static.value = CMMK_EFFECT_FULLY_LIT;
|
||||
Static.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
|
||||
Static.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Static.colors_min = 1;
|
||||
Static.colors_max = 1;
|
||||
Static.colors.resize(1);
|
||||
modes.push_back(Static);
|
||||
|
||||
mode Breathing;
|
||||
Breathing.name = "Breathing";
|
||||
Breathing.value = CMMK_EFFECT_BREATHE;
|
||||
Breathing.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED;
|
||||
Breathing.speed_min = 0x20;
|
||||
Breathing.speed_max = 0x20;
|
||||
Breathing.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Breathing.colors_min = 1;
|
||||
Breathing.colors_max = 1;
|
||||
Breathing.colors.resize(1);
|
||||
modes.push_back(Breathing);
|
||||
|
||||
mode Cycle;
|
||||
Cycle.name = "Spectrum Cycle";
|
||||
Cycle.value = CMMK_EFFECT_CYCLE;
|
||||
Cycle.flags = MODE_FLAG_HAS_SPEED;
|
||||
Cycle.speed_min = CMMK_SPEED_MIN;
|
||||
Cycle.speed_max = CMMK_SPEED_MAX;
|
||||
Cycle.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Cycle);
|
||||
|
||||
mode Single;
|
||||
Single.name = "Flashing";
|
||||
Single.value = CMMK_EFFECT_SINGLE;
|
||||
Single.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED;
|
||||
Single.speed_min = CMMK_SPEED_MIN;
|
||||
Single.speed_max = CMMK_SPEED_MAX;
|
||||
Single.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Single.colors_min = 2;
|
||||
Single.colors_max = 2;
|
||||
Single.colors.resize(2);
|
||||
modes.push_back(Single);
|
||||
|
||||
mode Wave;
|
||||
Wave.name = "Rainbow Wave";
|
||||
Wave.value = CMMK_EFFECT_WAVE;
|
||||
Wave.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_DIRECTION_UD;
|
||||
Wave.speed_min = CMMK_SPEED_MIN;
|
||||
Wave.speed_max = CMMK_SPEED_MAX;
|
||||
Wave.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Wave.colors_min = 1;
|
||||
Wave.colors_max = 1;
|
||||
Wave.colors.resize(1);
|
||||
modes.push_back(Wave);
|
||||
|
||||
mode Ripple;
|
||||
Ripple.name = "Ripple Effect";
|
||||
Ripple.value = CMMK_EFFECT_RIPPLE;
|
||||
Ripple.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_SPEED;
|
||||
Ripple.speed_min = CMMK_SPEED_MIN;
|
||||
Ripple.speed_max = CMMK_SPEED_MAX;
|
||||
Ripple.colors_min = 2;
|
||||
Ripple.colors_max = 2;
|
||||
Ripple.colors.resize(2);
|
||||
modes.push_back(Ripple);
|
||||
|
||||
mode Cross;
|
||||
Cross.name = "Cross";
|
||||
Cross.value = CMMK_EFFECT_CROSS;
|
||||
Cross.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED;
|
||||
Cross.speed_min = CMMK_SPEED_MIN;
|
||||
Cross.speed_max = CMMK_SPEED_MAX;
|
||||
Cross.colors_min = 2;
|
||||
Cross.colors_max = 2;
|
||||
Cross.colors.resize(2);
|
||||
modes.push_back(Cross);
|
||||
|
||||
mode Raindrops;
|
||||
Raindrops.name = "Raindrops";
|
||||
Raindrops.value = CMMK_EFFECT_RAINDROPS;
|
||||
Raindrops.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED;
|
||||
Raindrops.speed_min = CMMK_SPEED_MIN;
|
||||
Raindrops.speed_max = CMMK_SPEED_MAX;
|
||||
Raindrops.colors_min = 2;
|
||||
Raindrops.colors_max = 2;
|
||||
Raindrops.colors.resize(2);
|
||||
modes.push_back(Raindrops);
|
||||
|
||||
mode Stars;
|
||||
Stars.name = "Starfield";
|
||||
Stars.value = CMMK_EFFECT_STARS;
|
||||
Stars.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED;
|
||||
Stars.speed_min = CMMK_SPEED_MIN;
|
||||
Stars.speed_max = CMMK_SPEED_MAX;
|
||||
Stars.colors_min = 2;
|
||||
Stars.colors_max = 2;
|
||||
Stars.colors.resize(2);
|
||||
modes.push_back(Stars);
|
||||
|
||||
mode Snake;
|
||||
Snake.name = "Snake";
|
||||
Snake.value = CMMK_EFFECT_SNAKE;
|
||||
Snake.flags = MODE_FLAG_HAS_SPEED;
|
||||
Snake.speed_min = CMMK_SPEED_MIN;
|
||||
Snake.speed_max = CMMK_SPEED_MAX;
|
||||
modes.push_back(Snake);
|
||||
|
||||
mode FirmwareControl;
|
||||
FirmwareControl.name = "Firmware Controlled";
|
||||
FirmwareControl.value = 0xFF;
|
||||
FirmwareControl.flags = 0;
|
||||
modes.push_back(FirmwareControl);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_CMMKController::~RGBController_CMMKController()
|
||||
{
|
||||
delete cmmk;
|
||||
}
|
||||
|
||||
void RGBController_CMMKController::SetupMatrixMap()
|
||||
{
|
||||
for(int y = 0; y < CMMK_ROWS_MAX; y++)
|
||||
{
|
||||
for(int x = 0; x < CMMK_COLS_MAX; x++)
|
||||
{
|
||||
matrix_map[y][x] = 0xFFFFFFFF;
|
||||
}
|
||||
}
|
||||
|
||||
for(size_t i = 0; i < leds.size(); i++)
|
||||
{
|
||||
led& l = leds[i];
|
||||
|
||||
int y = (l.value & 0xFF00) >> 8;
|
||||
int x = (l.value & 0xFF);
|
||||
|
||||
matrix_map[y][x] = i;
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_CMMKController::SetupZones()
|
||||
{
|
||||
for(int y = 0; y < CMMK_ROWS_MAX; y++)
|
||||
{
|
||||
for(int x = 0; x < CMMK_COLS_MAX; x++)
|
||||
{
|
||||
if(!cmmk->PositionValid(y, x))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
std::stringstream namestrm;
|
||||
|
||||
led key;
|
||||
|
||||
namestrm << "Key @ Row " << (y + 1) << ", Column" << (x + 1);
|
||||
|
||||
key.name = namestrm.str();
|
||||
key.value = (y & 0xFF) << 8 | (x & 0xFF);
|
||||
|
||||
leds.push_back(key);
|
||||
}
|
||||
}
|
||||
|
||||
zone KeyboardZone;
|
||||
KeyboardZone.name = "Keyboard";
|
||||
KeyboardZone.type = ZONE_TYPE_MATRIX;
|
||||
KeyboardZone.leds_min = leds.size();
|
||||
KeyboardZone.leds_max = leds.size();
|
||||
KeyboardZone.leds_count = leds.size();
|
||||
KeyboardZone.matrix_map = new matrix_map_type;
|
||||
KeyboardZone.matrix_map->height = CMMK_ROWS_MAX;
|
||||
KeyboardZone.matrix_map->width = CMMK_COLS_MAX;
|
||||
KeyboardZone.matrix_map->map = (unsigned int *)&matrix_map;
|
||||
|
||||
zones.push_back(KeyboardZone);
|
||||
|
||||
SetupMatrixMap();
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_CMMKController::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
struct rgb map_to_cmmk_rgb(RGBColor input)
|
||||
{
|
||||
return rgb
|
||||
{
|
||||
(uint8_t)RGBGetRValue(input),
|
||||
(uint8_t)RGBGetGValue(input),
|
||||
(uint8_t)RGBGetBValue(input)
|
||||
};
|
||||
}
|
||||
|
||||
enum cmmk_wave_direction map_to_cmmk_dir(int input)
|
||||
{
|
||||
switch(input)
|
||||
{
|
||||
case MODE_DIRECTION_LEFT:
|
||||
return CMMK_RIGHT_TO_LEFT;
|
||||
|
||||
case MODE_DIRECTION_RIGHT:
|
||||
return CMMK_LEFT_TO_RIGHT;
|
||||
|
||||
case MODE_DIRECTION_UP:
|
||||
return CMMK_FRONT_TO_BACK;
|
||||
|
||||
case MODE_DIRECTION_DOWN:
|
||||
return CMMK_BACK_TO_FRONT;
|
||||
|
||||
default:
|
||||
return CMMK_RIGHT_TO_LEFT;
|
||||
}
|
||||
}
|
||||
|
||||
void copy_buffers(led* buf, RGBColor* colbuf, size_t n, struct cmmk_color_matrix& mat, std::atomic<bool>& dirty)
|
||||
{
|
||||
dirty.store(false);
|
||||
|
||||
for(size_t i = 0; i < n; i++)
|
||||
{
|
||||
led const& selected_led = buf[i];
|
||||
|
||||
int y = (selected_led.value & 0xFF00) >> 8;
|
||||
int x = selected_led.value & 0xFF;
|
||||
|
||||
struct rgb col = map_to_cmmk_rgb(colbuf[i]);
|
||||
struct rgb ecol = mat.data[y][x];
|
||||
|
||||
if(ecol.R != col.R || ecol.G != col.G || ecol.B != col.B)
|
||||
{
|
||||
dirty.store(true);
|
||||
|
||||
mat.data[y][x] = col;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_CMMKController::DeviceUpdateLEDs()
|
||||
{
|
||||
copy_buffers(leds.data(), colors.data(), leds.size(), current_matrix, dirty);
|
||||
|
||||
if(force_update.load() || dirty.load())
|
||||
{
|
||||
cmmk->SetAll(current_matrix);
|
||||
|
||||
force_update.store(false);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_CMMKController::UpdateZoneLEDs(int zone_idx)
|
||||
{
|
||||
zone& z = zones[zone_idx];
|
||||
|
||||
copy_buffers(z.leds, z.colors, z.leds_count, current_matrix, dirty);
|
||||
|
||||
if(force_update.load() || dirty.load())
|
||||
{
|
||||
cmmk->SetAll(current_matrix);
|
||||
|
||||
force_update.store(false);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_CMMKController::UpdateSingleLED(int led_idx)
|
||||
{
|
||||
led& selected_led = leds[led_idx];
|
||||
|
||||
int y = (selected_led.value & 0xFF00) >> 8;
|
||||
int x = selected_led.value & 0xFF;
|
||||
|
||||
current_matrix.data[y][x] = map_to_cmmk_rgb(colors[led_idx]);
|
||||
|
||||
cmmk->SetSingle(y, x, map_to_cmmk_rgb(colors[led_idx]));
|
||||
dirty.store(false);
|
||||
}
|
||||
|
||||
void RGBController_CMMKController::SetCustomMode()
|
||||
{
|
||||
active_mode = 1;
|
||||
}
|
||||
|
||||
void RGBController_CMMKController::DeviceUpdateMode()
|
||||
{
|
||||
force_update.store(true);
|
||||
|
||||
switch(modes[active_mode].value)
|
||||
{
|
||||
case CMMK_MODE_FIRMWARE:
|
||||
cmmk->SetFirmwareControl();
|
||||
break;
|
||||
|
||||
case CMMK_MODE_MANUAL:
|
||||
cmmk->SetManualControl();
|
||||
break;
|
||||
|
||||
case CMMK_EFFECT_FULLY_LIT:
|
||||
{
|
||||
cmmk_effect_fully_lit fully_lit_effect;
|
||||
|
||||
fully_lit_effect.color = map_to_cmmk_rgb(modes[active_mode].colors[0]);
|
||||
|
||||
cmmk->SetMode(fully_lit_effect);
|
||||
}
|
||||
break;
|
||||
|
||||
case CMMK_EFFECT_BREATHE:
|
||||
{
|
||||
cmmk_effect_breathe breathe_effect;
|
||||
|
||||
breathe_effect.speed = (uint8_t)modes[active_mode].speed;
|
||||
breathe_effect.color = map_to_cmmk_rgb(modes[active_mode].colors[0]);
|
||||
|
||||
cmmk->SetMode(breathe_effect);
|
||||
}
|
||||
break;
|
||||
|
||||
case CMMK_EFFECT_CYCLE:
|
||||
{
|
||||
cmmk_effect_cycle cycle_effect;
|
||||
|
||||
cycle_effect.speed = (uint8_t)modes[active_mode].speed;
|
||||
|
||||
cmmk->SetMode(cycle_effect);
|
||||
}
|
||||
break;
|
||||
|
||||
case CMMK_EFFECT_SINGLE:
|
||||
{
|
||||
cmmk_effect_single single_effect;
|
||||
|
||||
single_effect.speed = (uint8_t)modes[active_mode].speed;
|
||||
single_effect.active = map_to_cmmk_rgb(modes[active_mode].colors[0]);
|
||||
single_effect.rest = map_to_cmmk_rgb(modes[active_mode].colors[1]);
|
||||
|
||||
cmmk->SetMode(single_effect);
|
||||
}
|
||||
break;
|
||||
|
||||
case CMMK_EFFECT_WAVE:
|
||||
{
|
||||
cmmk_effect_wave wave_effect;
|
||||
|
||||
wave_effect.speed = (uint8_t)modes[active_mode].speed;
|
||||
wave_effect.direction = map_to_cmmk_dir(modes[active_mode].direction);
|
||||
wave_effect.start = map_to_cmmk_rgb(modes[active_mode].colors[0]);
|
||||
|
||||
cmmk->SetMode(wave_effect);
|
||||
}
|
||||
break;
|
||||
|
||||
case CMMK_EFFECT_RIPPLE:
|
||||
{
|
||||
cmmk_effect_ripple ripple_effect;
|
||||
|
||||
ripple_effect.speed = (uint8_t)modes[active_mode].speed;
|
||||
ripple_effect.active = map_to_cmmk_rgb(modes[active_mode].colors[0]);
|
||||
ripple_effect.rest = map_to_cmmk_rgb(modes[active_mode].colors[1]);
|
||||
|
||||
if(modes[active_mode].color_mode == MODE_COLORS_RANDOM)
|
||||
{
|
||||
ripple_effect.ripple_type = CMMK_RIPPLE_RANDOM_COLOR;
|
||||
}
|
||||
else
|
||||
{
|
||||
ripple_effect.ripple_type = CMMK_RIPPLE_GIVEN_COLOR;
|
||||
}
|
||||
|
||||
cmmk->SetMode(ripple_effect);
|
||||
}
|
||||
break;
|
||||
|
||||
case CMMK_EFFECT_CROSS:
|
||||
{
|
||||
cmmk_effect_cross cross_effect;
|
||||
|
||||
cross_effect.speed = (uint8_t)modes[active_mode].speed;
|
||||
cross_effect.active = map_to_cmmk_rgb(modes[active_mode].colors[0]);
|
||||
cross_effect.rest = map_to_cmmk_rgb(modes[active_mode].colors[1]);
|
||||
|
||||
cmmk->SetMode(cross_effect);
|
||||
}
|
||||
break;
|
||||
|
||||
case CMMK_EFFECT_RAINDROPS:
|
||||
{
|
||||
cmmk_effect_raindrops raindrops_effect;
|
||||
|
||||
raindrops_effect.speed = (uint8_t)modes[active_mode].speed;
|
||||
raindrops_effect.interval = CMMK_SPEED_MID;
|
||||
raindrops_effect.active = map_to_cmmk_rgb(modes[active_mode].colors[0]);
|
||||
raindrops_effect.rest = map_to_cmmk_rgb(modes[active_mode].colors[1]);
|
||||
|
||||
cmmk->SetMode(raindrops_effect);
|
||||
}
|
||||
break;
|
||||
|
||||
case CMMK_EFFECT_STARS:
|
||||
{
|
||||
cmmk_effect_stars stars_effect;
|
||||
|
||||
stars_effect.speed = (uint8_t)modes[active_mode].speed;
|
||||
stars_effect.interval = CMMK_SPEED_MID;
|
||||
stars_effect.active = map_to_cmmk_rgb(modes[active_mode].colors[0]);
|
||||
stars_effect.rest = map_to_cmmk_rgb(modes[active_mode].colors[1]);
|
||||
|
||||
cmmk->SetMode(stars_effect);
|
||||
}
|
||||
break;
|
||||
|
||||
case CMMK_EFFECT_SNAKE:
|
||||
{
|
||||
cmmk_effect_snake snake_effect;
|
||||
|
||||
snake_effect.speed = (uint8_t)modes[active_mode].speed;
|
||||
|
||||
cmmk->SetMode(snake_effect);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -4,6 +4,7 @@
|
|||
| Driver for Coolermaster MasterKeys keyboards |
|
||||
| |
|
||||
| Lukas N (chmod222) 28th Jun 2020 |
|
||||
| Tam D (too.manyhobbies) 25th Apr 2021 |
|
||||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
|
|
@ -12,8 +13,6 @@
|
|||
#include "RGBController.h"
|
||||
#include "CMMKController.h"
|
||||
|
||||
#include <mutex>
|
||||
|
||||
class RGBController_CMMKController : public RGBController
|
||||
{
|
||||
public:
|
||||
|
|
@ -28,7 +27,7 @@ public:
|
|||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void UpdateMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
void SetupMatrixMap();
|
||||
|
|
@ -51,6 +51,7 @@ INCLUDEPATH +=
|
|||
dependencies/CRCpp/ \
|
||||
dependencies/json/ \
|
||||
dependencies/libe131/src/ \
|
||||
dependencies/libcmmk/include/ \
|
||||
i2c_smbus/ \
|
||||
i2c_tools/ \
|
||||
net_port/ \
|
||||
|
|
@ -128,6 +129,7 @@ INCLUDEPATH +=
|
|||
HEADERS += \
|
||||
dependencies/ColorWheel/ColorWheel.h \
|
||||
dependencies/json/json.hpp \
|
||||
dependencies/libcmmk/include/libcmmk/libcmmk.h \
|
||||
LogManager.h \
|
||||
NetworkClient.h \
|
||||
NetworkProtocol.h \
|
||||
|
|
@ -185,10 +187,12 @@ HEADERS +=
|
|||
Controllers/CoolerMasterController/CMMP750Controller.h \
|
||||
Controllers/CoolerMasterController/CMSmallARGBController.h \
|
||||
Controllers/CoolerMasterController/CMR6000Controller.h \
|
||||
Controllers/CoolerMasterController/CMMKController.h \
|
||||
Controllers/CoolerMasterController/RGBController_CMARGBController.h \
|
||||
Controllers/CoolerMasterController/RGBController_CMMP750Controller.h \
|
||||
Controllers/CoolerMasterController/RGBController_CMSmallARGBController.h \
|
||||
Controllers/CoolerMasterController/RGBController_CMR6000Controller.h \
|
||||
Controllers/CoolerMasterController/RGBController_CMMKController.h \
|
||||
Controllers/CorsairDominatorPlatinumController/CorsairDominatorPlatinumController.h \
|
||||
Controllers/CorsairDominatorPlatinumController/RGBController_CorsairDominatorPlatinum.h \
|
||||
Controllers/CorsairHydroController/CorsairHydroController.h \
|
||||
|
|
@ -366,6 +370,7 @@ SOURCES +=
|
|||
dependencies/dmiinfo.cpp \
|
||||
dependencies/ColorWheel/ColorWheel.cpp \
|
||||
dependencies/libe131/src/e131.c \
|
||||
dependencies/libcmmk/src/libcmmk.c \
|
||||
main.cpp \
|
||||
cli.cpp \
|
||||
LogManager.cpp \
|
||||
|
|
@ -426,11 +431,13 @@ SOURCES +=
|
|||
Controllers/CoolerMasterController/CMMP750Controller.cpp \
|
||||
Controllers/CoolerMasterController/CMSmallARGBController.cpp \
|
||||
Controllers/CoolerMasterController/CMR6000Controller.cpp \
|
||||
Controllers/CoolerMasterController/CMMKController.cpp \
|
||||
Controllers/CoolerMasterController/CoolerMasterControllerDetect.cpp \
|
||||
Controllers/CoolerMasterController/RGBController_CMARGBController.cpp \
|
||||
Controllers/CoolerMasterController/RGBController_CMMP750Controller.cpp \
|
||||
Controllers/CoolerMasterController/RGBController_CMSmallARGBController.cpp \
|
||||
Controllers/CoolerMasterController/RGBController_CMR6000Controller.cpp \
|
||||
Controllers/CoolerMasterController/RGBController_CMMKController.cpp \
|
||||
Controllers/CorsairDominatorPlatinumController/CorsairDominatorPlatinumController.cpp \
|
||||
Controllers/CorsairDominatorPlatinumController/CorsairDominatorPlatinumControllerDetect.cpp \
|
||||
Controllers/CorsairDominatorPlatinumController/RGBController_CorsairDominatorPlatinum.cpp \
|
||||
|
|
|
|||
|
|
@ -191,6 +191,7 @@ There have been two instances of hardware damage in OpenRGB's development and we
|
|||
* OpenRazer-Win32: https://github.com/CalcProgrammer1/openrazer-win32
|
||||
* Qt-Plus (ColorWheel): https://github.com/liuyanghejerry/Qt-Plus
|
||||
* AMD ADL Libraries: https://github.com/GPUOpen-LibrariesAndSDKs/display-library
|
||||
* libcmmk: https://github.com/chmod222/libcmmk
|
||||
|
||||
## Projects Researched
|
||||
|
||||
|
|
|
|||
|
|
@ -1,391 +0,0 @@
|
|||
/*-------------------------------------------------------------------*\
|
||||
| RGBController_CMMKController.cpp |
|
||||
| |
|
||||
| Driver for Coolermaster MasterKeys keyboards |
|
||||
| |
|
||||
| Lukas N (chmod222) 28th Jun 2020 |
|
||||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#include "RGBController_CMMKController.h"
|
||||
|
||||
#include <sstream>
|
||||
#include <cassert>
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
RGBController_CMMKController::RGBController_CMMKController(CMMKController* cmmk_ctrl)
|
||||
{
|
||||
cmmk = cmmk_ctrl;
|
||||
|
||||
name = cmmk->GetDeviceName();
|
||||
type = DEVICE_TYPE_KEYBOARD;
|
||||
description = cmmk->GetDeviceName();
|
||||
version = cmmk->GetFirmwareVersion();
|
||||
serial = "";
|
||||
location = cmmk->GetLocation();
|
||||
|
||||
mode FirmwareControl;
|
||||
FirmwareControl.name = "Firmware Controlled";
|
||||
FirmwareControl.value = 0xff;
|
||||
FirmwareControl.flags = 0;
|
||||
modes.push_back(FirmwareControl);
|
||||
|
||||
mode CustomKeys;
|
||||
CustomKeys.name = "Customized LEDs";
|
||||
CustomKeys.value = 0x7f;
|
||||
CustomKeys.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
CustomKeys.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(CustomKeys);
|
||||
|
||||
mode FullLit;
|
||||
FullLit.name = "Single Color";
|
||||
FullLit.value = CMMK_EFFECT_FULLY_LIT;
|
||||
FullLit.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
|
||||
FullLit.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
FullLit.colors_min = 1;
|
||||
FullLit.colors_max = 1;
|
||||
FullLit.colors.resize(1);
|
||||
modes.push_back(FullLit);
|
||||
|
||||
mode Breathe;
|
||||
Breathe.name = "Breathe";
|
||||
Breathe.value = CMMK_EFFECT_BREATHE;
|
||||
Breathe.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED;
|
||||
Breathe.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Breathe.colors_min = 1;
|
||||
Breathe.colors_max = 1;
|
||||
Breathe.colors.resize(1);
|
||||
Breathe.speed_min = CMMK_SPEED0;
|
||||
Breathe.speed_max = CMMK_SPEED4;
|
||||
modes.push_back(Breathe);
|
||||
|
||||
mode Cycle;
|
||||
Cycle.name = "Cycle";
|
||||
Cycle.value = CMMK_EFFECT_CYCLE;
|
||||
Cycle.flags = MODE_FLAG_HAS_SPEED;
|
||||
Cycle.color_mode = MODE_COLORS_NONE;
|
||||
Cycle.speed_min = CMMK_SPEED0;
|
||||
Cycle.speed_max = CMMK_SPEED4;
|
||||
modes.push_back(Cycle);
|
||||
|
||||
mode Single;
|
||||
Single.name = "Single Key Fade-Out";
|
||||
Single.value = CMMK_EFFECT_SINGLE;
|
||||
Single.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED;
|
||||
Single.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Single.colors_min = 2;
|
||||
Single.colors_max = 2;
|
||||
Single.colors.resize(2);
|
||||
Single.speed_min = CMMK_SPEED0;
|
||||
Single.speed_max = CMMK_SPEED4;
|
||||
modes.push_back(Single);
|
||||
|
||||
mode Wave;
|
||||
Wave.name = "Wave";
|
||||
Wave.value = CMMK_EFFECT_WAVE;
|
||||
Wave.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_DIRECTION_UD;
|
||||
Wave.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Wave.colors_min = 1;
|
||||
Wave.colors_max = 1;
|
||||
Wave.colors.resize(1);
|
||||
Wave.speed_min = CMMK_SPEED0;
|
||||
Wave.speed_max = CMMK_SPEED4;
|
||||
modes.push_back(Wave);
|
||||
|
||||
mode Ripple;
|
||||
Ripple.name = "Ripple Effect";
|
||||
Ripple.value = CMMK_EFFECT_RIPPLE;
|
||||
Ripple.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_SPEED;
|
||||
Ripple.colors_min = 2;
|
||||
Ripple.colors_max = 2;
|
||||
Ripple.colors.resize(2);
|
||||
Ripple.speed_min = CMMK_SPEED0;
|
||||
Ripple.speed_max = CMMK_SPEED4;
|
||||
modes.push_back(Ripple);
|
||||
|
||||
mode Cross;
|
||||
Cross.name = "Cross Effect";
|
||||
Cross.value = CMMK_EFFECT_CROSS;
|
||||
Cross.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED;
|
||||
Cross.colors_min = 2;
|
||||
Cross.colors_max = 2;
|
||||
Cross.colors.resize(2);
|
||||
Cross.speed_min = CMMK_SPEED0;
|
||||
Cross.speed_max = CMMK_SPEED4;
|
||||
modes.push_back(Cross);
|
||||
|
||||
mode Raindrops;
|
||||
Raindrops.name = "Raindrops Effect";
|
||||
Raindrops.value = CMMK_EFFECT_RAINDROPS;
|
||||
Raindrops.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED;
|
||||
Raindrops.colors_min = 2;
|
||||
Raindrops.colors_max = 2;
|
||||
Raindrops.colors.resize(2);
|
||||
Raindrops.speed_min = CMMK_SPEED0;
|
||||
Raindrops.speed_max = CMMK_SPEED4;
|
||||
modes.push_back(Raindrops);
|
||||
|
||||
mode Stars;
|
||||
Stars.name = "Starfield Effect";
|
||||
Stars.value = CMMK_EFFECT_STARS;
|
||||
Stars.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED;
|
||||
Stars.colors_min = 2;
|
||||
Stars.colors_max = 2;
|
||||
Stars.colors.resize(2);
|
||||
Stars.speed_min = CMMK_SPEED0;
|
||||
Stars.speed_max = CMMK_SPEED4;
|
||||
modes.push_back(Stars);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_CMMKController::~RGBController_CMMKController()
|
||||
{
|
||||
delete cmmk;
|
||||
}
|
||||
|
||||
void RGBController_CMMKController::SetupMatrixMap()
|
||||
{
|
||||
for (int y = 0; y < CMMK_ROWS_MAX; ++y) {
|
||||
for (int x = 0; x < CMMK_COLS_MAX; ++x) {
|
||||
matrix_map[y][x] = 0xFFFFFFFF;
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < leds.size(); ++i) {
|
||||
led const& l = leds[i];
|
||||
|
||||
int y = (l.value & 0xFF00) >> 8;
|
||||
int x = l.value & 0xFF;
|
||||
|
||||
matrix_map[y][x] = i;
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_CMMKController::SetupZones()
|
||||
{
|
||||
for (int y = 0; y < CMMK_ROWS_MAX; ++y) {
|
||||
for (int x = 0; x < CMMK_COLS_MAX; ++x) {
|
||||
if (!cmmk->PositionValid(y, x)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
std::stringstream namestrm;
|
||||
|
||||
led key;
|
||||
|
||||
namestrm << "Key @ Row " << (y + 1) << ", Column" << (x + 1);
|
||||
|
||||
key.name = namestrm.str();
|
||||
key.value = (y & 0xFF) << 8 | (x & 0xFF);
|
||||
|
||||
leds.push_back(key);
|
||||
}
|
||||
}
|
||||
|
||||
zone KeyboardZone;
|
||||
KeyboardZone.name = "Keyboard";
|
||||
KeyboardZone.type = ZONE_TYPE_MATRIX;
|
||||
KeyboardZone.leds_min = leds.size();
|
||||
KeyboardZone.leds_max = leds.size();
|
||||
KeyboardZone.leds_count = leds.size();
|
||||
KeyboardZone.matrix_map = new matrix_map_type;
|
||||
KeyboardZone.matrix_map->height = CMMK_ROWS_MAX;
|
||||
KeyboardZone.matrix_map->width = CMMK_COLS_MAX;
|
||||
KeyboardZone.matrix_map->map = (unsigned int *)&matrix_map;
|
||||
|
||||
zones.push_back(KeyboardZone);
|
||||
|
||||
SetupMatrixMap();
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_CMMKController::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
namespace {
|
||||
struct rgb map_to_cmmk_rgb(RGBColor input) {
|
||||
return rgb {
|
||||
(uint8_t)RGBGetRValue(input),
|
||||
(uint8_t)RGBGetGValue(input),
|
||||
(uint8_t)RGBGetBValue(input)
|
||||
};
|
||||
}
|
||||
|
||||
enum cmmk_wave_direction map_to_cmmk_dir(int input) {
|
||||
switch (input) {
|
||||
case MODE_DIRECTION_LEFT: return CMMK_RIGHT_TO_LEFT;
|
||||
case MODE_DIRECTION_RIGHT: return CMMK_LEFT_TO_RIGHT;
|
||||
case MODE_DIRECTION_UP: return CMMK_FRONT_TO_BACK;
|
||||
case MODE_DIRECTION_DOWN: return CMMK_BACK_TO_FRONT;
|
||||
default: assert(false && "unreachable");
|
||||
}
|
||||
}
|
||||
|
||||
void copy_buffers(led* buf, RGBColor* colbuf, size_t n, struct cmmk_color_matrix& mat, std::atomic<bool>& dirty) {
|
||||
dirty.store(false);
|
||||
|
||||
for (size_t i = 0; i < n; ++i) {
|
||||
led const& selected_led = buf[i];
|
||||
|
||||
int y = (selected_led.value & 0xFF00) >> 8;
|
||||
int x = selected_led.value & 0xFF;
|
||||
|
||||
struct rgb col = map_to_cmmk_rgb(colbuf[i]);
|
||||
struct rgb ecol = mat.data[y][x];
|
||||
|
||||
if (ecol.R != col.R || ecol.G != col.G || ecol.B != col.B) {
|
||||
dirty.store(true);
|
||||
|
||||
mat.data[y][x] = col;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_CMMKController::DeviceUpdateLEDs()
|
||||
{
|
||||
copy_buffers(leds.data(), colors.data(), leds.size(), current_matrix, dirty);
|
||||
|
||||
if (force_update.load() || dirty.load()) {
|
||||
cmmk->SetAll(current_matrix);
|
||||
|
||||
force_update.store(false);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_CMMKController::UpdateZoneLEDs(int _zone)
|
||||
{
|
||||
zone const& z = zones[_zone];
|
||||
|
||||
copy_buffers(z.leds, z.colors, z.leds_count, current_matrix, dirty);
|
||||
|
||||
if (force_update.load() || dirty.load()) {
|
||||
cmmk->SetAll(current_matrix);
|
||||
|
||||
force_update.store(false);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_CMMKController::UpdateSingleLED(int _led)
|
||||
{
|
||||
led const& selected_led = leds[_led];
|
||||
|
||||
int y = (selected_led.value & 0xFF00) >> 8;
|
||||
int x = selected_led.value & 0xFF;
|
||||
|
||||
current_matrix.data[y][x] = map_to_cmmk_rgb(colors[_led]);
|
||||
|
||||
cmmk->SetSingle(y, x, map_to_cmmk_rgb(colors[_led]));
|
||||
dirty.store(false);
|
||||
}
|
||||
|
||||
void RGBController_CMMKController::SetCustomMode()
|
||||
{
|
||||
force_update.store(true);
|
||||
|
||||
active_mode = 1;
|
||||
}
|
||||
|
||||
void RGBController_CMMKController::UpdateMode()
|
||||
{
|
||||
force_update.store(true);
|
||||
|
||||
switch(modes[active_mode].value)
|
||||
{
|
||||
case 0xff:
|
||||
cmmk->SetFirmwareControl();
|
||||
break;
|
||||
|
||||
case 0x7f:
|
||||
cmmk->SetManualControl();
|
||||
break;
|
||||
|
||||
case CMMK_EFFECT_FULLY_LIT:
|
||||
cmmk->SetMode(cmmk_effect_fully_lit {
|
||||
map_to_cmmk_rgb(modes[active_mode].colors[0])
|
||||
});
|
||||
|
||||
break;
|
||||
|
||||
case CMMK_EFFECT_BREATHE:
|
||||
cmmk->SetMode(cmmk_effect_breathe {
|
||||
(uint8_t)modes[active_mode].speed,
|
||||
map_to_cmmk_rgb(modes[active_mode].colors[0])
|
||||
});
|
||||
|
||||
break;
|
||||
|
||||
case CMMK_EFFECT_CYCLE:
|
||||
cmmk->SetMode(cmmk_effect_cycle {
|
||||
(uint8_t)modes[active_mode].speed
|
||||
});
|
||||
|
||||
break;
|
||||
|
||||
case CMMK_EFFECT_SINGLE:
|
||||
cmmk->SetMode(cmmk_effect_single {
|
||||
(uint8_t)modes[active_mode].speed,
|
||||
|
||||
map_to_cmmk_rgb(modes[active_mode].colors[0]),
|
||||
map_to_cmmk_rgb(modes[active_mode].colors[1])
|
||||
});
|
||||
|
||||
break;
|
||||
|
||||
case CMMK_EFFECT_WAVE:
|
||||
cmmk->SetMode(cmmk_effect_wave {
|
||||
(uint8_t)modes[active_mode].speed,
|
||||
map_to_cmmk_dir(modes[active_mode].direction),
|
||||
map_to_cmmk_rgb(modes[active_mode].colors[0])
|
||||
});
|
||||
|
||||
break;
|
||||
|
||||
case CMMK_EFFECT_RIPPLE:
|
||||
cmmk->SetMode(cmmk_effect_ripple {
|
||||
(uint8_t)modes[active_mode].speed,
|
||||
modes[active_mode].color_mode == MODE_COLORS_RANDOM
|
||||
? CMMK_RIPPLE_RANDOM_COLOR
|
||||
: CMMK_RIPPLE_GIVEN_COLOR,
|
||||
map_to_cmmk_rgb(modes[active_mode].colors[0]),
|
||||
map_to_cmmk_rgb(modes[active_mode].colors[1])
|
||||
});
|
||||
|
||||
break;
|
||||
|
||||
case CMMK_EFFECT_CROSS:
|
||||
cmmk->SetMode(cmmk_effect_cross {
|
||||
(uint8_t)modes[active_mode].speed,
|
||||
map_to_cmmk_rgb(modes[active_mode].colors[0]),
|
||||
map_to_cmmk_rgb(modes[active_mode].colors[1])
|
||||
});
|
||||
|
||||
break;
|
||||
|
||||
case CMMK_EFFECT_RAINDROPS:
|
||||
cmmk->SetMode(cmmk_effect_raindrops {
|
||||
(uint8_t)modes[active_mode].speed,
|
||||
CMMK_SPEED2,
|
||||
map_to_cmmk_rgb(modes[active_mode].colors[0]),
|
||||
map_to_cmmk_rgb(modes[active_mode].colors[1])
|
||||
});
|
||||
|
||||
break;
|
||||
|
||||
case CMMK_EFFECT_STARS:
|
||||
cmmk->SetMode(cmmk_effect_stars {
|
||||
(uint8_t)modes[active_mode].speed,
|
||||
CMMK_SPEED2,
|
||||
map_to_cmmk_rgb(modes[active_mode].colors[0]),
|
||||
map_to_cmmk_rgb(modes[active_mode].colors[1])
|
||||
});
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
1
dependencies/libcmmk
vendored
1
dependencies/libcmmk
vendored
|
|
@ -1 +0,0 @@
|
|||
Subproject commit a8472d1494049eb96c5c4fefbb309654d17ac20d
|
||||
422
dependencies/libcmmk/include/libcmmk/libcmmk.h
vendored
Normal file
422
dependencies/libcmmk/include/libcmmk/libcmmk.h
vendored
Normal file
|
|
@ -0,0 +1,422 @@
|
|||
/*
|
||||
* This file is part of libcmmk.
|
||||
*
|
||||
* libcmmk is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* libcmmk is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with libcmmk. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef LIBCMMK_H
|
||||
#define LIBCMMK_H
|
||||
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define CMMK_ROWS_MAX 7
|
||||
#define CMMK_COLS_MAX 22
|
||||
|
||||
#define CMMK_KEYLIST_SIZE 256
|
||||
|
||||
/*
|
||||
* If we have C99 support (which we do, because libusb-1.0 requires it...), define some handy
|
||||
* macros.
|
||||
*/
|
||||
#if __STDC_VERSION__ >= 199901L
|
||||
/* struct rgb from 0xRRGGBB */
|
||||
#define MKRGB(hex) (struct rgb){((hex) >> 16) & 0xFF, ((hex) >> 8) & 0xFF, (hex) & 0xFF }
|
||||
|
||||
/* struct rgb from single parts */
|
||||
#define MKRGBS(r, g, b) (struct rgb){ (r), (g), (b) }
|
||||
#endif
|
||||
|
||||
struct rgb {
|
||||
unsigned char R;
|
||||
unsigned char G;
|
||||
unsigned char B;
|
||||
};
|
||||
|
||||
|
||||
/* Result codes */
|
||||
enum cmmk_result {
|
||||
CMMK_OK = 0,
|
||||
CMMK_ERR, /* Non-specific error */
|
||||
CMMK_LAYOUT_DETECTION_FAILED,
|
||||
CMMK_USB_COMM, /* An error happened while trying to talk to the device */
|
||||
CMMK_INVAL, /* Invalid parameter given */
|
||||
};
|
||||
|
||||
/*
|
||||
* Physical USB product IDs for general device type detection only.
|
||||
*/
|
||||
enum cmmk_product {
|
||||
CMMK_USB_MASTERKEYS_PRO_L = 0x003b,
|
||||
CMMK_USB_MASTERKEYS_PRO_L_WHITE = 0x0047,
|
||||
CMMK_USB_MASTERKEYS_PRO_S = 0x003c,
|
||||
CMMK_USB_MASTERKEYS_MK750 = 0x0067,
|
||||
CMMK_USB_MASTERKEYS_SK630 = 0x0089,
|
||||
CMMK_USB_MASTERKEYS_SK650 = 0x008d,
|
||||
};
|
||||
|
||||
/*
|
||||
* The specific layout of a given device.
|
||||
*/
|
||||
enum cmmk_layout {
|
||||
CMMK_LAYOUT_US_S,
|
||||
CMMK_LAYOUT_US_L, /* TODO */
|
||||
CMMK_LAYOUT_US_MK750, /* TODO */
|
||||
CMMK_LAYOUT_US_SK630, /* TODO */
|
||||
CMMK_LAYOUT_US_SK650, /* TODO */
|
||||
CMMK_LAYOUT_EU_S, /* TODO */
|
||||
CMMK_LAYOUT_EU_L,
|
||||
CMMK_LAYOUT_EU_MK750,
|
||||
CMMK_LAYOUT_EU_SK630,
|
||||
CMMK_LAYOUT_EU_SK650,
|
||||
|
||||
CMMK_LAYOUT_INVAL /* end marker */
|
||||
};
|
||||
|
||||
/* Apparently can be anything in range [0x00, 0x50].
|
||||
* Over 0x50 it just stops animating */
|
||||
enum cmmk_effect_speed {
|
||||
CMMK_SPEED0 = 0x46,
|
||||
CMMK_SPEED1 = 0x41,
|
||||
CMMK_SPEED2 = 0x38,
|
||||
CMMK_SPEED3 = 0x3D,
|
||||
CMMK_SPEED4 = 0x31
|
||||
};
|
||||
|
||||
enum cmmk_wave_direction {
|
||||
CMMK_LEFT_TO_RIGHT = 0x00,
|
||||
CMMK_RIGHT_TO_LEFT = 0x04,
|
||||
CMMK_BACK_TO_FRONT = 0x02,
|
||||
CMMK_FRONT_TO_BACK = 0x06
|
||||
};
|
||||
|
||||
enum cmmk_ripple_type {
|
||||
CMMK_RIPPLE_GIVEN_COLOR, /* use the given color */
|
||||
CMMK_RIPPLE_RANDOM_COLOR = 0x80 /* use a random color */
|
||||
};
|
||||
|
||||
enum cmmk_control_mode {
|
||||
/* Firmware controls everything */
|
||||
CMMK_FIRMWARE = 0x00,
|
||||
|
||||
/* Firmware controlled effect, configured via software */
|
||||
CMMK_EFFECT = 0x01,
|
||||
|
||||
/* Manual control of everything */
|
||||
CMMK_MANUAL = 0x02,
|
||||
|
||||
/* Profile setup (may actually be a misnomer, as saving the profile works
|
||||
* in effect mode as well */
|
||||
CMMK_PROFILE_CUSTOMIZATION = 0x03
|
||||
};
|
||||
|
||||
enum cmmk_effect_id {
|
||||
CMMK_EFFECT_FULLY_LIT = 0x00,
|
||||
CMMK_EFFECT_BREATHE = 0x01,
|
||||
CMMK_EFFECT_CYCLE = 0x02,
|
||||
CMMK_EFFECT_SINGLE = 0x03,
|
||||
CMMK_EFFECT_WAVE = 0x04,
|
||||
CMMK_EFFECT_RIPPLE = 0x05,
|
||||
CMMK_EFFECT_CROSS = 0x06,
|
||||
CMMK_EFFECT_RAINDROPS = 0x07,
|
||||
CMMK_EFFECT_STARS = 0x08,
|
||||
CMMK_EFFECT_SNAKE = 0x09,
|
||||
CMMK_EFFECT_CUSTOMIZED = 0x0a,
|
||||
CMMK_EFFECT_MULTILAYER = 0xe0,
|
||||
CMMK_EFFECT_OFF = 0xfe
|
||||
};
|
||||
|
||||
/* These enums are only used for display or similar purposes.
|
||||
*
|
||||
* All the important layout information is contained in `enum cmmk_layout'. But because
|
||||
* most of the time, library users really want the model and layout information separated,
|
||||
* these two helpers abstract it away a bit. */
|
||||
enum cmmk_layout_type {
|
||||
CMMK_LAYOUT_TYPE_ANSI,
|
||||
CMMK_LAYOUT_TYPE_ISO
|
||||
};
|
||||
|
||||
enum cmmk_product_type {
|
||||
CMMK_PRODUCT_MASTERKEYS_PRO_L,
|
||||
CMMK_PRODUCT_MASTERKEYS_PRO_S,
|
||||
CMMK_PRODUCT_MASTERKEYS_MK750,
|
||||
CMMK_PRODUCT_MASTERKEYS_SK630,
|
||||
CMMK_PRODUCT_MASTERKEYS_SK650,
|
||||
};
|
||||
|
||||
/*
|
||||
* Attach to and detach from USB device
|
||||
*/
|
||||
struct cmmk {
|
||||
/* libusb_context *cxt; */
|
||||
hid_device *dev;
|
||||
|
||||
/*
|
||||
* Internal product IDs that are not all that useful outside the library.
|
||||
*/
|
||||
int product;
|
||||
int layout;
|
||||
|
||||
/*
|
||||
* Lookup map to get matrix positions for keys in constant time.
|
||||
*/
|
||||
int8_t rowmap[CMMK_KEYLIST_SIZE];
|
||||
int8_t colmap[CMMK_KEYLIST_SIZE];
|
||||
|
||||
int multilayer_mode;
|
||||
};
|
||||
|
||||
/* Helper types because passing multi dim arrays as parameter is yucky */
|
||||
struct cmmk_color_matrix {
|
||||
struct rgb data[CMMK_ROWS_MAX][CMMK_COLS_MAX];
|
||||
};
|
||||
|
||||
struct cmmk_effect_matrix {
|
||||
uint8_t data[CMMK_ROWS_MAX][CMMK_COLS_MAX]; /* values as type of enum cmmk_effect_id */
|
||||
};
|
||||
|
||||
/* Generic effect type for when type safety becomes too verbose.
|
||||
*
|
||||
* No sanity checking is done before sending this off to the firmware, so try to stay within
|
||||
* normal parameters. */
|
||||
struct cmmk_generic_effect {
|
||||
int p1;
|
||||
int p2;
|
||||
int p3;
|
||||
|
||||
struct rgb color1;
|
||||
struct rgb color2;
|
||||
};
|
||||
|
||||
struct cmmk_effect_fully_lit {
|
||||
struct rgb color;
|
||||
};
|
||||
|
||||
struct cmmk_effect_breathe {
|
||||
int speed;
|
||||
|
||||
struct rgb color;
|
||||
};
|
||||
|
||||
struct cmmk_effect_cycle {
|
||||
int speed;
|
||||
};
|
||||
|
||||
struct cmmk_effect_single {
|
||||
int speed;
|
||||
|
||||
struct rgb active;
|
||||
struct rgb rest;
|
||||
};
|
||||
|
||||
struct cmmk_effect_wave {
|
||||
int speed;
|
||||
|
||||
enum cmmk_wave_direction direction;
|
||||
|
||||
struct rgb start;
|
||||
};
|
||||
|
||||
struct cmmk_effect_ripple {
|
||||
int speed;
|
||||
|
||||
enum cmmk_ripple_type ripple_type;
|
||||
|
||||
struct rgb active;
|
||||
struct rgb rest;
|
||||
};
|
||||
|
||||
struct cmmk_effect_cross {
|
||||
int speed;
|
||||
|
||||
struct rgb active;
|
||||
struct rgb rest;
|
||||
};
|
||||
|
||||
struct cmmk_effect_raindrops {
|
||||
int speed;
|
||||
int interval;
|
||||
|
||||
struct rgb active;
|
||||
struct rgb rest;
|
||||
};
|
||||
|
||||
struct cmmk_effect_stars {
|
||||
int speed;
|
||||
int interval;
|
||||
|
||||
struct rgb active;
|
||||
struct rgb rest;
|
||||
};
|
||||
|
||||
struct cmmk_effect_snake {
|
||||
int speed;
|
||||
};
|
||||
|
||||
/* Tries to find a connected, compatible device. Returns 0 and sets *product to the
|
||||
* first device it finds */
|
||||
int cmmk_find_device(int *product);
|
||||
|
||||
/*
|
||||
* If layout = -1, try to automatically determine the layout. Otherwise, use one of the values
|
||||
* enumerated in `enum cmmk_layout'.
|
||||
*
|
||||
* Note that autodetection is based on unproven theories right now (see issue #10).
|
||||
* Your mileage may vary.
|
||||
*
|
||||
* If layout autodetection fails, 1 is returned and cmmk_detach is called implicitely.
|
||||
*/
|
||||
int cmmk_attach(struct cmmk *dev, int product, int layout);
|
||||
int cmmk_attach_path(struct cmmk *dev, char const *path, int product, int layout);
|
||||
int cmmk_detach(struct cmmk *dev);
|
||||
|
||||
/* Resets the layout to the given ID and regenerates lookup tables */
|
||||
int cmmk_force_layout(struct cmmk *dev, int layout);
|
||||
|
||||
/* fw must be up to 8 bytes to read the entire version string */
|
||||
int cmmk_get_firmware_version(struct cmmk *dev, char *fw, size_t fwsiz);
|
||||
|
||||
enum cmmk_product_type cmmk_get_device_model(struct cmmk *dev);
|
||||
enum cmmk_layout_type cmmk_get_device_layout(struct cmmk *dev);
|
||||
|
||||
const char * cmmk_product_to_str(int product);
|
||||
const char * cmmk_layout_to_str(int layout);
|
||||
|
||||
/*
|
||||
* Enter and leave direct control mode. Any control commands outside of control
|
||||
* mode are ignored. Enabling control mode while inside control mode will reset
|
||||
* active effect and allow direct control over LEDs.
|
||||
*/
|
||||
int cmmk_set_control_mode(struct cmmk *dev, int mode);
|
||||
|
||||
/* Only meaningful in profile customization mode */
|
||||
int cmmk_get_active_profile(struct cmmk *dev, int *prof);
|
||||
int cmmk_set_active_profile(struct cmmk *dev, int prof);
|
||||
|
||||
int cmmk_save_active_profile(struct cmmk *dev);
|
||||
|
||||
/* Predefined effects */
|
||||
int cmmk_get_active_effect(struct cmmk *dev, enum cmmk_effect_id *eff);
|
||||
int cmmk_set_active_effect(struct cmmk *dev, enum cmmk_effect_id eff);
|
||||
|
||||
/* Fetch the list of enabled effects. Updates "n" with the number of effects actually
|
||||
* read.
|
||||
*/
|
||||
int cmmk_get_enabled_effects(
|
||||
struct cmmk *dev,
|
||||
enum cmmk_effect_id *effs,
|
||||
size_t siz,
|
||||
size_t *n);
|
||||
|
||||
/* Sets the list of enabled effects. Buffer size is implied and should of course be
|
||||
* at least as big as n. */
|
||||
int cmmk_set_enabled_effects(
|
||||
struct cmmk *dev,
|
||||
enum cmmk_effect_id const *effs,
|
||||
size_t n);
|
||||
|
||||
/*
|
||||
* Get and set effect configurations.
|
||||
*
|
||||
* Caveeat: In customization mode, you can only change the configuration of an effect when it is
|
||||
* currently active. This does not seem to be the case in effects mode.
|
||||
*/
|
||||
int cmmk_get_effect(struct cmmk *dev, enum cmmk_effect_id id, struct cmmk_generic_effect *eff);
|
||||
int cmmk_set_effect(struct cmmk *dev, enum cmmk_effect_id id, struct cmmk_generic_effect const *eff);
|
||||
|
||||
int cmmk_get_effect_fully_lit(struct cmmk *dev, struct cmmk_effect_fully_lit *eff);
|
||||
int cmmk_set_effect_fully_lit(struct cmmk *dev, struct cmmk_effect_fully_lit const *eff);
|
||||
|
||||
int cmmk_get_effect_breathe(struct cmmk *dev, struct cmmk_effect_breathe *eff);
|
||||
int cmmk_set_effect_breathe(struct cmmk *dev, struct cmmk_effect_breathe const *eff);
|
||||
|
||||
int cmmk_get_effect_cycle(struct cmmk *dev, struct cmmk_effect_cycle *eff);
|
||||
int cmmk_set_effect_cycle(struct cmmk *dev, struct cmmk_effect_cycle const *eff);
|
||||
|
||||
int cmmk_get_effect_single(struct cmmk *dev, struct cmmk_effect_single *eff);
|
||||
int cmmk_set_effect_single(struct cmmk *dev, struct cmmk_effect_single const *eff);
|
||||
|
||||
int cmmk_get_effect_wave(struct cmmk *dev, struct cmmk_effect_wave *eff);
|
||||
int cmmk_set_effect_wave(struct cmmk *dev, struct cmmk_effect_wave const *eff);
|
||||
|
||||
int cmmk_get_effect_ripple(struct cmmk *dev, struct cmmk_effect_ripple *eff);
|
||||
int cmmk_set_effect_ripple(struct cmmk *dev, struct cmmk_effect_ripple const *eff);
|
||||
|
||||
int cmmk_get_effect_cross(struct cmmk *dev, struct cmmk_effect_cross *eff);
|
||||
int cmmk_set_effect_cross(struct cmmk *dev, struct cmmk_effect_cross const *eff);
|
||||
|
||||
int cmmk_get_effect_raindrops(struct cmmk *dev, struct cmmk_effect_raindrops *eff);
|
||||
int cmmk_set_effect_raindrops(struct cmmk *dev, struct cmmk_effect_raindrops const *eff);
|
||||
|
||||
int cmmk_get_effect_stars(struct cmmk *dev, struct cmmk_effect_stars *eff);
|
||||
int cmmk_set_effect_stars(struct cmmk *dev, struct cmmk_effect_stars const *eff);
|
||||
|
||||
int cmmk_get_effect_snake(struct cmmk *dev, struct cmmk_effect_snake *eff);
|
||||
int cmmk_set_effect_snake(struct cmmk *dev, struct cmmk_effect_snake const *eff);
|
||||
|
||||
/*
|
||||
* colmap *must* be at least 6x22. Otherwise, segmentation faults ensue.
|
||||
*
|
||||
* CAVEAT: The result will be wrong immediately after switching profiles. A few milliseconds
|
||||
* of delay need to be inserted after the switch and before the query.
|
||||
*/
|
||||
int cmmk_get_customized_leds(struct cmmk *dev, struct cmmk_color_matrix *colmap);
|
||||
int cmmk_set_customized_leds(struct cmmk *dev, struct cmmk_color_matrix const *colmap);
|
||||
|
||||
/*
|
||||
* Switch multilayer mode on (active > 0) or off (active == 0).
|
||||
*
|
||||
* Affects effect configuration getters and setters.
|
||||
*/
|
||||
int cmmk_switch_multilayer(struct cmmk *dev, int active);
|
||||
|
||||
int cmmk_get_multilayer_map(struct cmmk *dev, struct cmmk_effect_matrix *effmap);
|
||||
int cmmk_set_multilayer_map(struct cmmk *dev, struct cmmk_effect_matrix const *effmap);
|
||||
|
||||
/*
|
||||
* Set the single key `key' to the given color.
|
||||
*/
|
||||
int cmmk_set_single_key_by_id(struct cmmk *dev, int key, struct rgb const *color);
|
||||
|
||||
/*
|
||||
* Set the single key in row `row` and column `col` to the given color.
|
||||
*/
|
||||
int cmmk_set_single_key(struct cmmk *dev, int row, int col, struct rgb const *color);
|
||||
int cmmk_lookup_key_id(struct cmmk *dev, int row, int col);
|
||||
/*
|
||||
* Set the entire keyboard to the given color.
|
||||
*/
|
||||
int cmmk_set_all_single(struct cmmk *dev, struct rgb const *col);
|
||||
/*
|
||||
* Set the entire keyboard in one step from the given map.
|
||||
*
|
||||
* Keys in the map are indized by their individual mappings, so
|
||||
* colmap[K_ESC] will address the ESC key, much like
|
||||
* set_single_key(..., K_ESC, ...) will.
|
||||
*/
|
||||
int cmmk_set_leds(struct cmmk *dev, struct cmmk_color_matrix const *colmap);
|
||||
|
||||
#ifdef CMMK_DECLARE_DEBUG_FUNCTIONS
|
||||
int cmmk_send_anything(struct cmmk *dev, unsigned char *data, size_t data_siz);
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !defined(LIBCMMK_H) */
|
||||
1065
dependencies/libcmmk/src/libcmmk.c
vendored
Normal file
1065
dependencies/libcmmk/src/libcmmk.c
vendored
Normal file
File diff suppressed because it is too large
Load diff
25
dependencies/libcmmk/src/mappings/ansi/mk750.h
vendored
Normal file
25
dependencies/libcmmk/src/mappings/ansi/mk750.h
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* This file is part of libcmmk.
|
||||
*
|
||||
* libcmmk is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* libcmmk is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with libcmmk. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
static keyboard_layout layout_ansi_mk750 = {
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
};
|
||||
44
dependencies/libcmmk/src/mappings/ansi/pro_l.h
vendored
Normal file
44
dependencies/libcmmk/src/mappings/ansi/pro_l.h
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* This file is part of libcmmk.
|
||||
*
|
||||
* libcmmk is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* libcmmk is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with libcmmk. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
static keyboard_layout layout_ansi_pro_l = {
|
||||
/*
|
||||
ESC F1 F2 F3 F4 XXX F5 F6 F7 F8 XXX F9 F10 F11 F12 PRN SCL PAU P1 P2 P3 P4 */
|
||||
{11, 22, 30, 25, 27, -1, 7, 51, 57, 62, -1, 86, 87, 83, 85, 79, 72, 0, 101, 109, 117, 119},
|
||||
|
||||
/*
|
||||
` 1 2 3 4 5 6 7 8 9 0 - = XXX BCK INS HOM PUP #LCK #/ #* #- */
|
||||
{14, 15, 23, 31, 39, 38, 46, 47, 55, 63, 71, 70, 54, -1, 81, 3, 1, 2, 100, 108, 116, 118},
|
||||
|
||||
/*
|
||||
TAB Q W E R T Y U I O P [ ] XXX \ DEL END PDN #7 #8 #9 #+ */
|
||||
{9, 8, 16, 24, 32, 33, 41, 40, 48, 56, 64, 65, 49, -1, 82, 94, 92, 88, 96, 104, 112, 110},
|
||||
|
||||
/*
|
||||
CAP A S D F G H J K L ; ' XXX XXX ENT XXX XXX XXX #4 #5 #6 XXX */
|
||||
{17, 10, 18, 26, 34, 35, 43, 42, 50, 58, 66, 67, -1, -1, 84, -1, -1, -1, 97, 105, 113, -1},
|
||||
|
||||
/*
|
||||
LSHFT XXX Z X C V B N M , . / XXX XXX RSHFT XXX UP XXX #1 #2 #3 #ENTER */
|
||||
{73, -1, 12, 20, 28, 36, 37, 45, 44, 52, 60, 69, -1, -1, 74, -1, 80, -1, 98, 106, 114, 111},
|
||||
|
||||
/*
|
||||
LCTRL LWIN LALT XXX XXX XXX SPACE XXX XXX XXX RALT RWIN FN XXX RCTRL LEFT DOWN RIGHT #0 XXX #. XXX */
|
||||
{6, 90, 75, -1, -1, -1, 91, -1, -1, -1, 77, 78, 61, -1, 4, 95, 93, 5, 107, -1, 115, -1},
|
||||
|
||||
/* Bottom row does not exist */
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
};
|
||||
43
dependencies/libcmmk/src/mappings/ansi/pro_s.h
vendored
Normal file
43
dependencies/libcmmk/src/mappings/ansi/pro_s.h
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* This file is part of libcmmk.
|
||||
*
|
||||
* libcmmk is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* libcmmk is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with libcmmk. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
static keyboard_layout layout_ansi_pro_s = {
|
||||
/*
|
||||
ESC F1 F2 F3 F4 XXX F5 F6 F7 F8 XXX F9 F10 F11 F12 PRN SCL PAU XXX XXX XXX XXX */
|
||||
{96, 97, 98, 99, 104, -1, 105, 106, 112, 113, -1, 114, 67, 68, 69, 102, 103, 107, -1, -1, -1, -1},
|
||||
|
||||
/*
|
||||
` 1 2 3 4 5 6 7 8 9 0 - = XXX BCK INS HOM PUP XXX XXX XXX XXX */
|
||||
{0, 1, 8, 9, 16, 17, 24, 25, 32, 33, 40, 41, 48, -1, 49, 56, 57, 64, -1, -1, -1, -1},
|
||||
|
||||
/*
|
||||
TAB Q W E R T Y U I O P [ ] XXX \ DEL END PDN XXX XXX XXX XXX */
|
||||
{2, 3, 10, 11, 18, 19, 26, 27, 34, 35, 42, 43, 50, -1, 51, 58, 59, 66, -1, -1, -1, -1},
|
||||
|
||||
/*
|
||||
CAP A S D F G H J K L ; ' XXX XXX ENT XXX XXX XXX XXX XXX XXX XXX */
|
||||
{4, 5, 12, 13, 20, 21, 28, 29, 36, 37, 44, 45, -1, -1, 52, -1, -1, -1, -1, -1, -1, -1},
|
||||
|
||||
/*
|
||||
LSHFT XXX Z X C V B N M , . / XXX XXX RSHFT XXX UP XXX XXX XXX XXX XXX */
|
||||
{6, -1, 7, 14, 15, 22, 23, 30, 31, 38, 39, 46, -1, -1, 47, -1, 61, -1, -1, -1, -1, -1}, // after / was 1 BAD
|
||||
|
||||
/*
|
||||
LCTRL LWIN LALT XXX XXX XXX SPACE XXX XXX XXX RALT RWIN FN XXX RCTRL LEFT DOWN RIGHT XXX XXX XXX XXX */
|
||||
{91, 90, 92, -1, -1, -1, 93, -1, -1, -1, 94, 60, 95, -1, 54, 63, 62, 70, -1, -1, -1, -1},
|
||||
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
};
|
||||
25
dependencies/libcmmk/src/mappings/ansi/sk630.h
vendored
Normal file
25
dependencies/libcmmk/src/mappings/ansi/sk630.h
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* This file is part of libcmmk.
|
||||
*
|
||||
* libcmmk is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* libcmmk is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with libcmmk. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
static keyboard_layout layout_ansi_sk630 = {
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
};
|
||||
25
dependencies/libcmmk/src/mappings/ansi/sk650.h
vendored
Normal file
25
dependencies/libcmmk/src/mappings/ansi/sk650.h
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* This file is part of libcmmk.
|
||||
*
|
||||
* libcmmk is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* libcmmk is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with libcmmk. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
static keyboard_layout layout_ansi_sk650 = {
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
};
|
||||
45
dependencies/libcmmk/src/mappings/iso/mk750.h
vendored
Normal file
45
dependencies/libcmmk/src/mappings/iso/mk750.h
vendored
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* This file is part of libcmmk.
|
||||
*
|
||||
* libcmmk is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* libcmmk is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with libcmmk. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
static keyboard_layout layout_iso_mk750 = {
|
||||
/*
|
||||
ESC F1 F2 F3 F4 XXX F5 F6 F7 F8 XXX F9 F10 F11 F12 PRN SCL PAU MUT PLA REW FWD */
|
||||
{96, 97, 98, 99, 104, -1, 105, 106, 112, 113, -1, 114, 67, 68, 69, 102, 103, 107, 111, 110, 108, 109},
|
||||
|
||||
/*
|
||||
^ 1 2 3 4 5 6 7 8 9 0 ß ´ XXX BCK INS HOM PUP #LCK #/ #* #- */
|
||||
{0, 1, 8, 9, 16, 17, 24, 25, 32, 33, 40, 41, 48, -1, 49, 56, 57, 64, 72, 73, 80, 81},
|
||||
|
||||
/*
|
||||
TAB Q W E R T Z/Y U I O P Ü/[ +/] XXX ENT DEL END PDN #7 #8 #9 #+ */
|
||||
{2, 3, 10, 11, 18, 19, 26, 27, 34, 35, 42, 43, 50, -1, 52, 58, 59, 66, 74, 75, 82, 83},
|
||||
|
||||
/*
|
||||
CAP A S D F G H J K L Ö/; Ä/' #/C42 XXX XXX XXX XXX XXX #4 #5 #6 XXX */
|
||||
{4, 5, 12, 13, 20, 21, 28, 29, 36, 37, 44, 45, 119, -1, -1, -1, -1, -1, 76, 77, 84, -1},
|
||||
|
||||
/*
|
||||
LSHFT </C45 Y/Z X C V B N M , . -// XXX XXX RSHFT XXX UP XXX #1 #2 #3 #ENTER */
|
||||
{6, 118, 7, 14, 15, 22, 23, 30, 31, 38, 39, 46, -1, -1, 47, -1, 61, -1, 78, 79, 86, 85},
|
||||
|
||||
/*
|
||||
LCTRL LWIN LALT XXX XXX XXX SPACE XXX XXX XXX RALT RWIN FN XXX RCTRL LEFT DOWN RIGHT #0 XXX #, XXX */
|
||||
{91, 90, 92, -1, -1, -1, 93, -1, -1, -1, 53, 95, 60, -1, 54, 63, 62, 70, 71, -1, 87, -1},
|
||||
|
||||
/*
|
||||
XXX LED1 LED2 LED3 LED4 XXX LED6 LED7 LED8 LED9 LED10 LED11 LED12 LED13 LED14 LED15 XXX LED17 LED18 LED19 LED20 XXX */
|
||||
{-1, 128, 140, 126, 141, -1, 142, 125, 143, 151, 124, 123, 122, 150, 121, 120, -1, 137, 135, 136, 138, -1}
|
||||
};
|
||||
44
dependencies/libcmmk/src/mappings/iso/pro_l.h
vendored
Normal file
44
dependencies/libcmmk/src/mappings/iso/pro_l.h
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* This file is part of libcmmk.
|
||||
*
|
||||
* libcmmk is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* libcmmk is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with libcmmk. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
static keyboard_layout layout_iso_pro_l = {
|
||||
/*
|
||||
ESC F1 F2 F3 F4 XXX F5 F6 F7 F8 XXX F9 F10 F11 F12 PRN SCL PAU P1 P2 P3 P4 */
|
||||
{11, 22, 30, 25, 27, -1, 7, 51, 57, 62, -1, 86, 87, 83, 85, 79, 72, 0, 101, 109, 117, 119},
|
||||
|
||||
/*
|
||||
^ 1 2 3 4 5 6 7 8 9 0 ß ´ XXX BCK INS HOM PUP #LCK #/ #* #- */
|
||||
{14, 15, 23, 31, 39, 38, 46, 47, 55, 63, 71, 70, 54, -1, 81, 3, 1, 2, 100, 108, 116, 118},
|
||||
|
||||
/*
|
||||
TAB Q W E R T Z/Y U I O P Ü/[ +/] XXX ENT DEL END PDN #7 #8 #9 #+ */
|
||||
{9, 8, 16, 24, 32, 33, 41, 40, 48, 56, 64, 65, 49, -1, 84, 94, 92, 88, 96, 104, 112, 110},
|
||||
|
||||
/*
|
||||
CAP A S D F G H J K L Ö/; Ä/' #/C42 XXX XXX XXX XXX XXX #4 #5 #6 XXX */
|
||||
{17, 10, 18, 26, 34, 35, 43, 42, 50, 58, 66, 67, 68, -1, -1, -1, -1, -1, 97, 105, 113, -1},
|
||||
|
||||
/*
|
||||
LSHFT </C45 Y/Z X C V B N M , . -// XXX XXX RSHFT XXX UP XXX #1 #2 #3 #ENTER */
|
||||
{73, 19, 12, 20, 28, 36, 37, 45, 44, 52, 60, 69, -1, -1, 74, -1, 80, -1, 98, 106, 114, 111},
|
||||
|
||||
/*
|
||||
LCTRL LWIN LALT XXX XXX XXX SPACE XXX XXX XXX RALT RWIN FN XXX RCTRL LEFT DOWN RIGHT #0 XXX #, XXX */
|
||||
{6, 90, 75, -1, -1, -1, 91, -1, -1, -1, 77, 78, 61, -1, 4, 95, 93, 5, 107, -1, 115, -1},
|
||||
|
||||
/* Bottom row does not exist */
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
};
|
||||
26
dependencies/libcmmk/src/mappings/iso/pro_s.h
vendored
Normal file
26
dependencies/libcmmk/src/mappings/iso/pro_s.h
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* This file is part of libcmmk.
|
||||
*
|
||||
* libcmmk is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* libcmmk is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with libcmmk. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
static keyboard_layout layout_iso_pro_s = {
|
||||
/* TODO! */
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
};
|
||||
44
dependencies/libcmmk/src/mappings/iso/sk630.h
vendored
Normal file
44
dependencies/libcmmk/src/mappings/iso/sk630.h
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* This file is part of libcmmk.
|
||||
*
|
||||
* libcmmk is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* libcmmk is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with libcmmk. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
static keyboard_layout layout_iso_sk630 = {
|
||||
/*
|
||||
ESC F1 F2 F3 F4 XXX F5 F6 F7 F8 XXX F9 F10 F11 F12 PRN SCL PAU MUT PLA REW FWD */
|
||||
{ 9, 33, 41, 49, 57, -1, 73, 81, 89, 97, -1, 105, 113, 121, 129, 137, 145, 153, -1, -1, -1, -1},
|
||||
|
||||
/*
|
||||
^ 1 2 3 4 5 6 7 8 9 0 ß ´ XXX BCK INS HOM PUP #LCK #/ #* #- */
|
||||
{10, 26, 34, 42, 50, 58, 66, 74, 82, 90, 98, 106, 114, -1, 130, 138, 146, 154, -1, -1, -1, -1},
|
||||
|
||||
/*
|
||||
TAB Q W E R T Z/Y U I O P Ü/[ +/] XXX ENT DEL END PDN #7 #8 #9 #+ */
|
||||
{11, 27, 35, 43, 51, 59, 67, 75, 83, 91, 99, 107, 115, -1, 132, 139, 147, 155, -1, -1, -1, -1},
|
||||
|
||||
/*
|
||||
CAP A S D F G H J K L Ö/; Ä/' #/C42 XXX XXX XXX XXX XXX #4 #5 #6 XXX */
|
||||
{12, 28, 36, 44, 52, 60, 68, 76, 84, 92, 100, 108, 124, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
|
||||
/*
|
||||
LSHFT </C45 Y/Z X C V B N M , . -// XXX XXX RSHFT XXX UP XXX #1 #2 #3 #ENTER */
|
||||
{13, 21, 29, 37, 45, 53, 61, 69, 77, 85, 93, 101, -1, -1, 133, -1, 149, -1, -1, -1, -1, -1},
|
||||
|
||||
/*
|
||||
LCTRL LWIN LALT XXX XXX XXX SPACE XXX XXX XXX RALT RWIN FN XXX RCTRL LEFT DOWN RIGHT #0 XXX #, XXX */
|
||||
{14, 22, 30, -1, -1, -1, 62, -1, -1, -1, 94, 102, 110, -1, 134, 142, 150, 158, -1, -1, -1, -1},
|
||||
|
||||
/* Bottom row does not exist */
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
};
|
||||
44
dependencies/libcmmk/src/mappings/iso/sk650.h
vendored
Normal file
44
dependencies/libcmmk/src/mappings/iso/sk650.h
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* This file is part of libcmmk.
|
||||
*
|
||||
* libcmmk is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* libcmmk is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with libcmmk. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
static keyboard_layout layout_iso_sk650 = {
|
||||
/*
|
||||
ESC F1 F2 F3 F4 XXX F5 F6 F7 F8 XXX F9 F10 F11 F12 PRN SCL PAU MUT PLA REW FWD */
|
||||
{ 9, 33, 41, 49, 57, -1, 73, 81, 89, 97, -1, 105, 113, 121, 129, 137, 145, 153, -1, -1, -1, -1},
|
||||
|
||||
/*
|
||||
^ 1 2 3 4 5 6 7 8 9 0 ß ´ XXX BCK INS HOM PUP #LCK #/ #* #- */
|
||||
{10, 26, 34, 42, 50, 58, 66, 74, 82, 90, 98, 106, 114, -1, 130, 138, 146, 154, 162, 170, 178, 186},
|
||||
|
||||
/*
|
||||
TAB Q W E R T Z/Y U I O P Ü/[ +/] XXX ENT DEL END PDN #7 #8 #9 #+ */
|
||||
{11, 27, 35, 43, 51, 59, 67, 75, 83, 91, 99, 107, 115, -1, 132, 139, 147, 155, 163, 171, 179, 187},
|
||||
|
||||
/*
|
||||
CAP A S D F G H J K L Ö/; Ä/' #/C42 XXX XXX XXX XXX XXX #4 #5 #6 XXX */
|
||||
{12, 28, 36, 44, 52, 60, 68, 76, 84, 92, 100, 108, 124, -1, -1, -1, -1, -1, 164, 172, 180, -1},
|
||||
|
||||
/*
|
||||
LSHFT </C45 Y/Z X C V B N M , . -// XXX XXX RSHFT XXX UP XXX #1 #2 #3 #ENTER */
|
||||
{13, 21, 29, 37, 45, 53, 61, 69, 77, 85, 93, 101, -1, -1, 133, -1, 149, -1, 165, 173, 181, 189},
|
||||
|
||||
/*
|
||||
LCTRL LWIN LALT XXX XXX XXX SPACE XXX XXX XXX RALT RWIN FN XXX RCTRL LEFT DOWN RIGHT #0 XXX #, XXX */
|
||||
{14, 22, 30, -1, -1, -1, 62, -1, -1, -1, 94, 102, 110, -1, 134, 142, 150, 158, 174, -1, 182, -1},
|
||||
|
||||
/* Bottom row does not exist */
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue