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

Method GetMode

Controllers/ZotacV2GPUController/ZotacV2GPUController.cpp:87–134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85}
86
87bool ZotacV2GPUController::GetMode(int zone, int idleActive, int& syncMode, ZotacV2GPUZone& zoneConfig, bool& on)
88{
89 u8 data_pkt[] =
90 {
91 ZOTAC_V2_GPU_REG_RGB,
92 0xF0,
93 0x00,
94 0x00,
95 0x00,
96 (u8)idleActive,
97 (u8)zone,
98 0x00,
99 };
100
101 if(bus->i2c_write_block(dev, sizeof(data_pkt), data_pkt) < 0)
102 {
103 return false;
104 }
105
106
107 u8 rdata_pkt[I2C_SMBUS_BLOCK_MAX] = { 0x00 };
108 int rdata_len = sizeof(rdata_pkt);
109 if(bus->i2c_read_block(dev, &rdata_len, rdata_pkt) < 0)
110 {
111 return false;
112 }
113
114 bool readReset;
115 int readZone;
116 int readIdleActive;
117 if(!ParseCommand(on, readReset, readZone, readIdleActive, syncMode, zoneConfig))
118 {
119 return false;
120 }
121
122 if(readReset != 0)
123 {
124 LOG_WARNING("Reset byte was not 0?!");
125 }
126
127 if(readZone != zone || readIdleActive != idleActive)
128 {
129 LOG_WARNING("Got unexpected data - expected to recieve data for (%d, %d) but got for (%d, %d)", zone, idleActive, readZone, readIdleActive);
130 return false;
131 }
132
133 return true;
134}
135
136bool ZotacV2GPUController::SendCommand(bool on, bool reset, int zone, int idleActive, int syncMode, ZotacV2GPUZone zoneConfig)
137{

Callers 1

SetupInitialValuesMethod · 0.45

Calls 2

i2c_write_blockMethod · 0.80
i2c_read_blockMethod · 0.80

Tested by

no test coverage detected