mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2026-02-22 01:58:44 -05:00
MNTKeyboardController: Add support for the MNT Reform and MNT Pocket Reform RGB keyboards
This commit is contained in:
31
Controllers/MNTKeyboardController/MNTKeyboardController.cpp
Normal file
31
Controllers/MNTKeyboardController/MNTKeyboardController.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| MNTKeyboardController.cpp |
|
||||
| |
|
||||
| Driver for the MNT Reform keyboards |
|
||||
| |
|
||||
| Christian Heller <c.heller@plomlompom.de> 7 Aug 2024 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "MNTKeyboardController.h"
|
||||
|
||||
MNTKeyboardController::~MNTKeyboardController()
|
||||
{
|
||||
hid_close(dev);
|
||||
}
|
||||
|
||||
void MNTKeyboardController::SendColorMatrix(unsigned char *color_map)
|
||||
{
|
||||
unsigned char row_size = kbd_cols * KBD_COLOR_SIZE;
|
||||
unsigned char cmdbuf_size = CMD_OFFSET + row_size;
|
||||
unsigned char usb_buf[cmdbuf_size];
|
||||
memcpy(usb_buf, CMD_PREFIX, CMD_PREFIX_LEN);
|
||||
for(unsigned int row_idx = 0; row_idx < KBD_ROWS; row_idx++)
|
||||
{
|
||||
usb_buf[CMD_PREFIX_LEN] = row_idx;
|
||||
memcpy(usb_buf + CMD_OFFSET, color_map + row_idx * row_size, row_size);
|
||||
hid_write(dev, usb_buf, cmdbuf_size);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user