3 const VID
: u16 = 0x1E7D;
4 const PID
: u16 = 0x2E2C;
5 const INTERFACE
: i32 = 0x00;
6 const PAGE
: u16 = 0x0B;
7 const USAGE
: u16 = 0x00;
9 pub fn get_device(api
: &hidapi
::HidApi
) -> hidapi
::HidDevice
{
13 device
.vendor_id() == VID
14 && device
.product_id() == PID
15 && device
.interface_number() == INTERFACE
16 && device
.usage_page() == PAGE
17 && device
.usage() == USAGE
20 device_info
.open_device(&api
).unwrap()
23 pub fn init(device
: &hidapi
::HidDevice
) {
24 let mut buffer
= [0u8; 6];
34 .send_feature_report(&buffer
)
35 .expect("Cannot send feature report during init");
38 pub fn set_color(device
: &hidapi
::HidDevice
, color
: &RGB
) {
39 let mut buffer
= [0u8; 46];
52 let offset
= i
* 4 + 2;
53 buffer
[offset
] = color
.red
;
54 buffer
[offset
+ 1] = color
.green
;
55 buffer
[offset
+ 2] = color
.blue
;
59 .send_feature_report(&buffer
)
60 .expect("Cannot send feature report during set color");