JGINYUE USB controller cleanup, fix multiple detection
This commit is contained in:
parent
82203b23d9
commit
2d990ca037
8 changed files with 557 additions and 547 deletions
|
|
@ -1,7 +1,7 @@
|
|||
/*-----------------------------------------*\
|
||||
| JginYueInternalUSBController.cpp |
|
||||
| JGINYUEInternalUSBController.cpp |
|
||||
| |
|
||||
| Driver for JginYue internal USB |
|
||||
| Driver for JGINYUE internal USB |
|
||||
| lighting controller |
|
||||
| |
|
||||
| Tong R (tcr020) 2023/08/09 |
|
||||
|
|
@ -10,6 +10,7 @@
|
|||
| Dongguan Yonghang Electronic |
|
||||
| Technology Co., Ltd |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include <stdio.h>
|
||||
|
|
@ -17,7 +18,7 @@
|
|||
#include "RGBController.h"
|
||||
#include "ResourceManager.h"
|
||||
#include "SettingsManager.h"
|
||||
#include "JginYueInternalUSBController.h"
|
||||
#include "JGINYUEInternalUSBController.h"
|
||||
#include "dependencies/dmiinfo.h"
|
||||
|
||||
#define JGINYUE_USB_GENERAL_COMMAND_HEADER 0x01
|
||||
|
|
@ -31,7 +32,7 @@
|
|||
#define JGINYUE_RG_SWAP 0x00
|
||||
|
||||
|
||||
JginYueInternalUSBController::JginYueInternalUSBController(hid_device* dev_handle, const char* path)
|
||||
JGINYUEInternalUSBController::JGINYUEInternalUSBController(hid_device* dev_handle, const char* path)
|
||||
{
|
||||
DMIInfo dmi;
|
||||
|
||||
|
|
@ -42,35 +43,36 @@ JginYueInternalUSBController::JginYueInternalUSBController(hid_device* dev_handl
|
|||
Init_device(device_config);
|
||||
}
|
||||
|
||||
JginYueInternalUSBController::~JginYueInternalUSBController()
|
||||
JGINYUEInternalUSBController::~JGINYUEInternalUSBController()
|
||||
{
|
||||
hid_close(dev);
|
||||
}
|
||||
unsigned int JginYueInternalUSBController::GetZoneCount()
|
||||
|
||||
unsigned int JGINYUEInternalUSBController::GetZoneCount()
|
||||
{
|
||||
return(JGINYUE_MAX_ZONES);
|
||||
}
|
||||
|
||||
std::string JginYueInternalUSBController::GetDeviceLocation()
|
||||
std::string JGINYUEInternalUSBController::GetDeviceLocation()
|
||||
{
|
||||
return("HID:" + location);
|
||||
}
|
||||
|
||||
std::string JginYueInternalUSBController::GetDeviceName()
|
||||
std::string JGINYUEInternalUSBController::GetDeviceName()
|
||||
{
|
||||
return(device_name);
|
||||
}
|
||||
|
||||
std::string JginYueInternalUSBController::GetSerialString()
|
||||
std::string JGINYUEInternalUSBController::GetSerialString()
|
||||
{
|
||||
return("");
|
||||
}
|
||||
|
||||
std::string JginYueInternalUSBController::GetDeviceFWVirson()
|
||||
std::string JGINYUEInternalUSBController::GetDeviceFWVersion()
|
||||
{
|
||||
unsigned char usb_buf[16];
|
||||
|
||||
memset(usb_buf,0x00,sizeof(usb_buf));
|
||||
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||
|
||||
usb_buf[0x00] = JGINYUE_USB_GENERAL_COMMAND_HEADER;
|
||||
usb_buf[0x01] = JGINYUE_USB_GET_FW_VERSION;
|
||||
|
|
@ -78,35 +80,33 @@ std::string JginYueInternalUSBController::GetDeviceFWVirson()
|
|||
hid_write(dev, usb_buf, 16);
|
||||
hid_read(dev, usb_buf, 16);
|
||||
|
||||
if((usb_buf[0x00]!=JGINYUE_USB_GENERAL_COMMAND_HEADER)||(usb_buf[0x01]!=JGINYUE_USB_GET_FW_REPLY))
|
||||
if((usb_buf[0x00] != JGINYUE_USB_GENERAL_COMMAND_HEADER) || (usb_buf[0x01] != JGINYUE_USB_GET_FW_REPLY))
|
||||
{
|
||||
return ("");
|
||||
return("");
|
||||
}
|
||||
|
||||
std::string Major_virson = std::to_string(usb_buf[0x02]);
|
||||
std::string Minor_virson = std::to_string(usb_buf[0x03]);
|
||||
|
||||
return ("Major_virson " + Major_virson + " Minor_virson " + Minor_virson);
|
||||
std::string Major_version = std::to_string(usb_buf[0x02]);
|
||||
std::string Minor_version = std::to_string(usb_buf[0x03]);
|
||||
|
||||
return(Major_version + "." + Minor_version);
|
||||
}
|
||||
|
||||
|
||||
void JginYueInternalUSBController::Init_device(AreaConfiguration* ptr_device_cfg)
|
||||
void JGINYUEInternalUSBController::Init_device(AreaConfiguration* ptr_device_cfg)
|
||||
{
|
||||
for(int index_config=1; index_config <=JGINYUE_MAX_ZONES; index_config++)
|
||||
for(int index_config = 1; index_config <= JGINYUE_MAX_ZONES; index_config++)
|
||||
{
|
||||
ptr_device_cfg[index_config].Brightness = JGINYUE_USB_BRIGHTNESS_DEFAULT;
|
||||
ptr_device_cfg[index_config].Color_B = 0xFF;
|
||||
ptr_device_cfg[index_config].Color_G = 0xFF;
|
||||
ptr_device_cfg[index_config].Color_R = 0xFF;
|
||||
ptr_device_cfg[index_config].RG_Swap = JGINYUE_RG_DEFAULT;
|
||||
ptr_device_cfg[index_config].Speed = JGINYUE_USB_SPEED_DEFAULT;
|
||||
ptr_device_cfg[index_config].LED_numbers = JGINYUE_ADDRESSABLE_MAX_LEDS;
|
||||
ptr_device_cfg[index_config].Mode_active = JGINYUE_USB_MODE_STATIC;
|
||||
ptr_device_cfg[index_config].Brightness = JGINYUE_USB_BRIGHTNESS_DEFAULT;
|
||||
ptr_device_cfg[index_config].Color_B = 0xFF;
|
||||
ptr_device_cfg[index_config].Color_G = 0xFF;
|
||||
ptr_device_cfg[index_config].Color_R = 0xFF;
|
||||
ptr_device_cfg[index_config].RG_Swap = JGINYUE_RG_DEFAULT;
|
||||
ptr_device_cfg[index_config].Speed = JGINYUE_USB_SPEED_DEFAULT;
|
||||
ptr_device_cfg[index_config].LED_numbers = JGINYUE_ADDRESSABLE_MAX_LEDS;
|
||||
ptr_device_cfg[index_config].Mode_active = JGINYUE_USB_MODE_STATIC;
|
||||
}
|
||||
}
|
||||
|
||||
void JginYueInternalUSBController::WriteZoneMode
|
||||
void JGINYUEInternalUSBController::WriteZoneMode
|
||||
(
|
||||
unsigned char zone,
|
||||
unsigned char mode,
|
||||
|
|
@ -118,27 +118,29 @@ void JginYueInternalUSBController::WriteZoneMode
|
|||
{
|
||||
int Active_zone;
|
||||
unsigned char usb_buf[65];
|
||||
switch (zone)
|
||||
|
||||
switch(zone)
|
||||
{
|
||||
case 0x01:
|
||||
Active_zone=1;
|
||||
Active_zone = 1;
|
||||
break;
|
||||
case 0x02:
|
||||
Active_zone=2;
|
||||
Active_zone = 2;
|
||||
break;
|
||||
default:
|
||||
Active_zone=1;
|
||||
Active_zone = 1;
|
||||
return;
|
||||
break;
|
||||
}
|
||||
device_config[Active_zone].Mode_active = mode;
|
||||
device_config[Active_zone].Direct_Mode_control = 0x00;
|
||||
device_config[Active_zone].Speed = speed;
|
||||
device_config[Active_zone].Brightness = brightness;
|
||||
device_config[Active_zone].Direction = direction;
|
||||
device_config[Active_zone].Color_B = RGBGetBValue(rgb);
|
||||
device_config[Active_zone].Color_G = RGBGetGValue(rgb);
|
||||
device_config[Active_zone].Color_R = RGBGetRValue(rgb);
|
||||
|
||||
device_config[Active_zone].Mode_active = mode;
|
||||
device_config[Active_zone].Direct_Mode_control = 0x00;
|
||||
device_config[Active_zone].Speed = speed;
|
||||
device_config[Active_zone].Brightness = brightness;
|
||||
device_config[Active_zone].Direction = direction;
|
||||
device_config[Active_zone].Color_B = RGBGetBValue(rgb);
|
||||
device_config[Active_zone].Color_G = RGBGetGValue(rgb);
|
||||
device_config[Active_zone].Color_R = RGBGetRValue(rgb);
|
||||
|
||||
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||
|
||||
|
|
@ -148,6 +150,7 @@ void JginYueInternalUSBController::WriteZoneMode
|
|||
usb_buf[0x03] = device_config[Active_zone].RG_Swap;
|
||||
usb_buf[0x04] = device_config[Active_zone].Direction;
|
||||
usb_buf[0x05] = device_config[Active_zone].Direct_Mode_control;
|
||||
|
||||
hid_write(dev, usb_buf ,16);
|
||||
|
||||
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||
|
|
@ -160,10 +163,11 @@ void JginYueInternalUSBController::WriteZoneMode
|
|||
usb_buf[0x05] = device_config[Active_zone].Color_B;
|
||||
usb_buf[0x06] = device_config[Active_zone].Brightness;
|
||||
usb_buf[0x07] = device_config[Active_zone].Speed;
|
||||
hid_write(dev, usb_buf ,16);
|
||||
|
||||
hid_write(dev, usb_buf, 16);
|
||||
}
|
||||
|
||||
void JginYueInternalUSBController::DirectLEDControl
|
||||
void JGINYUEInternalUSBController::DirectLEDControl
|
||||
(
|
||||
RGBColor* colors,
|
||||
unsigned char zone
|
||||
|
|
@ -171,25 +175,26 @@ void JginYueInternalUSBController::DirectLEDControl
|
|||
{
|
||||
int Active_zone;
|
||||
unsigned char usb_buf[302];
|
||||
switch (zone)
|
||||
|
||||
switch(zone)
|
||||
{
|
||||
case 0x01:
|
||||
Active_zone=1;
|
||||
Active_zone = 1;
|
||||
break;
|
||||
case 0x02:
|
||||
Active_zone=2;
|
||||
Active_zone = 2;
|
||||
break;
|
||||
default:
|
||||
Active_zone=1;
|
||||
Active_zone = 1;
|
||||
return;
|
||||
break;
|
||||
}
|
||||
device_config[Active_zone].Mode_active=JGINYUE_USB_MODE_DIRECT;
|
||||
device_config[Active_zone].Direct_Mode_control=0x01;
|
||||
|
||||
device_config[Active_zone].Mode_active =JGINYUE_USB_MODE_DIRECT;
|
||||
device_config[Active_zone].Direct_Mode_control =0x01;
|
||||
|
||||
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||
|
||||
|
||||
usb_buf[0x00] = JGINYUE_USB_LED_STRIPE_SET_COMMAND_HEADER;
|
||||
usb_buf[0x01] = zone;
|
||||
usb_buf[0x02] = device_config[Active_zone].LED_numbers;
|
||||
|
|
@ -197,8 +202,10 @@ void JginYueInternalUSBController::DirectLEDControl
|
|||
usb_buf[0x04] = device_config[Active_zone].Direction;
|
||||
usb_buf[0x05] = device_config[Active_zone].Direct_Mode_control;
|
||||
|
||||
hid_write(dev, usb_buf ,16);
|
||||
hid_write(dev, usb_buf, 16);
|
||||
|
||||
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||
|
||||
usb_buf[0x00] = JGINYUE_USB_PER_LED_SET_COMMAND_HEADER;
|
||||
usb_buf[0x01] = zone;
|
||||
|
||||
|
|
@ -208,28 +215,30 @@ void JginYueInternalUSBController::DirectLEDControl
|
|||
usb_buf[color_idx * 3 + 3] = RGBGetGValue(colors[color_idx]);
|
||||
usb_buf[color_idx * 3 + 4] = RGBGetBValue(colors[color_idx]);
|
||||
}
|
||||
hid_send_feature_report(dev,usb_buf,302);
|
||||
|
||||
hid_send_feature_report(dev, usb_buf, 302);
|
||||
}
|
||||
|
||||
|
||||
void JginYueInternalUSBController::Area_resize(unsigned char led_numbers,unsigned char zone)
|
||||
void JGINYUEInternalUSBController::Area_resize(unsigned char led_numbers, unsigned char zone)
|
||||
{
|
||||
unsigned char usb_buf[65];
|
||||
int Active_zone;
|
||||
switch (zone)
|
||||
|
||||
switch(zone)
|
||||
{
|
||||
case 0x01:
|
||||
Active_zone=1;
|
||||
Active_zone = 1;
|
||||
break;
|
||||
case 0x02:
|
||||
Active_zone=2;
|
||||
Active_zone = 2;
|
||||
break;
|
||||
default:
|
||||
Active_zone=1;
|
||||
Active_zone = 1;
|
||||
return;
|
||||
break;
|
||||
}
|
||||
device_config[Active_zone].LED_numbers=led_numbers;
|
||||
|
||||
device_config[Active_zone].LED_numbers = led_numbers;
|
||||
|
||||
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||
|
||||
|
|
@ -239,12 +248,13 @@ void JginYueInternalUSBController::Area_resize(unsigned char led_numbers,unsigne
|
|||
usb_buf[0x03] = device_config[Active_zone].RG_Swap;
|
||||
usb_buf[0x04] = device_config[Active_zone].Direction;
|
||||
usb_buf[0x05] = device_config[Active_zone].Direct_Mode_control;
|
||||
hid_write(dev, usb_buf ,16);
|
||||
|
||||
hid_write(dev, usb_buf, 16);
|
||||
}
|
||||
|
||||
void JginYueInternalUSBController::SetRGSwap(unsigned char RGSwap)
|
||||
void JGINYUEInternalUSBController::SetRGSwap(unsigned char RGSwap)
|
||||
{
|
||||
if((RGSwap!=0x00)&&(RGSwap!=0x01))
|
||||
if((RGSwap != 0x00) && (RGSwap != 0x01))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -0,0 +1,110 @@
|
|||
/*-----------------------------------------*\
|
||||
| JGINYUEInternalUSBController.h |
|
||||
| |
|
||||
| Driver for JGINYUE internal USB |
|
||||
| lighting controller |
|
||||
| |
|
||||
| Tong R (tcr020) 2023/08/09 |
|
||||
| Liu ShiMeng(Moon dream stars) 2003/08/09|
|
||||
| |
|
||||
| Dongguan Yonghang Electronic |
|
||||
| Technology Co., Ltd |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include <hidapi/hidapi.h>
|
||||
#include <string>
|
||||
|
||||
#define JGINYUE_MAX_ZONES 2
|
||||
#define JGINYUE_ADDRESSABLE_MAX_LEDS 100
|
||||
|
||||
enum
|
||||
{
|
||||
JGINYUE_USB_MODE_OFF = 0x10,
|
||||
JGINYUE_USB_MODE_STATIC = 0x11,
|
||||
JGINYUE_USB_MODE_BREATHING = 0x12,
|
||||
JGINYUE_USB_MODE_STROBE = 0x13,
|
||||
JGINYUE_USB_MODE_CYCLING = 0x14,
|
||||
JGINYUE_USB_MODE_RANDOM = 0x15,
|
||||
JGINYUE_USB_MODE_MUSIC = 0x16, /* music mode,not support yet */
|
||||
JGINYUE_USB_MODE_WAVE = 0x17,
|
||||
JGINYUE_USB_MODE_SPRING = 0x18, /* spring mode,not support yet */
|
||||
JGINYUE_USB_MODE_WATER = 0x19,
|
||||
JGINYUE_USB_MODE_RAINBOW = 0x1A, /* rainbow mode,not support yet */
|
||||
JGINYUE_USB_MODE_DIRECT = 0x20, /* Not the exact USB protcol - but need a way to differentiate */
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
JGINYUE_USB_SPEED_MAX = 0xFF,
|
||||
JGINYUE_USB_SPEED_MIN = 0x00,
|
||||
JGINYUE_USB_SPEED_DEFAULT = 0x80
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
JGINYUE_DIRECTION_RIGHT = 0x00,
|
||||
JGINYUE_DIRECTION_LEFT = 0x01
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
JGINYUE_USB_BRIGHTNESS_MAX = 0xFF,
|
||||
JGINYUE_USB_BRIGHTNESS_MIN = 0x00,
|
||||
JGINYUE_USB_BRIGHTNESS_DEFAULT = 0xFF
|
||||
};
|
||||
|
||||
struct AreaConfiguration
|
||||
{
|
||||
unsigned char LED_numbers;
|
||||
unsigned char RG_Swap;
|
||||
unsigned char Direction;
|
||||
unsigned char Direct_Mode_control; /* 0x00 = Disabled, 0x01 = Enabled */
|
||||
unsigned char Mode_active;
|
||||
unsigned char Color_R;
|
||||
unsigned char Color_G;
|
||||
unsigned char Color_B;
|
||||
unsigned char Brightness;
|
||||
unsigned char Speed;
|
||||
};
|
||||
|
||||
class JGINYUEInternalUSBController
|
||||
{
|
||||
public:
|
||||
JGINYUEInternalUSBController(hid_device* dev_handle, const char* path);
|
||||
~JGINYUEInternalUSBController();
|
||||
|
||||
unsigned int GetZoneCount();
|
||||
std::string GetDeviceLocation();
|
||||
std::string GetDeviceName();
|
||||
std::string GetSerialString();
|
||||
std::string GetDeviceFWVersion();
|
||||
|
||||
void WriteZoneMode
|
||||
(
|
||||
unsigned char zone,
|
||||
unsigned char mode,
|
||||
RGBColor rgb,
|
||||
unsigned char speed,
|
||||
unsigned char brightness,
|
||||
unsigned char direction
|
||||
);
|
||||
|
||||
void DirectLEDControl
|
||||
(
|
||||
RGBColor* colors,
|
||||
unsigned char zone
|
||||
);
|
||||
|
||||
void SetRGSwap(unsigned char RGSwap);
|
||||
void Init_device(AreaConfiguration* ptr_device_cfg);
|
||||
void Area_resize(unsigned char led_numbers,unsigned char zone);
|
||||
|
||||
private:
|
||||
AreaConfiguration device_config[8];
|
||||
hid_device* dev;
|
||||
std::string location;
|
||||
std::string device_name;
|
||||
};
|
||||
|
|
@ -1,9 +1,7 @@
|
|||
#include "RGBController_JginYueInternalUSB.h"
|
||||
#include "JginYueInternalUSBController.h"
|
||||
#include "RGBController_JGINYUEInternalUSB.h"
|
||||
#include "JGINYUEInternalUSBController.h"
|
||||
#include "RGBController.h"
|
||||
#include "Detector.h"
|
||||
#include "i2c_smbus.h"
|
||||
#include "pci_ids.h"
|
||||
#include <vector>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
|
@ -15,20 +13,20 @@
|
|||
#define JGINYUE_VID 0x0416
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| JGINYUE product ID |
|
||||
| JGINYUE product ID |
|
||||
\*---------------------------------------------------------*/
|
||||
#define JGINYUE_MOTHERBOARD_PID 0xA125
|
||||
|
||||
void DetectJginYueInternalUSBController(hid_device_info* info,const std::string& /*name*/)
|
||||
void DetectJGINYUEInternalUSBController(hid_device_info* info,const std::string& /*name*/)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
|
||||
if(dev)
|
||||
{
|
||||
JginYueInternalUSBController* controller =new JginYueInternalUSBController(dev,info->path);
|
||||
RGBController_JginYueInternalUSB* rgb_controller =new RGBController_JginYueInternalUSB(controller);
|
||||
JGINYUEInternalUSBController* controller =new JGINYUEInternalUSBController(dev,info->path);
|
||||
RGBController_JGINYUEInternalUSB* rgb_controller =new RGBController_JGINYUEInternalUSB(controller);
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
||||
REGISTER_HID_DETECTOR("JginYue Internal USB Controller",DetectJginYueInternalUSBController,JGINYUE_VID,JGINYUE_MOTHERBOARD_PID);
|
||||
REGISTER_HID_DETECTOR_IPU("JGINYUE Internal USB Controller", DetectJGINYUEInternalUSBController, JGINYUE_VID, JGINYUE_MOTHERBOARD_PID, 0, 0xFF00, 1);
|
||||
|
|
@ -0,0 +1,356 @@
|
|||
/*------------------------------------------------*\
|
||||
| RGBController_JGINYUEInternalUSB.cpp |
|
||||
| |
|
||||
| Generic RGB Interface JGINYUEInternalUSB Class |
|
||||
| |
|
||||
| Tong R (tcr020) 2023/08/09 |
|
||||
| Liu ShiMeng (Moon dream stars) 2003/08/09 |
|
||||
| |
|
||||
| Dongguan Yonghang Electronic Technology Co., Ltd|
|
||||
\*------------------------------------------------*/
|
||||
|
||||
#include "RGBController_JGINYUEInternalUSB.h"
|
||||
#include <string.h>
|
||||
|
||||
#define JGINYUE_MAX_ZONES 2
|
||||
#define JGINYUE_ADDRESSABLE_MAX_LEDS 100
|
||||
/**------------------------------------------------------------------*\
|
||||
@name JGINYUEInternalUSB
|
||||
@category MotherBoard
|
||||
@type USB
|
||||
@save :x:
|
||||
@direct :white_check_mark:
|
||||
@effects :white_check_mark:
|
||||
@detectors DetectJGINYUEInternalUSB
|
||||
@comment Insert multiline JGINYUEInternalUSB comment here
|
||||
\*--------------------------------------------------------------------*/
|
||||
|
||||
RGBController_JGINYUEInternalUSB::RGBController_JGINYUEInternalUSB(JGINYUEInternalUSBController* controller_ptr)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
|
||||
name = controller->GetDeviceName();
|
||||
description = "JGINYUE USB ARGB Device";
|
||||
vendor = "JGINYUE";
|
||||
type = DEVICE_TYPE_MOTHERBOARD;
|
||||
location = controller->GetDeviceLocation();
|
||||
version = controller->GetDeviceFWVersion();
|
||||
|
||||
mode Off;
|
||||
Off.name = "Off";
|
||||
Off.value = JGINYUE_USB_MODE_OFF;
|
||||
Off.flags = 0;
|
||||
Off.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Off);
|
||||
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
Static.value = JGINYUE_USB_MODE_STATIC;
|
||||
Static.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
|
||||
Static.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Static.colors_max = 1;
|
||||
Static.colors_min = 1;
|
||||
Static.colors.resize(1);
|
||||
modes.push_back(Static);
|
||||
|
||||
mode Breathing;
|
||||
Breathing.name = "Breathing";
|
||||
Breathing.value = JGINYUE_USB_MODE_BREATHING;
|
||||
Breathing.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Breathing.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Breathing.colors_max = 1;
|
||||
Breathing.colors_min = 1;
|
||||
Breathing.brightness = JGINYUE_USB_BRIGHTNESS_DEFAULT;
|
||||
Breathing.brightness_max = JGINYUE_USB_BRIGHTNESS_MAX;
|
||||
Breathing.brightness_min = JGINYUE_USB_BRIGHTNESS_MIN;
|
||||
Breathing.speed = JGINYUE_USB_SPEED_DEFAULT;
|
||||
Breathing.speed_max = JGINYUE_USB_SPEED_MAX;
|
||||
Breathing.speed_min = JGINYUE_USB_SPEED_MIN;
|
||||
Breathing.colors.resize(1);
|
||||
modes.push_back(Breathing);
|
||||
|
||||
mode Strobe;
|
||||
Strobe.name = "Strobe";
|
||||
Strobe.value = JGINYUE_USB_MODE_STROBE;
|
||||
Strobe.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Strobe.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Strobe.colors_max = 1;
|
||||
Strobe.colors_min = 1;
|
||||
Strobe.brightness = JGINYUE_USB_BRIGHTNESS_DEFAULT;
|
||||
Strobe.brightness_max = JGINYUE_USB_BRIGHTNESS_MAX;
|
||||
Strobe.brightness_min = JGINYUE_USB_BRIGHTNESS_MIN;
|
||||
Strobe.speed = JGINYUE_USB_SPEED_DEFAULT;
|
||||
Strobe.speed_max = JGINYUE_USB_SPEED_MAX;
|
||||
Strobe.speed_min = JGINYUE_USB_SPEED_MIN;
|
||||
Strobe.colors.resize(1);
|
||||
modes.push_back(Strobe);
|
||||
|
||||
mode Cycling;
|
||||
Cycling.name = "Cycling";
|
||||
Cycling.value = JGINYUE_USB_MODE_CYCLING;
|
||||
Cycling.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Cycling.color_mode = MODE_COLORS_NONE;
|
||||
Cycling.brightness = JGINYUE_USB_BRIGHTNESS_DEFAULT;
|
||||
Cycling.brightness_max = JGINYUE_USB_BRIGHTNESS_MAX;
|
||||
Cycling.brightness_min = JGINYUE_USB_BRIGHTNESS_MIN;
|
||||
Cycling.speed = JGINYUE_USB_SPEED_DEFAULT;
|
||||
Cycling.speed_max = JGINYUE_USB_SPEED_MAX;
|
||||
Cycling.speed_min = JGINYUE_USB_SPEED_MIN;
|
||||
modes.push_back(Cycling);
|
||||
|
||||
mode Random;
|
||||
Random.name = "Random";
|
||||
Random.value = JGINYUE_USB_MODE_RANDOM;
|
||||
Random.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Random.color_mode = MODE_COLORS_NONE;
|
||||
Random.brightness = JGINYUE_USB_BRIGHTNESS_DEFAULT;
|
||||
Random.brightness_max = JGINYUE_USB_BRIGHTNESS_MAX;
|
||||
Random.brightness_min = JGINYUE_USB_BRIGHTNESS_MIN;
|
||||
Random.speed = JGINYUE_USB_SPEED_DEFAULT;
|
||||
Random.speed_max = JGINYUE_USB_SPEED_MAX;
|
||||
Random.speed_min = JGINYUE_USB_SPEED_MIN;
|
||||
modes.push_back(Random);
|
||||
|
||||
mode Wave;
|
||||
Wave.name = "Wave";
|
||||
Wave.value = JGINYUE_USB_MODE_WAVE;
|
||||
Wave.flags = MODE_FLAG_HAS_SPEED;
|
||||
Wave.color_mode = MODE_COLORS_NONE;
|
||||
Wave.speed = JGINYUE_USB_SPEED_DEFAULT;
|
||||
Wave.speed_max = JGINYUE_USB_SPEED_MAX;
|
||||
Wave.speed_min = JGINYUE_USB_SPEED_MIN;
|
||||
modes.push_back(Wave);
|
||||
|
||||
//mode Spring;
|
||||
//Spring.name = "Spring";
|
||||
//Spring.value = JGINYUE_USB_MODE_SPRING;
|
||||
//Spring.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_DIRECTION_LR;
|
||||
//Spring.color_mode = MODE_COLORS_NONE;
|
||||
//Spring.brightness = JGINYUE_USB_BRIGHTNESS_DEFAULT;
|
||||
//Spring.brightness_max = JGINYUE_USB_BRIGHTNESS_MAX;
|
||||
//Spring.brightness_min = JGINYUE_USB_BRIGHTNESS_MIN;
|
||||
//Spring.speed = JGINYUE_USB_SPEED_DEFAULT;
|
||||
//Spring.speed_max = JGINYUE_USB_SPEED_MAX;
|
||||
//Spring.speed_min = JGINYUE_USB_SPEED_MIN;
|
||||
//Spring.direction = 0x00;
|
||||
//modes.push_back(Spring);
|
||||
|
||||
mode Water;
|
||||
Water.name = "Water";
|
||||
Water.value = JGINYUE_USB_MODE_WATER;
|
||||
Water.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_DIRECTION_LR;
|
||||
Water.color_mode = MODE_COLORS_NONE;
|
||||
Water.brightness = JGINYUE_USB_BRIGHTNESS_DEFAULT;
|
||||
Water.brightness_max = JGINYUE_USB_BRIGHTNESS_MAX;
|
||||
Water.brightness_min = JGINYUE_USB_BRIGHTNESS_MIN;
|
||||
Water.speed = JGINYUE_USB_SPEED_DEFAULT;
|
||||
Water.speed_max = JGINYUE_USB_SPEED_MAX;
|
||||
Water.speed_min = JGINYUE_USB_SPEED_MIN;
|
||||
Water.direction = MODE_DIRECTION_RIGHT;
|
||||
modes.push_back(Water);
|
||||
|
||||
//mode Rainbow;
|
||||
//Rainbow.name = "Rainbow";
|
||||
//Rainbow.value = JGINYUE_USB_MODE_RAINBOW;
|
||||
//Rainbow.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_DIRECTION_LR;
|
||||
//Rainbow.color_mode = MODE_COLORS_NONE;
|
||||
//Rainbow.brightness = JGINYUE_USB_BRIGHTNESS_DEFAULT;
|
||||
//Rainbow.brightness_max = JGINYUE_USB_BRIGHTNESS_MAX;
|
||||
//Rainbow.brightness_min = JGINYUE_USB_BRIGHTNESS_MIN;
|
||||
//Rainbow.speed = JGINYUE_USB_SPEED_DEFAULT;
|
||||
//Rainbow.speed_max = JGINYUE_USB_SPEED_MAX;
|
||||
//Rainbow.speed_min = JGINYUE_USB_SPEED_MIN;
|
||||
//Rainbow.direction = MODE_DIRECTION_RIGHT;
|
||||
//modes.push_back(Rainbow);
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = JGINYUE_USB_MODE_DIRECT;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
void RGBController_JGINYUEInternalUSB::SetupZones()
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| Only set LED count on the first run |
|
||||
\*-------------------------------------------------*/
|
||||
bool first_run = false;
|
||||
|
||||
if(zones.size() == 0)
|
||||
{
|
||||
first_run = true;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Clear any existing color/LED configuration |
|
||||
\*-------------------------------------------------*/
|
||||
leds.clear();
|
||||
colors.clear();
|
||||
zones.resize(JGINYUE_MAX_ZONES);
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Set zones and leds |
|
||||
\*-------------------------------------------------*/
|
||||
zones[0].name = "ARGB_Header_1";
|
||||
zones[0].type = ZONE_TYPE_LINEAR;
|
||||
zones[0].leds_min = 0;
|
||||
zones[0].leds_max = 100;
|
||||
zones[0].matrix_map = NULL;
|
||||
|
||||
zones[1].name = "ARGB_Header_2";
|
||||
zones[1].type = ZONE_TYPE_LINEAR;
|
||||
zones[1].leds_min = 0;
|
||||
zones[1].leds_max = 100;
|
||||
zones[1].matrix_map = NULL;
|
||||
|
||||
if(first_run)
|
||||
{
|
||||
zones[0].leds_count = 0;
|
||||
zones[1].leds_count = 0;
|
||||
}
|
||||
|
||||
for(unsigned int led_idx = 0 , j=1; led_idx < zones[0].leds_count + zones[1].leds_count ; led_idx++)
|
||||
{
|
||||
if(led_idx==zones[0].leds_count)
|
||||
{
|
||||
j = 1;
|
||||
}
|
||||
|
||||
if(led_idx<zones[0].leds_count)
|
||||
{
|
||||
led ARGB_1_HEADER;
|
||||
ARGB_1_HEADER.name = "ARGB Header 1 LED " + std::to_string(j);
|
||||
ARGB_1_HEADER.value = 0;
|
||||
leds.push_back(ARGB_1_HEADER);
|
||||
}
|
||||
else
|
||||
{
|
||||
led ARGB_2_HEADER;
|
||||
ARGB_2_HEADER.name = "ARGB Header 2 LED " + std::to_string(j);
|
||||
ARGB_2_HEADER.value = 1;
|
||||
leds.push_back(ARGB_2_HEADER);
|
||||
}
|
||||
|
||||
j++;
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_JGINYUEInternalUSB::ResizeZone(int zone, int new_size)
|
||||
{
|
||||
unsigned char area;
|
||||
|
||||
switch(zone)
|
||||
{
|
||||
case 0:
|
||||
area = 0x01;
|
||||
break;
|
||||
case 1:
|
||||
area = 0x02;
|
||||
break;
|
||||
default:
|
||||
area = 0x01;
|
||||
break;
|
||||
}
|
||||
|
||||
zones[zone].leds_count = new_size;
|
||||
|
||||
SetupZones();
|
||||
|
||||
controller->Area_resize(new_size, area);
|
||||
}
|
||||
|
||||
void RGBController_JGINYUEInternalUSB::DeviceUpdateLEDs()
|
||||
{
|
||||
for(int i = 0; i < JGINYUE_MAX_ZONES; i++)
|
||||
{
|
||||
UpdateZoneLEDs(i);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_JGINYUEInternalUSB::UpdateZoneLEDs(int zone)
|
||||
{
|
||||
unsigned char area;
|
||||
|
||||
switch(zone)
|
||||
{
|
||||
case 0:
|
||||
area = 0x01;
|
||||
break;
|
||||
case 1:
|
||||
area = 0x02;
|
||||
break;
|
||||
default:
|
||||
area = 0x01;
|
||||
break;
|
||||
}
|
||||
|
||||
controller->DirectLEDControl(zones[zone].colors,area);
|
||||
}
|
||||
|
||||
void RGBController_JGINYUEInternalUSB::UpdateSingleLED(int led)
|
||||
{
|
||||
int zone;
|
||||
zone = leds[led].value;
|
||||
UpdateZoneLEDs(zone);
|
||||
}
|
||||
|
||||
void RGBController_JGINYUEInternalUSB::DeviceUpdateMode()
|
||||
{
|
||||
unsigned char area;
|
||||
|
||||
if(modes[active_mode].value == JGINYUE_USB_MODE_DIRECT)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned char aim_direction = JGINYUE_DIRECTION_RIGHT;
|
||||
unsigned char aim_speed = JGINYUE_USB_SPEED_DEFAULT;
|
||||
unsigned char aim_brightness = JGINYUE_USB_BRIGHTNESS_DEFAULT;
|
||||
RGBColor aim_rgb = 0x00FFFFFF;
|
||||
|
||||
if(modes[active_mode].flags & MODE_FLAG_HAS_DIRECTION_LR)
|
||||
{
|
||||
aim_direction = modes[active_mode].direction;
|
||||
}
|
||||
|
||||
if(modes[active_mode].flags & MODE_FLAG_HAS_SPEED)
|
||||
{
|
||||
aim_speed = modes[active_mode].speed;
|
||||
}
|
||||
|
||||
if(modes[active_mode].flags & MODE_FLAG_HAS_BRIGHTNESS)
|
||||
{
|
||||
aim_brightness = modes[active_mode].brightness;
|
||||
}
|
||||
|
||||
if(modes[active_mode].flags & MODE_FLAG_HAS_MODE_SPECIFIC_COLOR)
|
||||
{
|
||||
aim_rgb = modes[active_mode].colors[0];
|
||||
}
|
||||
|
||||
for(int zone_index = 0; zone_index < JGINYUE_MAX_ZONES; zone_index++)
|
||||
{
|
||||
switch(zone_index)
|
||||
{
|
||||
case 0:
|
||||
area = 0x01;
|
||||
break;
|
||||
case 1:
|
||||
area = 0x02;
|
||||
break;
|
||||
default:
|
||||
area = 0x01;
|
||||
break;
|
||||
}
|
||||
|
||||
controller->WriteZoneMode(area, modes[active_mode].value, aim_rgb, aim_speed, aim_brightness, aim_direction);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
/*------------------------------------------------*\
|
||||
| RGBController_JginYueInternalUSB.h |
|
||||
| RGBController_JGINYUEInternalUSB.h |
|
||||
| |
|
||||
| Generic RGB Interface JginYueInternalUSB Class |
|
||||
| Generic RGB Interface JGINYUEInternalUSB Class |
|
||||
| |
|
||||
| Tong R (tcr020) 2023/08/09 |
|
||||
| Liu ShiMeng (Moon dream stars) 2003/08/09 |
|
||||
|
|
@ -12,12 +12,12 @@
|
|||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "JginYueInternalUSBController.h"
|
||||
#include "JGINYUEInternalUSBController.h"
|
||||
|
||||
class RGBController_JginYueInternalUSB : public RGBController
|
||||
class RGBController_JGINYUEInternalUSB : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_JginYueInternalUSB(JginYueInternalUSBController* controller_ptr);
|
||||
RGBController_JGINYUEInternalUSB(JGINYUEInternalUSBController* controller_ptr);
|
||||
|
||||
void SetupZones();
|
||||
|
||||
|
|
@ -30,5 +30,5 @@ public:
|
|||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
JginYueInternalUSBController* controller;
|
||||
JGINYUEInternalUSBController* controller;
|
||||
};
|
||||
|
|
@ -1,117 +0,0 @@
|
|||
/*-----------------------------------------*\
|
||||
| JginYueInternalUSBController.h |
|
||||
| |
|
||||
| Driver for JginYue internal USB |
|
||||
| lighting controller |
|
||||
| |
|
||||
| Tong R (tcr020) 2023/08/09 |
|
||||
| Liu ShiMeng(Moon dream stars) 2003/08/09|
|
||||
| |
|
||||
| Dongguan Yonghang Electronic |
|
||||
| Technology Co., Ltd |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController.h"
|
||||
#include <hidapi/hidapi.h>
|
||||
#include <string>
|
||||
|
||||
#pragma once
|
||||
#define JGINYUE_MAX_ZONES 2
|
||||
#define JGINYUE_ADDRESSABLE_MAX_LEDS 100
|
||||
|
||||
enum
|
||||
{
|
||||
JGINYUE_USB_MODE_OFF =0x10,
|
||||
JGINYUE_USB_MODE_STATIC =0x11,
|
||||
JGINYUE_USB_MODE_BREATHING =0x12,
|
||||
JGINYUE_USB_MODE_STROBE =0x13,
|
||||
JGINYUE_USB_MODE_CYCLING =0x14,
|
||||
JGINYUE_USB_MODE_RANDOM =0x15,
|
||||
JGINYUE_USB_MODE_MUSIC =0x16, /*music mode,not support yet */
|
||||
JGINYUE_USB_MODE_WAVE =0x17,
|
||||
JGINYUE_USB_MODE_SPRING =0x18, /*spring mode,not support yet */
|
||||
JGINYUE_USB_MODE_WATER =0x19,
|
||||
JGINYUE_USB_MODE_RAINBOW =0x1A, /*rainbow mode,not support yet */
|
||||
JGINYUE_USB_MODE_DIRECT =0x20, /*Not the exact USB protrol - but need a way to differentiate */
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
JGINYUE_USB_SPEED_MAX =0xFF,
|
||||
JGINYUE_USB_SPEED_MIN =0x00,
|
||||
JGINYUE_USB_SPEED_DEFAULT =0x80
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
JGINYUE_DIRECTION_RIGHT = 0x00,
|
||||
JGINYUE_DIRECTION_LEFT = 0x01
|
||||
};
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
JGINYUE_USB_BRIGHTNESS_MAX =0xFF,
|
||||
JGINYUE_USB_BRIGHTNESS_MIN =0x00,
|
||||
JGINYUE_USB_BRIGHTNESS_DEFAULT =0xFF
|
||||
};
|
||||
|
||||
|
||||
struct AreaConfiguration
|
||||
{
|
||||
unsigned char LED_numbers;
|
||||
unsigned char RG_Swap;
|
||||
unsigned char Direction;
|
||||
unsigned char Direct_Mode_control; /*0x00 = Disabled 0x01 = Enabled*/
|
||||
unsigned char Mode_active;
|
||||
unsigned char Color_R;
|
||||
unsigned char Color_G;
|
||||
unsigned char Color_B;
|
||||
unsigned char Brightness;
|
||||
unsigned char Speed;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
class JginYueInternalUSBController
|
||||
{
|
||||
public:
|
||||
|
||||
JginYueInternalUSBController(hid_device* dev_handle, const char* path);
|
||||
~JginYueInternalUSBController();
|
||||
|
||||
unsigned int GetZoneCount();
|
||||
std::string GetDeviceLocation();
|
||||
std::string GetDeviceName();
|
||||
std::string GetSerialString();
|
||||
std::string GetDeviceFWVirson();
|
||||
|
||||
void WriteZoneMode
|
||||
(
|
||||
unsigned char zone,
|
||||
unsigned char mode,
|
||||
RGBColor rgb,
|
||||
unsigned char speed,
|
||||
unsigned char brightness,
|
||||
unsigned char direction
|
||||
);
|
||||
|
||||
void DirectLEDControl
|
||||
(
|
||||
RGBColor* colors,
|
||||
unsigned char zone
|
||||
);
|
||||
|
||||
void SetRGSwap(unsigned char RGSwap);
|
||||
void Init_device(AreaConfiguration* ptr_device_cfg);
|
||||
void Area_resize(unsigned char led_numbers,unsigned char zone);
|
||||
|
||||
|
||||
|
||||
private:
|
||||
AreaConfiguration device_config[8];
|
||||
hid_device* dev;
|
||||
std::string location;
|
||||
std::string device_name;
|
||||
};
|
||||
|
|
@ -1,347 +0,0 @@
|
|||
/*------------------------------------------------*\
|
||||
| RGBController_JginYueInternalUSB.cpp |
|
||||
| |
|
||||
| Generic RGB Interface JginYueInternalUSB Class |
|
||||
| |
|
||||
| Tong R (tcr020) 2023/08/09 |
|
||||
| Liu ShiMeng (Moon dream stars) 2003/08/09 |
|
||||
| |
|
||||
| Dongguan Yonghang Electronic Technology Co., Ltd|
|
||||
\*------------------------------------------------*/
|
||||
|
||||
#include "RGBController_JginYueInternalUSB.h"
|
||||
#include <string.h>
|
||||
|
||||
#define JGINYUE_MAX_ZONES 2
|
||||
#define JGINYUE_ADDRESSABLE_MAX_LEDS 100
|
||||
/**------------------------------------------------------------------*\
|
||||
@name JginYueInternalUSB
|
||||
@category MotherBoard
|
||||
@type USB
|
||||
@save :x:
|
||||
@direct :white_check_mark:
|
||||
@effects :white_check_mark:
|
||||
@detectors DetectJginYueInternalUSB
|
||||
@comment Insert multiline JginYueInternalUSB comment here
|
||||
\*--------------------------------------------------------------------*/
|
||||
|
||||
RGBController_JginYueInternalUSB::RGBController_JginYueInternalUSB(JginYueInternalUSBController* controller_ptr)
|
||||
{
|
||||
controller =controller_ptr;
|
||||
|
||||
name =controller->GetDeviceName();
|
||||
description ="JGINYUE USB ARGB Device";
|
||||
vendor ="JGINYUE";
|
||||
type =DEVICE_TYPE_MOTHERBOARD;
|
||||
location =controller->GetDeviceLocation();
|
||||
version =controller->GetDeviceFWVirson();
|
||||
|
||||
mode Off;
|
||||
Off.name ="Off";
|
||||
Off.value =JGINYUE_USB_MODE_OFF;
|
||||
Off.flags =0;
|
||||
Off.color_mode =MODE_COLORS_NONE;
|
||||
modes.push_back(Off);
|
||||
|
||||
mode Static;
|
||||
Static.name ="Static";
|
||||
Static.value =JGINYUE_USB_MODE_STATIC;
|
||||
Static.flags =MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
|
||||
Static.color_mode =MODE_COLORS_MODE_SPECIFIC;
|
||||
Static.colors_max =1;
|
||||
Static.colors_min =1;
|
||||
Static.colors.resize(1);
|
||||
modes.push_back(Static);
|
||||
|
||||
mode Breathing;
|
||||
Breathing.name ="Breathing";
|
||||
Breathing.value =JGINYUE_USB_MODE_BREATHING;
|
||||
Breathing.flags =MODE_FLAG_HAS_MODE_SPECIFIC_COLOR|MODE_FLAG_HAS_SPEED|MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Breathing.color_mode =MODE_COLORS_MODE_SPECIFIC;
|
||||
Breathing.colors_max =1;
|
||||
Breathing.colors_min =1;
|
||||
Breathing.brightness =JGINYUE_USB_BRIGHTNESS_DEFAULT;
|
||||
Breathing.brightness_max =JGINYUE_USB_BRIGHTNESS_MAX;
|
||||
Breathing.brightness_min =JGINYUE_USB_BRIGHTNESS_MIN;
|
||||
Breathing.speed =JGINYUE_USB_SPEED_DEFAULT;
|
||||
Breathing.speed_max =JGINYUE_USB_SPEED_MAX;
|
||||
Breathing.speed_min =JGINYUE_USB_SPEED_MIN;
|
||||
Breathing.colors.resize(1);
|
||||
modes.push_back(Breathing);
|
||||
|
||||
mode Strobe;
|
||||
Strobe.name ="Strobe";
|
||||
Strobe.value =JGINYUE_USB_MODE_STROBE;
|
||||
Strobe.flags =MODE_FLAG_HAS_MODE_SPECIFIC_COLOR|MODE_FLAG_HAS_SPEED|MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Strobe.color_mode =MODE_COLORS_MODE_SPECIFIC;
|
||||
Strobe.colors_max =1;
|
||||
Strobe.colors_min =1;
|
||||
Strobe.brightness =JGINYUE_USB_BRIGHTNESS_DEFAULT;
|
||||
Strobe.brightness_max =JGINYUE_USB_BRIGHTNESS_MAX;
|
||||
Strobe.brightness_min =JGINYUE_USB_BRIGHTNESS_MIN;
|
||||
Strobe.speed =JGINYUE_USB_SPEED_DEFAULT;
|
||||
Strobe.speed_max =JGINYUE_USB_SPEED_MAX;
|
||||
Strobe.speed_min =JGINYUE_USB_SPEED_MIN;
|
||||
Strobe.colors.resize(1);
|
||||
modes.push_back(Strobe);
|
||||
|
||||
mode Cycling;
|
||||
Cycling.name ="Cycling";
|
||||
Cycling.value =JGINYUE_USB_MODE_CYCLING;
|
||||
Cycling.flags =MODE_FLAG_HAS_SPEED|MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Cycling.color_mode =MODE_COLORS_NONE;
|
||||
Cycling.brightness =JGINYUE_USB_BRIGHTNESS_DEFAULT;
|
||||
Cycling.brightness_max =JGINYUE_USB_BRIGHTNESS_MAX;
|
||||
Cycling.brightness_min =JGINYUE_USB_BRIGHTNESS_MIN;
|
||||
Cycling.speed =JGINYUE_USB_SPEED_DEFAULT;
|
||||
Cycling.speed_max =JGINYUE_USB_SPEED_MAX;
|
||||
Cycling.speed_min =JGINYUE_USB_SPEED_MIN;
|
||||
modes.push_back(Cycling);
|
||||
|
||||
mode Random;
|
||||
Random.name ="Random";
|
||||
Random.value =JGINYUE_USB_MODE_RANDOM;
|
||||
Random.flags =MODE_FLAG_HAS_SPEED|MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Random.color_mode =MODE_COLORS_NONE;
|
||||
Random.brightness =JGINYUE_USB_BRIGHTNESS_DEFAULT;
|
||||
Random.brightness_max =JGINYUE_USB_BRIGHTNESS_MAX;
|
||||
Random.brightness_min =JGINYUE_USB_BRIGHTNESS_MIN;
|
||||
Random.speed =JGINYUE_USB_SPEED_DEFAULT;
|
||||
Random.speed_max =JGINYUE_USB_SPEED_MAX;
|
||||
Random.speed_min =JGINYUE_USB_SPEED_MIN;
|
||||
modes.push_back(Random);
|
||||
|
||||
mode Wave;
|
||||
Wave.name ="Wave";
|
||||
Wave.value =JGINYUE_USB_MODE_WAVE;
|
||||
Wave.flags =MODE_FLAG_HAS_SPEED;
|
||||
Wave.color_mode =MODE_COLORS_NONE;
|
||||
Wave.speed =JGINYUE_USB_SPEED_DEFAULT;
|
||||
Wave.speed_max =JGINYUE_USB_SPEED_MAX;
|
||||
Wave.speed_min =JGINYUE_USB_SPEED_MIN;
|
||||
modes.push_back(Wave);
|
||||
|
||||
//mode Spring;
|
||||
//Spring.name ="Spring";
|
||||
//Spring.value =JGINYUE_USB_MODE_SPRING;
|
||||
//Spring.flags =MODE_FLAG_HAS_SPEED|MODE_FLAG_HAS_BRIGHTNESS|MODE_FLAG_HAS_DIRECTION_LR;
|
||||
//Spring.color_mode =MODE_COLORS_NONE;
|
||||
//Spring.brightness =JGINYUE_USB_BRIGHTNESS_DEFAULT;
|
||||
//Spring.brightness_max =JGINYUE_USB_BRIGHTNESS_MAX;
|
||||
//Spring.brightness_min =JGINYUE_USB_BRIGHTNESS_MIN;
|
||||
//Spring.speed =JGINYUE_USB_SPEED_DEFAULT;
|
||||
//Spring.speed_max =JGINYUE_USB_SPEED_MAX;
|
||||
//Spring.speed_min =JGINYUE_USB_SPEED_MIN;
|
||||
//Spring.direction =0x00;
|
||||
//modes.push_back(Spring);
|
||||
|
||||
mode Water;
|
||||
Water.name ="Water";
|
||||
Water.value =JGINYUE_USB_MODE_WATER;
|
||||
Water.flags =MODE_FLAG_HAS_SPEED|MODE_FLAG_HAS_BRIGHTNESS|MODE_FLAG_HAS_DIRECTION_LR;
|
||||
Water.color_mode =MODE_COLORS_NONE;
|
||||
Water.brightness =JGINYUE_USB_BRIGHTNESS_DEFAULT;
|
||||
Water.brightness_max =JGINYUE_USB_BRIGHTNESS_MAX;
|
||||
Water.brightness_min =JGINYUE_USB_BRIGHTNESS_MIN;
|
||||
Water.speed =JGINYUE_USB_SPEED_DEFAULT;
|
||||
Water.speed_max =JGINYUE_USB_SPEED_MAX;
|
||||
Water.speed_min =JGINYUE_USB_SPEED_MIN;
|
||||
Water.direction =MODE_DIRECTION_RIGHT;
|
||||
modes.push_back(Water);
|
||||
|
||||
//mode Rainbow;
|
||||
//Rainbow.name ="Rainbow";
|
||||
//Rainbow.value =JGINYUE_USB_MODE_RAINBOW;
|
||||
//Rainbow.flags =MODE_FLAG_HAS_SPEED|MODE_FLAG_HAS_BRIGHTNESS|MODE_FLAG_HAS_DIRECTION_LR;
|
||||
//Rainbow.color_mode =MODE_COLORS_NONE;
|
||||
//Rainbow.brightness =JGINYUE_USB_BRIGHTNESS_DEFAULT;
|
||||
//Rainbow.brightness_max =JGINYUE_USB_BRIGHTNESS_MAX;
|
||||
//Rainbow.brightness_min =JGINYUE_USB_BRIGHTNESS_MIN;
|
||||
//Rainbow.speed =JGINYUE_USB_SPEED_DEFAULT;
|
||||
//Rainbow.speed_max =JGINYUE_USB_SPEED_MAX;
|
||||
//Rainbow.speed_min =JGINYUE_USB_SPEED_MIN;
|
||||
//Rainbow.direction =MODE_DIRECTION_RIGHT;
|
||||
//modes.push_back(Rainbow);
|
||||
|
||||
mode Direct;
|
||||
Direct.name ="Direct";
|
||||
Direct.value =JGINYUE_USB_MODE_DIRECT;
|
||||
Direct.flags =MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode =MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void RGBController_JginYueInternalUSB::SetupZones()
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| Only set LED count on the first run |
|
||||
\*-------------------------------------------------*/
|
||||
bool first_run = false;
|
||||
|
||||
if(zones.size() == 0)
|
||||
{
|
||||
first_run = true;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Clear any existing color/LED configuration |
|
||||
\*-------------------------------------------------*/
|
||||
leds.clear();
|
||||
colors.clear();
|
||||
zones.resize(JGINYUE_MAX_ZONES);
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Set zones and leds |
|
||||
\*-------------------------------------------------*/
|
||||
zones[0].name = "ARGB_Header_1";
|
||||
zones[0].type = ZONE_TYPE_LINEAR;
|
||||
zones[0].leds_min = 1;
|
||||
zones[0].leds_max = 100;
|
||||
zones[0].matrix_map = NULL;
|
||||
|
||||
zones[1].name = "ARGB_Header_2";
|
||||
zones[1].type = ZONE_TYPE_LINEAR;
|
||||
zones[1].leds_min = 1;
|
||||
zones[1].leds_max = 100;
|
||||
zones[1].matrix_map = NULL;
|
||||
|
||||
if(first_run)
|
||||
{
|
||||
zones[0].leds_count=100;
|
||||
zones[1].leds_count=100;
|
||||
}
|
||||
|
||||
for (unsigned int led_idx = 0 , j=1; led_idx < zones[0].leds_count + zones[1].leds_count ; led_idx++)
|
||||
{
|
||||
if(led_idx==zones[0].leds_count) j=1;
|
||||
|
||||
if (led_idx<zones[0].leds_count)
|
||||
{
|
||||
led ARGB_1_HEADER;
|
||||
ARGB_1_HEADER.name = "ARGB_HEADER_1_LED No." + std::to_string(j);
|
||||
ARGB_1_HEADER.value = 0;
|
||||
leds.push_back(ARGB_1_HEADER);
|
||||
}
|
||||
else
|
||||
{
|
||||
led ARGB_2_HEADER;
|
||||
ARGB_2_HEADER.name = "ARGB_HEADER_2_LED No." + std::to_string(j);
|
||||
ARGB_2_HEADER.value = 1;
|
||||
leds.push_back(ARGB_2_HEADER);
|
||||
}
|
||||
j++;
|
||||
}
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_JginYueInternalUSB::ResizeZone(int zone, int new_size)
|
||||
{
|
||||
unsigned char area;
|
||||
switch (zone)
|
||||
{
|
||||
case 0:
|
||||
area = 0x01;
|
||||
break;
|
||||
case 1:
|
||||
area = 0x02;
|
||||
break;
|
||||
default:
|
||||
area = 0x01;
|
||||
break;
|
||||
}
|
||||
zones[zone].leds_count=new_size;
|
||||
SetupZones();
|
||||
controller->Area_resize(new_size,area);
|
||||
}
|
||||
|
||||
void RGBController_JginYueInternalUSB::DeviceUpdateLEDs()
|
||||
{
|
||||
for (int i = 0; i < JGINYUE_MAX_ZONES; i++)
|
||||
{
|
||||
UpdateZoneLEDs(i);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_JginYueInternalUSB::UpdateZoneLEDs(int zone)
|
||||
{
|
||||
unsigned char area;
|
||||
switch (zone)
|
||||
{
|
||||
case 0:
|
||||
area = 0x01;
|
||||
break;
|
||||
case 1:
|
||||
area = 0x02;
|
||||
break;
|
||||
default:
|
||||
area = 0x01;
|
||||
break;
|
||||
}
|
||||
controller->DirectLEDControl(zones[zone].colors,area);
|
||||
}
|
||||
|
||||
void RGBController_JginYueInternalUSB::UpdateSingleLED(int led)
|
||||
{
|
||||
int zone;
|
||||
zone = leds[led].value;
|
||||
UpdateZoneLEDs(zone);
|
||||
}
|
||||
|
||||
|
||||
void RGBController_JginYueInternalUSB::DeviceUpdateMode()
|
||||
{
|
||||
unsigned char area;
|
||||
|
||||
if(modes[active_mode].value == JGINYUE_USB_MODE_DIRECT)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned char aim_direction = JGINYUE_DIRECTION_RIGHT;
|
||||
unsigned char aim_speed = JGINYUE_USB_SPEED_DEFAULT;
|
||||
unsigned char aim_brightness = JGINYUE_USB_BRIGHTNESS_DEFAULT;
|
||||
RGBColor aim_rgb = 0x00FFFFFF;
|
||||
|
||||
if((modes[active_mode].flags & MODE_FLAG_HAS_DIRECTION_LR) )
|
||||
{
|
||||
aim_direction = modes[active_mode].direction;
|
||||
}
|
||||
|
||||
if((modes[active_mode].flags & MODE_FLAG_HAS_SPEED) )
|
||||
{
|
||||
aim_speed = modes[active_mode].speed;
|
||||
}
|
||||
|
||||
if((modes[active_mode].flags & MODE_FLAG_HAS_BRIGHTNESS) )
|
||||
{
|
||||
aim_brightness = modes[active_mode].brightness;
|
||||
}
|
||||
|
||||
if((modes[active_mode].flags & MODE_FLAG_HAS_MODE_SPECIFIC_COLOR) )
|
||||
{
|
||||
aim_rgb = modes[active_mode].colors[0];
|
||||
}
|
||||
for (int zone_index = 0; zone_index < JGINYUE_MAX_ZONES; zone_index++)
|
||||
{
|
||||
switch (zone_index)
|
||||
{
|
||||
case 0:
|
||||
area = 0x01;
|
||||
break;
|
||||
case 1:
|
||||
area = 0x02;
|
||||
break;
|
||||
default:
|
||||
area = 0x01;
|
||||
break;
|
||||
}
|
||||
controller->WriteZoneMode(area,modes[active_mode].value,aim_rgb,aim_speed,aim_brightness,aim_direction);
|
||||
}
|
||||
}
|
||||
}
|
||||
12
OpenRGB.pro
12
OpenRGB.pro
|
|
@ -179,7 +179,7 @@ INCLUDEPATH +=
|
|||
Controllers/HYTEMousematController/ \
|
||||
Controllers/IntelArcA770LEController/ \
|
||||
Controllers/IonicoController/ \
|
||||
Controllers/JginYueInternalUSBController/ \
|
||||
Controllers/JGINYUEInternalUSBController/ \
|
||||
Controllers/LEDStripController/ \
|
||||
Controllers/LegoDimensionsToypadBaseController/ \
|
||||
Controllers/LenovoControllers/ \
|
||||
|
|
@ -569,8 +569,8 @@ HEADERS +=
|
|||
Controllers/IntelArcA770LEController/RGBController_IntelArcA770LE.h \
|
||||
Controllers/IonicoController/IonicoController.h \
|
||||
Controllers/IonicoController/RGBController_Ionico.h \
|
||||
Controllers/JginYueInternalUSBController/JginYueInternalUSBController.h \
|
||||
Controllers/JginYueInternalUSBController/RGBController_JginYueInternalUSB.h \
|
||||
Controllers/JGINYUEInternalUSBController/JGINYUEInternalUSBController.h \
|
||||
Controllers/JGINYUEInternalUSBController/RGBController_JGINYUEInternalUSB.h \
|
||||
Controllers/KasaSmartController/KasaSmartController.h \
|
||||
Controllers/KasaSmartController/RGBController_KasaSmart.h \
|
||||
Controllers/KeychronKeyboardController/KeychronKeyboardController.h \
|
||||
|
|
@ -1265,9 +1265,9 @@ SOURCES +=
|
|||
Controllers/IonicoController/IonicoControllerDetect.cpp \
|
||||
Controllers/IonicoController/RGBController_Ionico.cpp \
|
||||
Controllers/IntelArcA770LEController/RGBController_IntelArcA770LE.cpp \
|
||||
Controllers/JginYueInternalUSBController/RGBController_JginYueInternalUSB.cpp \
|
||||
Controllers/JginYueInternalUSBController/JginYueInternalUSBController.cpp \
|
||||
Controllers/JginYueInternalUSBController/JginYueInternalUSBControllerDetect.cpp \
|
||||
Controllers/JGINYUEInternalUSBController/RGBController_JGINYUEInternalUSB.cpp \
|
||||
Controllers/JGINYUEInternalUSBController/JGINYUEInternalUSBController.cpp \
|
||||
Controllers/JGINYUEInternalUSBController/JGINYUEInternalUSBControllerDetect.cpp \
|
||||
Controllers/KasaSmartController/KasaSmartController.cpp \
|
||||
Controllers/KasaSmartController/KasaSmartControllerDetect.cpp \
|
||||
Controllers/KasaSmartController/RGBController_KasaSmart.cpp \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue