mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2025-12-26 00:37:46 -05:00
* Reorganize and clean up RGBController API functions
* Add functions to get protected RGBController member values
* Make NetworkClient, ProfileManager, and ResourceManager friend classes so they can access protected members
* Protected previously-public RGBController members
* Information strings (name, vendor, description, version, serial location)
* Device type
* Active mode
* Flags
* LEDs vector
* LED alternate names vector
* Modes vector
* Colors vector
* Zones vector
* Add CONTROLLER_FLAG_HIDDEN to allow plugins to hide controllers from control GUI
* Add update reason codes to RGBController update callback and signal updates on more RGBController events
* Add loop zone types and segmented zone type
* Add matrix map field to segments
79 lines
2.6 KiB
C++
79 lines
2.6 KiB
C++
/*---------------------------------------------------------*\
|
|
| RGBController_MNTKeyboard.cpp |
|
|
| |
|
|
| Driver for the MNT Reform keyboards |
|
|
| |
|
|
| Christian Heller <c.heller@plomlompom.de> 7 Aug 2024 |
|
|
| |
|
|
| This file is part of the OpenRGB project |
|
|
| SPDX-License-Identifier: GPL-2.0-or-later |
|
|
\*---------------------------------------------------------*/
|
|
|
|
#include "RGBController_MNTKeyboard.h"
|
|
|
|
void RGBController_MNTKeyboard::CommonInit()
|
|
{
|
|
vendor = "MNT Research";
|
|
type = DEVICE_TYPE_KEYBOARD;
|
|
location = controller->location;
|
|
modes.resize(1);
|
|
modes[0].name = "Direct";
|
|
modes[0].flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
|
modes[0].color_mode = MODE_COLORS_PER_LED;
|
|
SetupZones();
|
|
SetAllColors(ToRGBColor(255, 255, 255));
|
|
DeviceUpdateLEDs();
|
|
}
|
|
|
|
RGBController_MNTKeyboard::~RGBController_MNTKeyboard()
|
|
{
|
|
delete zones[0].matrix_map;
|
|
delete controller;
|
|
}
|
|
|
|
void RGBController_MNTKeyboard::SetupZones()
|
|
{
|
|
zone new_zone;
|
|
new_zone.type = ZONE_TYPE_MATRIX;
|
|
new_zone.leds_count = KBD_ROWS * controller->kbd_cols;
|
|
new_zone.matrix_map = new matrix_map_type;
|
|
new_zone.matrix_map->height = KBD_ROWS;
|
|
new_zone.matrix_map->width = controller->kbd_cols;
|
|
new_zone.matrix_map->map = (unsigned int *)matrix_keys;
|
|
zones.push_back(new_zone);
|
|
for(unsigned int led_idx = 0; led_idx < zones[0].leds_count; led_idx++)
|
|
{
|
|
led new_led;
|
|
new_led.name = led_names[led_idx];
|
|
leds.push_back(new_led);
|
|
}
|
|
SetupColors();
|
|
}
|
|
|
|
void RGBController_MNTKeyboard::DeviceUpdateLEDs()
|
|
{
|
|
unsigned char *color_map = new unsigned char[zones[0].leds_count * KBD_COLOR_SIZE];
|
|
for(unsigned int led_idx = 0; led_idx < zones[0].leds_count; led_idx++)
|
|
{
|
|
RGBColor color = colors[led_idx];
|
|
int offset = led_idx * KBD_COLOR_SIZE;
|
|
color_map[offset + 2] = RGBGetRValue(color);
|
|
color_map[offset + 1] = RGBGetGValue(color);
|
|
color_map[offset + 0] = RGBGetBValue(color);
|
|
}
|
|
controller->SendColorMatrix(color_map);
|
|
delete[] color_map;
|
|
}
|
|
|
|
void RGBController_MNTKeyboard::DeviceUpdateZoneLEDs(int)
|
|
{
|
|
DeviceUpdateLEDs();
|
|
}
|
|
void RGBController_MNTKeyboard::DeviceUpdateSingleLED(int)
|
|
{
|
|
DeviceUpdateLEDs();
|
|
}
|
|
void RGBController_MNTKeyboard::DeviceUpdateMode()
|
|
{
|
|
}
|