MCPcopy Create free account
hub / github.com/CalcProgrammer1/OpenRGB / SetRGB

Method SetRGB

Controllers/LinuxLEDController/LinuxLEDController.cpp:46–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44}
45
46void LinuxLEDController::SetRGB(unsigned char red, unsigned char grn, unsigned char blu)
47{
48 std::string brightness_str;
49
50 /*-------------------------------------------------------------*\
51 | My phone LED that I tested this on shuts down if you set zero |
52 \*-------------------------------------------------------------*/
53 if(red == 0) red = 1;
54 if(grn == 0) grn = 1;
55 if(blu == 0) blu = 1;
56
57 brightness_str = std::to_string((unsigned int)red);
58
59 led_r_brightness.write(brightness_str.c_str(), brightness_str.length());
60 led_r_brightness.flush();
61
62 brightness_str = std::to_string((unsigned int)grn);
63
64 led_g_brightness.write(brightness_str.c_str(), brightness_str.length());
65 led_g_brightness.flush();
66
67 brightness_str = std::to_string((unsigned int)blu);
68
69 led_b_brightness.write(brightness_str.c_str(), brightness_str.length());
70 led_b_brightness.flush();
71}

Callers 1

DeviceUpdateLEDsMethod · 0.80

Calls 3

to_stringFunction · 0.85
flushMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected