Mercurial > louis > kiibohd-controller
diff Macro/PartialMap/macro.c @ 195:58cfcb7bac88
Changing decToInt to numToInt (adds support for Hex number interpreter)
- CLI now works with hex or decimal numbers
- Hex requires 0x (technically just x would work too)
author | Jacob Alexander <haata@kiibohd.com> |
---|---|
date | Sat, 16 Aug 2014 12:07:25 -0700 |
parents | 6ac92b8614c0 |
children | 8ecfdaa27234 |
line wrap: on
line diff
--- a/Macro/PartialMap/macro.c Fri Aug 15 11:27:16 2014 -0700 +++ b/Macro/PartialMap/macro.c Sat Aug 16 12:07:25 2014 -0700 @@ -784,7 +784,7 @@ // Keyboard Capability case 'K': // Determine capability index - cap = decToInt( &arg1Ptr[1] ); + cap = numToInt( &arg1Ptr[1] ); // Lookup the number of args totalArgs += CapabilitiesList[ cap ].argCount; @@ -793,7 +793,7 @@ // Because allocating memory isn't doable, and the argument count is arbitrary // The argument pointer is repurposed as the argument list (much smaller anyways) - argSet[ argSetCount++ ] = (uint8_t)decToInt( arg1Ptr ); + argSet[ argSetCount++ ] = (uint8_t)numToInt( arg1Ptr ); // Once all the arguments are prepared, call the keyboard capability function if ( argSetCount == totalArgs ) @@ -838,7 +838,7 @@ { // Scancode case 'S': - Macro_keyState( (uint8_t)decToInt( &arg1Ptr[1] ), 0x02 ); // Hold scancode + Macro_keyState( (uint8_t)numToInt( &arg1Ptr[1] ), 0x02 ); // Hold scancode break; } } @@ -866,7 +866,7 @@ { // Scancode case 'S': - Macro_keyState( (uint8_t)decToInt( &arg1Ptr[1] ), 0x01 ); // Press scancode + Macro_keyState( (uint8_t)numToInt( &arg1Ptr[1] ), 0x01 ); // Press scancode break; } } @@ -894,7 +894,7 @@ { // Scancode case 'S': - Macro_keyState( (uint8_t)decToInt( &arg1Ptr[1] ), 0x03 ); // Release scancode + Macro_keyState( (uint8_t)numToInt( &arg1Ptr[1] ), 0x03 ); // Release scancode break; } } @@ -956,11 +956,11 @@ if ( arg1Ptr[0] != 'L' ) return; - arg1 = (uint8_t)decToInt( &arg1Ptr[1] ); + arg1 = (uint8_t)numToInt( &arg1Ptr[1] ); break; // Second argument (e.g. 4) case 1: - arg2 = (uint8_t)decToInt( arg1Ptr ); + arg2 = (uint8_t)numToInt( arg1Ptr ); // Display operation (to indicate that it worked) print( NL ); @@ -1223,11 +1223,11 @@ { // Indexed Trigger Macro case 'T': - macroDebugShowTrigger( decToInt( &arg1Ptr[1] ) ); + macroDebugShowTrigger( numToInt( &arg1Ptr[1] ) ); break; // Indexed Result Macro case 'R': - macroDebugShowResult( decToInt( &arg1Ptr[1] ) ); + macroDebugShowResult( numToInt( &arg1Ptr[1] ) ); break; } } @@ -1242,7 +1242,7 @@ CLI_argumentIsolation( args, &arg1Ptr, &arg2Ptr ); // Default to 1, if no argument given - unsigned int count = (unsigned int)decToInt( arg1Ptr ); + unsigned int count = (unsigned int)numToInt( arg1Ptr ); if ( count == 0 ) count = 1;