Implement 'set_color' for corsair lighting pro
[temp2RGB.git] / src / asus_aura_usb.rs
index 74face1..01590c0 100644 (file)
@@ -28,18 +28,22 @@ pub struct Device {
 
 impl Device {
     pub fn new(api: &hidapi::HidApi, motherboard: Motherboard) -> Self {
-        Device {
-            device: api
-                .open(
-                    VID,
-                    match motherboard {
-                        Motherboard::Asus650e => PID_650_E,
-                        Motherboard::AsusCrosshairVIIIHero => PID_CROSSHAIR,
-                    },
-                )
-                .unwrap(),
-            motherboard,
-        }
+        let device =
+            Device {
+                device: api
+                    .open(
+                        VID,
+                        match motherboard {
+                            Motherboard::Asus650e => PID_650_E,
+                            Motherboard::AsusCrosshairVIIIHero => PID_CROSSHAIR,
+                        },
+                    )
+                    .unwrap(),
+                motherboard,
+            };
+
+        device.set_fixed_mode();
+        device
     }
 
     pub fn get_firmware_string(&self) -> String {
@@ -91,7 +95,7 @@ impl Device {
             .expect("slice with incorrect length")
     }
 
-    pub fn set_fixed_mode(&self) {
+    fn set_fixed_mode(&self) {
         let mut buffer = [0u8; 65];
         buffer[0] = 0xEC;
         buffer[1] = 0x35; // Control mode.