Add support for Corsair Lighting Pro
[temp2RGB.git] / src / tests.rs
index 08e6bd0..1321005 100644 (file)
@@ -2,18 +2,27 @@ use std::collections::HashMap;
 
 use wmi::{COMLibrary, Variant, WMIConnection};
 
-use crate::{a770, corsair_vengeance, rgb::RGB, sensors_jiji, AsusAuraUSB};
+use crate::{
+    a770, asus_aura_usb, corsair_lighting_pro, corsair_vengeance, cpu_temperature, machine,
+    rgb::RGB, winring0, wrapper_winring0,
+};
 
 pub fn tests() {
     println!("Running some tests...");
 
-    test_asus_aura_usb(AsusAuraUSB::Motherboard::AsusCrosshairVIIIHero);
+    winring0::init();
+
+    // test_asus_aura_usb(asus_aura_usb::Motherboard::AsusCrosshairVIIIHero);
+    // test_corsair_lighting_pro();
     // list_usb_devices();
     // test_roccat();
     // test_wmi();
     // test_corsair();
     // test_a770();
-    // test_read_temp();
+    test_read_temperature_cpu();
+    // test_read_temperatur_a770
+
+    winring0::deinit();
 
     println!("Press any key to continue...");
     std::io::stdin().read_line(&mut String::new()).unwrap();
@@ -72,10 +81,10 @@ fn list_usb_devices() {
 //     );
 // }
 
-fn test_asus_aura_usb(motherboard: AsusAuraUSB::Motherboard) {
+fn test_asus_aura_usb(motherboard: asus_aura_usb::Motherboard) {
     let api = hidapi::HidApi::new().unwrap();
 
-    let device = AsusAuraUSB::Device::new(&api, motherboard);
+    let device = asus_aura_usb::Device::new(&api, motherboard);
 
     println!("Firmware: {}", device.get_firmware_string());
 
@@ -103,6 +112,17 @@ fn test_asus_aura_usb(motherboard: AsusAuraUSB::Motherboard) {
     device.save_current_color();
 }
 
+fn test_corsair_lighting_pro() {
+    let api = hidapi::HidApi::new().unwrap();
+    let device = corsair_lighting_pro::Device::new(&api);
+
+    device.set_color(&RGB {
+        red: 0,
+        green: 0,
+        blue: 255,
+    });
+}
+
 fn test_corsair() {
     let corsair_controllers = [
         corsair_vengeance::Controller::new(0x19),
@@ -123,8 +143,16 @@ fn test_a770() {
     a770.set_color(255, 0, 0);
 }
 
-fn test_read_temp() {
-    let sensors = sensors_jiji::Sensors::new();
-    println!("temp cpu: {}", sensors.read_cpu_temp());
-    println!("temp gpu: {}", sensors.read_gpu_temp());
+const F17H_M01H_THM_TCON_CUR_TMP: u32 = 0x00059800;
+const F17H_TEMP_OFFSET_FLAG: u32 = 0x80000;
+const FAMILY_17H_PCI_CONTROL_REGISTER: u32 = 0x60;
+
+fn test_read_temperature_cpu() {
+    println!("temp cpu: {}", cpu_temperature::read())
 }
+
+fn test_read_temperatur_a770() {
+    let jiji: &dyn machine::Machine = &machine::MachineJiji::new();
+    println!("temp gpu: {}", jiji.get_gpu_tmp());
+}
+