Code cleanup round 3
This commit is contained in:
parent
97e154ea84
commit
c09e4c9c92
52 changed files with 2953 additions and 3065 deletions
|
|
@ -15,9 +15,10 @@
|
|||
void DetectDuckyKeyboardControllers(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
if( dev )
|
||||
|
||||
if(dev)
|
||||
{
|
||||
DuckyKeyboardController* controller = new DuckyKeyboardController(dev, info->path, info->product_id);
|
||||
DuckyKeyboardController* controller = new DuckyKeyboardController(dev, info->path, info->product_id);
|
||||
RGBController_DuckyKeyboard* rgb_controller = new RGBController_DuckyKeyboard(controller);
|
||||
rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
|
|
|
|||
|
|
@ -185,16 +185,16 @@ static const char *led_names[] =
|
|||
"Key: Number Pad Enter",
|
||||
};
|
||||
|
||||
RGBController_DuckyKeyboard::RGBController_DuckyKeyboard(DuckyKeyboardController* ducky_ptr)
|
||||
RGBController_DuckyKeyboard::RGBController_DuckyKeyboard(DuckyKeyboardController* controller_ptr)
|
||||
{
|
||||
ducky = ducky_ptr;
|
||||
controller = controller_ptr;
|
||||
|
||||
name = "Ducky Keyboard Device";
|
||||
vendor = "Ducky";
|
||||
type = DEVICE_TYPE_KEYBOARD;
|
||||
description = "Ducky Keyboard Device";
|
||||
location = ducky->GetDeviceLocation();
|
||||
serial = ducky->GetSerialString();
|
||||
location = controller->GetDeviceLocation();
|
||||
serial = controller->GetSerialString();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
|
|
@ -219,7 +219,7 @@ RGBController_DuckyKeyboard::~RGBController_DuckyKeyboard()
|
|||
}
|
||||
}
|
||||
|
||||
delete ducky;
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_DuckyKeyboard::SetupZones()
|
||||
|
|
@ -234,7 +234,7 @@ void RGBController_DuckyKeyboard::SetupZones()
|
|||
unsigned int matrix_width = 0;
|
||||
unsigned int* matrix_map_ptr = NULL;
|
||||
|
||||
switch(ducky->GetUSBPID())
|
||||
switch(controller->GetUSBPID())
|
||||
{
|
||||
case DUCKY_SHINE_7_ONE_2_RGB_PID:
|
||||
zone_size = zone_sizes[zone_idx];
|
||||
|
|
@ -292,7 +292,7 @@ void RGBController_DuckyKeyboard::DeviceUpdateLEDs()
|
|||
colordata[(color_idx*3)+2] = RGBGetBValue(colors[color_idx]);
|
||||
}
|
||||
|
||||
ducky->SendColors(colordata, sizeof(colordata));
|
||||
controller->SendColors(colordata, sizeof(colordata));
|
||||
}
|
||||
|
||||
void RGBController_DuckyKeyboard::UpdateZoneLEDs(int /*zone*/)
|
||||
|
|
|
|||
|
|
@ -1,33 +1,33 @@
|
|||
/*-----------------------------------------*\
|
||||
| RGBController_DuckyKeyboard.h |
|
||||
| |
|
||||
| Generic RGB Interface for Ducky RGB |
|
||||
| keyboard devices |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 7/4/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "DuckyKeyboardController.h"
|
||||
|
||||
class RGBController_DuckyKeyboard : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_DuckyKeyboard(DuckyKeyboardController* ducky_ptr);
|
||||
~RGBController_DuckyKeyboard();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
DuckyKeyboardController* ducky;
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_DuckyKeyboard.h |
|
||||
| |
|
||||
| Generic RGB Interface for Ducky RGB |
|
||||
| keyboard devices |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 7/4/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "DuckyKeyboardController.h"
|
||||
|
||||
class RGBController_DuckyKeyboard : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_DuckyKeyboard(DuckyKeyboardController* controller_ptr);
|
||||
~RGBController_DuckyKeyboard();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
DuckyKeyboardController* controller;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue