Mercurial > louis > kiibohd-controller
diff Macro/PartialMap/macro.c @ 180:ed56f7873645
Added capabilities list debug option
- Changed macro/capabilities data structure to index capabilities rather than specify function pointers
- Used an 8 bit array, this reduced the max number of capabities to 255
* Shouldn't be an issue, but this can be addressed if the limit is hit...unlikely though
author | Jacob Alexander <haata@kiibohd.com> |
---|---|
date | Thu, 24 Jul 2014 23:18:38 -0700 |
parents | e5cf79b516e4 |
children | 80a44dcdafaf |
line wrap: on
line diff
--- a/Macro/PartialMap/macro.c Thu Jul 24 22:22:35 2014 -0700 +++ b/Macro/PartialMap/macro.c Thu Jul 24 23:18:38 2014 -0700 @@ -370,7 +370,20 @@ void cliFunc_capList( char* args ) { - // TODO + print( NL ); + info_msg("Capabilities List"); + + // Iterate through all of the capabilities and display them + for ( unsigned int cap = 0; cap < CapabilitiesNum; cap++ ) + { + print( NL "\t" ); + printHex( cap ); + print(" - "); + + // Display/Lookup Capability Name (utilize debug mode of capability) + void (*capability)(uint8_t, uint8_t, uint8_t*) = (void(*)(uint8_t, uint8_t, uint8_t*))(CapabilitiesList[ cap ]); + capability( 0xFF, 0xFF, 0 ); + } } void cliFunc_capSelect( char* args ) @@ -588,20 +601,24 @@ // Assign TriggerGuide element (key type, state and scancode) ResultGuide *guide = (ResultGuide*)(¯o->guide[ pos ]); + // Display Function Index + printHex( guide->index ); + print("|"); + // Display Function Ptr Address - printHex( (unsigned int)guide->function ); + printHex( (unsigned int)CapabilitiesList[ guide->index ] ); print("|"); // Display/Lookup Capability Name (utilize debug mode of capability) - void (*capability)(uint8_t, uint8_t, uint8_t*) = (void(*)(uint8_t, uint8_t, uint8_t*))(guide->function); + void (*capability)(uint8_t, uint8_t, uint8_t*) = (void(*)(uint8_t, uint8_t, uint8_t*))(CapabilitiesList[ guide->index ]); capability( 0xFF, 0xFF, 0 ); // Display Argument(s) print("("); for ( unsigned int arg = 0; arg < guide->argCount; arg++ ) { - // Arguments are only 8 bit values (guides are 32 bit for function pointers) - printHex( (uint8_t)(unsigned int)(&guide->args)[ arg ] ); + // Arguments are only 8 bit values + printHex( (&guide->args)[ arg ] ); // Only show arg separator if there are args left if ( arg + 1 < guide->argCount )