MCPcopy Create free account
hub / github.com/kiibohd/controller / hexToStr_op

Function hexToStr_op

Bootloader/debug.c:233–266  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

231
232
233void hexToStr_op( uint32_t in, char* out, uint8_t op )
234{
235 // Position container
236 uint32_t pos = 0;
237
238 // Evaluate through digits as hex
239 do
240 {
241 uint32_t cur = in % 16;
242 out[pos++] = cur + (( cur < 10 ) ? '0' : 'A' - 10);
243 }
244 while ( (in /= 16) > 0 );
245
246 // Output formatting options
247 switch ( op )
248 {
249 case 1: // Add 0x
250 out[pos++] = 'x';
251 out[pos++] = '0';
252 break;
253 case 2: // 8-bit padding
254 case 4: // 16-bit padding
255 case 8: // 32-bit padding
256 while ( pos < op )
257 out[pos++] = '0';
258 break;
259 }
260
261 // Append null
262 out[pos] = '\0';
263
264 // Reverse the string to the correct order
265 revsStr( out );
266}
267
268
269void printHex_op( uint32_t in, uint8_t op )

Callers 3

printHex_opFunction · 0.70
processPacketValueFunction · 0.50
matrix_debugPinsFunction · 0.50

Calls 1

revsStrFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…