RGBController API Overhaul

* 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
    * Rework matrix_map_type from using pointers to vector to prevent memory leaks
    * Rework KeyboardLayoutManager to return new matrix_map_type
    * Add access mutex to RGBController API
    * Add per-zone modes ot RGBController API
    * Add JSON description functions to RGBController API
This commit is contained in:
Adam Honse
2025-09-23 20:38:37 -05:00
parent 6deaf2f4fd
commit fdaf2eee6c
657 changed files with 9060 additions and 8801 deletions

View File

@@ -21,13 +21,12 @@ void RGBController_MNTKeyboard::CommonInit()
modes[0].flags = MODE_FLAG_HAS_PER_LED_COLOR;
modes[0].color_mode = MODE_COLORS_PER_LED;
SetupZones();
SetAllLEDs(ToRGBColor(255, 255, 255));
SetAllColors(ToRGBColor(255, 255, 255));
DeviceUpdateLEDs();
}
RGBController_MNTKeyboard::~RGBController_MNTKeyboard()
{
delete zones[0].matrix_map;
delete controller;
}
@@ -36,10 +35,7 @@ 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;
new_zone.matrix_map.Set(KBD_ROWS, controller->kbd_cols, (unsigned int *)matrix_keys);
zones.push_back(new_zone);
for(unsigned int led_idx = 0; led_idx < zones[0].leds_count; led_idx++)
{
@@ -65,14 +61,11 @@ void RGBController_MNTKeyboard::DeviceUpdateLEDs()
delete[] color_map;
}
void RGBController_MNTKeyboard::ResizeZone(int, int)
{
}
void RGBController_MNTKeyboard::UpdateZoneLEDs(int)
void RGBController_MNTKeyboard::DeviceUpdateZoneLEDs(int)
{
DeviceUpdateLEDs();
}
void RGBController_MNTKeyboard::UpdateSingleLED(int)
void RGBController_MNTKeyboard::DeviceUpdateSingleLED(int)
{
DeviceUpdateLEDs();
}

View File

@@ -21,17 +21,19 @@ class RGBController_MNTKeyboard : public RGBController
{
public:
~RGBController_MNTKeyboard();
void SetupZones();
void DeviceUpdateLEDs();
void ResizeZone(int, int);
void UpdateZoneLEDs(int);
void UpdateSingleLED(int);
void SetupZones();
void DeviceUpdateLEDs();
void DeviceUpdateZoneLEDs(int);
void DeviceUpdateSingleLED(int);
void DeviceUpdateMode();
protected:
const char **led_names;
unsigned int *matrix_keys;
const char ** led_names;
unsigned int * matrix_keys;
MNTKeyboardController * controller;
void CommonInit();
MNTKeyboardController *controller;
};