mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2026-04-04 06:11:07 -04:00
Invert colors depending on the boards DMI (For MSI RGB boards)
Commits in pull request !147 squashed and minor code style changes by Adam Honse <calcprogrammer1@gmail.com>
This commit is contained in:
@@ -10,11 +10,45 @@
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "MSIRGBController.h"
|
||||
#include "dependencies/dmiinfo.h"
|
||||
#include "super_io.h"
|
||||
|
||||
#define NUM_INVERTED_DEVICES (sizeof(inverted_devices) / sizeof(inverted_devices[0]))
|
||||
|
||||
/*-------------------------------------------------------------------------*\
|
||||
| This is a list of DMI info for boards which need the inversion flag set |
|
||||
\*-------------------------------------------------------------------------*/
|
||||
static const char * inverted_devices[21] =
|
||||
{
|
||||
"7B89",
|
||||
"7B90",
|
||||
"7B19",
|
||||
"7C02",
|
||||
"7B75",
|
||||
"7B22",
|
||||
"7B23",
|
||||
"7B24",
|
||||
"7B27",
|
||||
"7B30",
|
||||
"7B31",
|
||||
"7B51",
|
||||
"7C04",
|
||||
"7C00",
|
||||
"7B98",
|
||||
"7C22",
|
||||
"7C24",
|
||||
"7C01",
|
||||
"7C39",
|
||||
"7B86",
|
||||
"7B87"
|
||||
};
|
||||
|
||||
MSIRGBController::MSIRGBController(int sioaddr)
|
||||
{
|
||||
msi_sioaddr = sioaddr;
|
||||
DMIInfo board;
|
||||
|
||||
std::string board_dmi = board.getMainboard();
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| This setup step isn't well documented |
|
||||
@@ -50,10 +84,21 @@ MSIRGBController::MSIRGBController(int sioaddr)
|
||||
\*-----------------------------------------------------*/
|
||||
superio_outb(msi_sioaddr, MSI_SIO_RGB_REG_CFG_1, 0x00);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Lighting enabled, RGB non-inverted, header on |
|
||||
\*-----------------------------------------------------*/
|
||||
superio_outb(msi_sioaddr, MSI_SIO_RGB_REG_CFG_3, 0xE2);
|
||||
/*--------------------------------------------------------------*\
|
||||
| Header on, pulse deactivated, colors inverted depending on DMI |
|
||||
\*--------------------------------------------------------------*/
|
||||
unsigned char ff_val = 0b11100010;
|
||||
|
||||
for(unsigned int i = 0; i < NUM_INVERTED_DEVICES; i++)
|
||||
{
|
||||
if (board_dmi.find(std::string(inverted_devices[i])) != std::string::npos)
|
||||
{
|
||||
ff_val |= 0b00011100;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
superio_outb(msi_sioaddr, MSI_SIO_RGB_REG_CFG_3, ff_val);
|
||||
}
|
||||
|
||||
MSIRGBController::~MSIRGBController()
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include <string>
|
||||
|
||||
#pragma once
|
||||
|
||||
#define MSI_SIO_LOGDEV_RGB 0x12
|
||||
|
||||
Reference in New Issue
Block a user