Add new Controller Nollie16
This commit is contained in:
parent
999bb03a45
commit
68a3cc43d9
5 changed files with 39 additions and 16 deletions
|
|
@ -11,14 +11,11 @@
|
||||||
|
|
||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
NollieController::NollieController(hid_device* dev_handle, const char* path, unsigned short /*pid*/)
|
NollieController::NollieController(hid_device* dev_handle, const char* path, unsigned short pid)
|
||||||
{
|
{
|
||||||
dev = dev_handle;
|
dev = dev_handle;
|
||||||
location = path;
|
location = path;
|
||||||
/*-----------------------------------------------------*\
|
usb_pid = pid;
|
||||||
| PID may be used in the future, here is to pass |
|
|
||||||
| arguments not to do storage |
|
|
||||||
\*-----------------------------------------------------*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string NollieController::GetLocationString()
|
std::string NollieController::GetLocationString()
|
||||||
|
|
@ -42,6 +39,11 @@ std::string NollieController::GetSerialString()
|
||||||
return(return_string);
|
return(return_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned short NollieController::GetUSBPID()
|
||||||
|
{
|
||||||
|
return(usb_pid);
|
||||||
|
}
|
||||||
|
|
||||||
void NollieController::SetMos(bool mos)
|
void NollieController::SetMos(bool mos)
|
||||||
{
|
{
|
||||||
unsigned char usb_buf[65];
|
unsigned char usb_buf[65];
|
||||||
|
|
|
||||||
|
|
@ -19,10 +19,12 @@ public:
|
||||||
NollieController(hid_device* dev_handle, const char* path, unsigned short pid);
|
NollieController(hid_device* dev_handle, const char* path, unsigned short pid);
|
||||||
std::string GetLocationString();
|
std::string GetLocationString();
|
||||||
std::string GetSerialString();
|
std::string GetSerialString();
|
||||||
|
unsigned short GetUSBPID();
|
||||||
void SetMos(bool mos);
|
void SetMos(bool mos);
|
||||||
void SetChannelLEDs(unsigned char channel, RGBColor * colors, unsigned int num_colors);
|
void SetChannelLEDs(unsigned char channel, RGBColor * colors, unsigned int num_colors);
|
||||||
private:
|
private:
|
||||||
hid_device* dev;
|
hid_device* dev;
|
||||||
std::string location;
|
std::string location;
|
||||||
|
unsigned short usb_pid;
|
||||||
void SendPacket(unsigned char channel,RGBColor * colors,unsigned int num_colors);
|
void SendPacket(unsigned char channel,RGBColor * colors,unsigned int num_colors);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -34,4 +34,5 @@ void DetectNollieControllers(hid_device_info* info, const std::string& name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
REGISTER_HID_DETECTOR("Nollie 32CH", DetectNollieControllers, NOLLIE_32_VID, NOLLIE_32_PID);
|
REGISTER_HID_DETECTOR("Nollie 32CH", DetectNollieControllers, NOLLIE32_VID, NOLLIE32_PID);
|
||||||
|
REGISTER_HID_DETECTOR("Nollie 16CH", DetectNollieControllers, NOLLIE16_VID, NOLLIE16_PID);
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,9 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
int channel_index[32] = {5, 4, 3, 2, 1, 0, 15, 14, 26, 27, 28, 29, 30, 31, 8, 9, 19, 18, 17, 16, 7, 6, 25, 24, 23, 22, 21, 20, 13, 12, 11, 10};
|
int channel_index[32] = {0};
|
||||||
|
int ch32[32] = {5, 4, 3, 2, 1, 0, 15, 14, 26, 27, 28, 29, 30, 31, 8, 9, 19, 18, 17, 16, 7, 6, 25, 24, 23, 22, 21, 20, 13, 12, 11, 10};
|
||||||
|
int ch16[32] = {19, 18, 17, 16, 24, 25, 26, 27, 20, 21, 22, 23, 31, 30, 29, 28, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
|
||||||
RGBController_Nollie::RGBController_Nollie(NollieController* controller_ptr)
|
RGBController_Nollie::RGBController_Nollie(NollieController* controller_ptr)
|
||||||
{
|
{
|
||||||
controller = controller_ptr;
|
controller = controller_ptr;
|
||||||
|
|
@ -44,14 +45,26 @@ RGBController_Nollie::~RGBController_Nollie()
|
||||||
void RGBController_Nollie::SetupZones()
|
void RGBController_Nollie::SetupZones()
|
||||||
{
|
{
|
||||||
bool first_run = false;
|
bool first_run = false;
|
||||||
|
unsigned int channels_num = 0;
|
||||||
if(zones.size() == 0)
|
if(zones.size() == 0)
|
||||||
{
|
{
|
||||||
first_run = true;
|
first_run = true;
|
||||||
}
|
}
|
||||||
leds.clear();
|
leds.clear();
|
||||||
colors.clear();
|
colors.clear();
|
||||||
zones.resize(NOLLIE_CHANNELS_NUM);
|
switch(controller->GetUSBPID())
|
||||||
for(unsigned int channel_idx = 0; channel_idx < NOLLIE_CHANNELS_NUM; channel_idx++)
|
{
|
||||||
|
case NOLLIE32_PID:
|
||||||
|
channels_num = 32;
|
||||||
|
memcpy(channel_index,ch32,sizeof(ch32));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
channels_num = 16;
|
||||||
|
memcpy(channel_index,ch16,sizeof(ch16));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
zones.resize(channels_num);
|
||||||
|
for(unsigned int channel_idx = 0; channel_idx < channels_num; channel_idx++)
|
||||||
{
|
{
|
||||||
if(channel_idx > 27 )
|
if(channel_idx > 27 )
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -11,10 +11,15 @@
|
||||||
#include "RGBController.h"
|
#include "RGBController.h"
|
||||||
#include "NollieController.h"
|
#include "NollieController.h"
|
||||||
|
|
||||||
#define NOLLIE_CHANNELS_LED_NUM 256
|
#define NOLLIE_CHANNELS_LED_NUM 256
|
||||||
#define NOLLIE_CHANNELS_NUM 32
|
|
||||||
#define NOLLIE_32_PID 0x4714
|
#define NOLLIE32_CHANNELS_NUM 32
|
||||||
#define NOLLIE_32_VID 0x3061
|
#define NOLLIE32_PID 0x4714
|
||||||
|
#define NOLLIE32_VID 0x3061
|
||||||
|
|
||||||
|
#define NOLLIE16_CHANNELS_NUM 16
|
||||||
|
#define NOLLIE16_PID 0x4716
|
||||||
|
#define NOLLIE16_VID 0x3061
|
||||||
|
|
||||||
class RGBController_Nollie : public RGBController
|
class RGBController_Nollie : public RGBController
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue