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

Function i2c_dump

i2c_tools/i2c_tools.cpp:94–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

92\******************************************************************************************/
93
94std::string i2c_dump(i2c_smbus_interface * bus, unsigned char address)
95{
96 int i, j;
97
98 int start = 0x0000;
99
100 char line[128];
101 std::string text;
102
103 snprintf(line, 128, " 0 1 2 3 4 5 6 7 8 9 a b c d e f\r\n");
104 text.append(line);
105
106 for (i = 0; i < 0xFF; i += 16)
107 {
108 snprintf(line, 128, "%04x: ", i + start);
109 text.append(line);
110
111 for (j = 0; j < 16; j++)
112 {
113 snprintf(line, 128, "%02x ", (unsigned char )bus->i2c_smbus_read_byte_data(address, start + i + j));
114 text.append(line);
115 }
116
117 snprintf(line, 128, "\r\n");
118 text.append(line);
119 }
120
121 return text;
122
123} /* i2c_dump() */
124
125/******************************************************************************************\
126* *

Callers 1

on_DumpButton_clickedMethod · 0.85

Calls 3

snprintfFunction · 0.85
appendMethod · 0.45

Tested by

no test coverage detected