Initial commit for HID LampArray Controller

This commit is contained in:
Adam Honse
2024-03-31 01:03:12 -05:00
parent 1676693b96
commit 4f59845e65
5 changed files with 150 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
#include "HIDLampArrayController.h"
HIDLampArrayController::HIDLampArrayController(hid_device *dev_handle, const char *path)
{
}
HIDLampArrayController::~HIDLampArrayController()
{
}
std::string HIDLampArrayController::GetDeviceLocation()
{
}
std::string HIDLampArrayController::GetSerialString()
{
}

View File

@@ -0,0 +1,20 @@
#pragma once
#include <string>
#include <hidapi/hidapi.h>
#include "RGBController.h"
class HIDLampArrayController
{
public:
HIDLampArrayController(hid_device *dev_handle, const char *path);
~HIDLampArrayController();
std::string GetDeviceLocation();
std::string GetSerialString();
private:
hid_device *dev;
std::string location;
};

View File

@@ -0,0 +1,22 @@
#include "Detector.h"
#include "HIDLampArrayController.h"
#include "RGBController.h"
#include "RGBController_HIDLampArray.h"
#include <vector>
#include <hidapi/hidapi.h>
void DetectHIDLampArrayControllers(hid_device_info* info, const std::string& name)
{
hid_device* dev = hid_open_path(info->path);
if(dev)
{
HIDLampArrayController* controller = new HIDLampArrayController(dev, info->path);
RGBController_HIDLampArray* rgb_controller = new RGBController_HIDLampArray(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
} /* DetectHIDLampArrayControllers() */
REGISTER_HID_DETECTOR("Arduino Zero HID Lamp Array Demo", DetectHIDLampArrayControllers, 0x2341, 0x804D);

View File

@@ -0,0 +1,57 @@
#include "RGBController_HIDLampArray.h"
RGBController_HIDLampArray::RGBController_HIDLampArray(HIDLampArrayController* controller_ptr)
{
controller = controller_ptr;
name = "HID LampArray Device";
vendor = "Generic";
type = DEVICE_TYPE_MOUSEMAT;
description = "HID LampArray Device";
location = controller->GetDeviceLocation();
serial = controller->GetSerialString();
mode Direct;
Direct.name = "Direct";
Direct.value = 0;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
SetupZones();
}
RGBController_HIDLampArray::~RGBController_HIDLampArray()
{
}
void RGBController_HIDLampArray::SetupZones()
{
}
void RGBController_HIDLampArray::ResizeZone(int /*zone*/, int /*new_size*/)
{
}
void RGBController_HIDLampArray::DeviceUpdateLEDs()
{
}
void RGBController_HIDLampArray::UpdateZoneLEDs(int /*zone*/)
{
}
void RGBController_HIDLampArray::UpdateSingleLED(int /*led*/)
{
}
void RGBController_HIDLampArray::DeviceUpdateMode()
{
}

View File

@@ -0,0 +1,30 @@
/*-----------------------------------------------------*\
| RGBController_HIDLampArray.h |
| |
| Generic RGB Interface HID LampArray Devices |
| |
| Adam Honse <calcprogrammer1@gmail.com> 3/26/2024 |
\*-----------------------------------------------------*/
#pragma once
#include "RGBController.h"
#include "HIDLampArrayController.h"
class RGBController_HIDLampArray : public RGBController
{
public:
RGBController_HIDLampArray(HIDLampArrayController* controller_ptr);
~RGBController_HIDLampArray();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void DeviceUpdateMode();
private:
HIDLampArrayController* controller;
};