Windows library for controlling lights on Corsair RGB keyboards
MIT License
This is an attempt at a windows based library to develop effects for the Corsair RGB keyboard range. Corsair said they would release a LUA library but I haven't heard anything for a while, so feel free to fork and use this until they do.
I only have an ISO (UK) Layout Corsair K70 RGB so the only keymap I have tested in keymaps.h is for that model. Anyone with other models (K95/K65) or other layouts from around the world are welcome to come up with some keymaps and test them.
The code is very rough. This is my first time making a library with C++, and I barely know C++ as it is. So if you have any feedback on how to structure code feel free to raise an issue or send me a pull request as I'm treating this as a learning exercise too.
See the example folder in the pre-built.zip to see some code and a pre-built binary to do some stuff with the library as it is now.
Demo of the library using LibCorsairRGBTest.cpp
If you want to build the library yourself, see below for build instructions, otherwise unzip pre-built.zip somewhere on your disk (C:\dev\LibCorsairRGB for example).
Assuming C++/Visual Studio 2012 use:
When you build, make sure the LibCorsairRGB.dll is in the output directory, you can do this in the properties too (Project Properties -> Configuration Properties -> Build Events -> Post-Build Event -> Command Line = 'xcopy /y "C:\dev\LibCorsairRGB\LibCorsairRGB.dll" "$(OutDir)") and when running set it to run in the OutDir context (Project Properties -> Configuration Properties -> Debugging -> Working Directory = $(OutDir))
I prefixed them all with lcrgb_ so they should be easy to find:
lcrgb_initialise();
lcrgb_deinitialise();
lcrgb_set_keymap(keymap);
lcrgb_key_enum
). Valid keymap params:lcrgb_ISO_UK
(default)
lcrgb_ASCII_US
lcrgb_set_position(unsigned char x, unsigned char y, unsigned char r, unsigned char g, unsigned char b);
lcrgb_set_key(lcrgb_key_enum key, unsigned char r, unsigned char g, unsigned char b);
lcrgb_key_enum
enumlcrgb_set_key_code(unsigned char key_code, unsigned char r, unsigned char g, unsigned char b);
lcrgb_flush_light_buffer();
lcrgb_set_verbosity_level();
Important: Before running anything using libusb for the first time you need to install some drivers for libusb to work with, see here for information on how to set up the libusb drivers for windows: https://github.com/libusb/libusb/wiki/Windows#Driver_Installation (I personally used the Zadig automated driver installer for WinUSB on Windows 7).
I'm using VS2012 and libusb-1.0.19. I'd suggest
the easiest way to build my library is to grab the pre-built binaries for libusb:
http://sourceforge.net/projects/libusb/files/libusb-1.0/libusb-1.0.19/libusb-1.0.19.7z/download
and link against the static lib in libusb-1.0.19\MS32\static
Link libusb and then build the solution and you should get a dll, lib and have the header files handy to do with whatever you like.
All of the hard USB work had been done by others, all I'm trying to do with this is package it into a single library which I can anywhere to set the colours of keys.
Most credit goes to: https://github.com/CalcProgrammer1/CorsairKeyboardSpectrograph/ Where I have just straight up ripped the USB protocol work and colour setting code. I'm planning to look in to this and see if it can be tweaked for my uses later.