Kiibohd Controller
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

macro.c 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702
  1. /* Copyright (C) 2014 by Jacob Alexander
  2. *
  3. * This file is free software: you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License as published by
  5. * the Free Software Foundation, either version 3 of the License, or
  6. * (at your option) any later version.
  7. *
  8. * This file is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this file. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. // ----- Includes -----
  17. // Compiler Includes
  18. #include <Lib/MacroLib.h>
  19. // Project Includes
  20. #include <cli.h>
  21. #include <led.h>
  22. #include <print.h>
  23. #include <scan_loop.h>
  24. #include <output_com.h>
  25. // Keymaps
  26. #include "usb_hid.h"
  27. #include <defaultMap.h>
  28. #include "generatedKeymap.h" // TODO Use actual generated version
  29. // Local Includes
  30. #include "macro.h"
  31. // ----- Function Declarations -----
  32. void cliFunc_capList ( char* args );
  33. void cliFunc_capSelect ( char* args );
  34. void cliFunc_keyPress ( char* args );
  35. void cliFunc_keyRelease( char* args );
  36. void cliFunc_layerLatch( char* args );
  37. void cliFunc_layerList ( char* args );
  38. void cliFunc_layerLock ( char* args );
  39. void cliFunc_macroDebug( char* args );
  40. void cliFunc_macroList ( char* args );
  41. void cliFunc_macroProc ( char* args );
  42. void cliFunc_macroShow ( char* args );
  43. void cliFunc_macroStep ( char* args );
  44. // ----- Variables -----
  45. // Macro Module command dictionary
  46. char* macroCLIDictName = "Macro Module Commands";
  47. CLIDictItem macroCLIDict[] = {
  48. { "capList", "Prints an indexed list of all non USB keycode capabilities.", cliFunc_capList },
  49. { "capSelect", "Triggers the specified capability." NL "\t\t\033[35mU10\033[0m USB Code 0x0A, \033[35mK11\033[0m Keyboard Capability 0x0B", cliFunc_capSelect },
  50. { "keyPress", "Send key-presses to the macro module. Held until released. Duplicates have undefined behaviour." NL "\t\t\033[35mS10\033[0m Scancode 0x0A", cliFunc_keyPress },
  51. { "keyRelease", "Release a key-press from the macro module. Duplicates have undefined behaviour." NL "\t\t\033[35mS10\033[0m Scancode 0x0A", cliFunc_keyRelease },
  52. { "layerLatch", "Latch the specified indexed layer." NL "\t\t\033[35mL15\033[0m Indexed Layer 0x0F", cliFunc_layerLatch },
  53. { "layerList", "List available layers.", cliFunc_layerList },
  54. { "layerLock", "Lock the specified indexed layer." NL "\t\t\033[35mL2\033[0m Indexed Layer 0x02", cliFunc_layerLock },
  55. { "macroDebug", "Disables/Enables sending USB keycodes to the Output Module and prints U/K codes.", cliFunc_macroDebug },
  56. { "macroList", "List the defined trigger and result macros.", cliFunc_macroList },
  57. { "macroProc", "Pause/Resume macro processing.", cliFunc_macroProc },
  58. { "macroShow", "Show the macro corresponding to the given index or scan-code." NL "\t\t\033[35mT16\033[0m Indexed Trigger Macro 0x10, \033[35mR12\033[0m Indexed Result Macro 0x0C", cliFunc_macroShow },
  59. { "macroStep", "Do N macro processing steps. Defaults to 1.", cliFunc_macroStep },
  60. { 0, 0, 0 } // Null entry for dictionary end
  61. };
  62. // Macro debug flag - If set, clears the USB Buffers after signalling processing completion
  63. uint8_t macroDebugMode = 0;
  64. // Macro pause flag - If set, the macro module pauses processing, unless unset, or the step counter is non-zero
  65. uint8_t macroPauseMode = 0;
  66. // Macro step counter - If non-zero, the step counter counts down every time the macro module does one processing loop
  67. unsigned int macroStepCounter = 0;
  68. // Key Trigger List Buffer
  69. // * Item 1: scan code
  70. // * Item 2: state
  71. // ...
  72. uint8_t macroTriggerListBuffer[MaxScanCode * 2] = { 0 }; // Each key has a state to be cached
  73. uint8_t macroTriggerListBufferSize = 0;
  74. // TODO, figure out a good way to scale this array size without wasting too much memory, but not rejecting macros
  75. // Possibly could be calculated by the KLL compiler
  76. // XXX It may be possible to calculate the worst case using the KLL compiler
  77. TriggerMacro *triggerMacroPendingList[TriggerMacroNum];
  78. // ----- Functions -----
  79. // Looks up the trigger list for the given scan code (from the active layer)
  80. unsigned int *Macro_layerLookup( uint8_t scanCode )
  81. {
  82. // TODO - No layer fallthrough lookup
  83. return default_scanMap[ scanCode ];
  84. }
  85. // Update the scancode key state
  86. // States:
  87. // * 0x00 - Reserved
  88. // * 0x01 - Pressed
  89. // * 0x02 - Held
  90. // * 0x03 - Released
  91. // * 0x04 - Unpressed (this is currently ignored)
  92. inline void Macro_keyState( uint8_t scanCode, uint8_t state )
  93. {
  94. // Only add to macro trigger list if one of three states
  95. switch ( state )
  96. {
  97. case 0x01: // Pressed
  98. case 0x02: // Held
  99. case 0x03: // Released
  100. macroTriggerListBuffer[ macroTriggerListBufferSize++ ] = scanCode;
  101. macroTriggerListBuffer[ macroTriggerListBufferSize++ ] = state;
  102. break;
  103. }
  104. }
  105. // Update the scancode analog state
  106. // States:
  107. // * 0x00 - Reserved
  108. // * 0x01 - Released
  109. // * 0x02-0xFF - Analog value (low to high)
  110. inline void Macro_analogState( uint8_t scanCode, uint8_t state )
  111. {
  112. // TODO
  113. }
  114. // Update led state
  115. // States:
  116. // * 0x00 - Reserved
  117. // * 0x01 - On
  118. // * 0x02 - Off
  119. inline void Macro_ledState( uint8_t ledCode, uint8_t state )
  120. {
  121. // TODO
  122. }
  123. // Evaluate/Update the TriggerMacro
  124. void Macro_evalTriggerMacro( TriggerMacro *triggerMacro )
  125. {
  126. // Which combo in the sequence is being evaluated
  127. unsigned int comboPos = triggerMacro->pos;
  128. // If combo length is more than 1, cancel trigger macro if an incorrect key is found
  129. uint8_t comboLength = triggerMacro->guide[ comboPos ];
  130. // Iterate over list of keys currently pressed
  131. for ( uint8_t keyPressed = 0; keyPressed < macroTriggerListBufferSize; keyPressed += 2 )
  132. {
  133. // Compare with keys in combo
  134. for ( unsigned int comboKey = 0; comboKey < comboLength; comboKey++ )
  135. {
  136. // Lookup key in combo
  137. uint8_t guideKey = triggerMacro->guide[ comboPos + comboKey + 2 ]; // TODO Only Press/Hold/Release atm
  138. // Sequence Case
  139. if ( comboLength == 1 )
  140. {
  141. // If key matches and only 1 key pressed, increment the TriggerMacro combo position
  142. if ( guideKey == macroTriggerListBuffer[ keyPressed ] && macroTriggerListBufferSize == 1 )
  143. {
  144. triggerMacro->pos += comboLength * 2 + 1;
  145. // TODO check if TriggerMacro is finished, register ResultMacro
  146. return;
  147. }
  148. // If key does not match or more than 1 key pressed, reset the TriggerMacro combo position
  149. triggerMacro->pos = 0;
  150. return;
  151. }
  152. // Combo Case
  153. else
  154. {
  155. // TODO
  156. }
  157. }
  158. }
  159. }
  160. /*
  161. inline void Macro_bufferAdd( uint8_t byte )
  162. {
  163. // Make sure we haven't overflowed the key buffer
  164. // Default function for adding keys to the KeyIndex_Buffer, does a DefaultMap_Lookup
  165. if ( KeyIndex_BufferUsed < KEYBOARD_BUFFER )
  166. {
  167. uint8_t key = DefaultMap_Lookup[byte];
  168. for ( uint8_t c = 0; c < KeyIndex_BufferUsed; c++ )
  169. {
  170. // Key already in the buffer
  171. if ( KeyIndex_Buffer[c] == key )
  172. return;
  173. }
  174. // Add to the buffer
  175. KeyIndex_Buffer[KeyIndex_BufferUsed++] = key;
  176. }
  177. }
  178. inline void Macro_bufferRemove( uint8_t byte )
  179. {
  180. uint8_t key = DefaultMap_Lookup[byte];
  181. // Check for the released key, and shift the other keys lower on the buffer
  182. for ( uint8_t c = 0; c < KeyIndex_BufferUsed; c++ )
  183. {
  184. // Key to release found
  185. if ( KeyIndex_Buffer[c] == key )
  186. {
  187. // Shift keys from c position
  188. for ( uint8_t k = c; k < KeyIndex_BufferUsed - 1; k++ )
  189. KeyIndex_Buffer[k] = KeyIndex_Buffer[k + 1];
  190. // Decrement Buffer
  191. KeyIndex_BufferUsed--;
  192. return;
  193. }
  194. }
  195. // Error case (no key to release)
  196. erro_msg("Could not find key to release: ");
  197. printHex( key );
  198. }
  199. */
  200. inline void Macro_finishWithUSBBuffer( uint8_t sentKeys )
  201. {
  202. }
  203. inline void Macro_process()
  204. {
  205. // Only do one round of macro processing between Output Module timer sends
  206. if ( USBKeys_Sent != 0 )
  207. return;
  208. // If the pause flag is set, only process if the step counter is non-zero
  209. if ( macroPauseMode && macroStepCounter == 0 )
  210. {
  211. return;
  212. }
  213. // Proceed, decrementing the step counter
  214. else
  215. {
  216. macroStepCounter--;
  217. }
  218. // Loop through macro trigger buffer
  219. for ( uint8_t index = 0; index < macroTriggerListBufferSize; index += 2 )
  220. {
  221. // Get scanCode, first item of macroTriggerListBuffer pairs
  222. uint8_t scanCode = macroTriggerListBuffer[ index ];
  223. // Lookup trigger list for this key
  224. unsigned int *triggerList = Macro_layerLookup( scanCode );
  225. // The first element is the length of the trigger list
  226. unsigned int triggerListSize = triggerList[0];
  227. // Loop through the trigger list
  228. for ( unsigned int trigger = 0; trigger < triggerListSize; trigger++ )
  229. {
  230. // Lookup TriggerMacro
  231. TriggerMacro *triggerMacro = (TriggerMacro*)triggerList[ trigger + 1 ];
  232. // Get triggered state of scan code, second item of macroTriggerListBuffer pairs
  233. uint8_t state = macroTriggerListBuffer[ index + 1 ];
  234. // Evaluate Macro
  235. Macro_evalTriggerMacro( triggerMacro );
  236. }
  237. }
  238. /* TODO
  239. // Loop through input buffer
  240. for ( uint8_t index = 0; index < KeyIndex_BufferUsed && !macroDebugMode; index++ )
  241. {
  242. //print(" KEYS: ");
  243. //printInt8( KeyIndex_BufferUsed );
  244. // Get the keycode from the buffer
  245. uint8_t key = KeyIndex_Buffer[index];
  246. // Set the modifier bit if this key is a modifier
  247. if ( (key & KEY_LCTRL) == KEY_LCTRL ) // AND with 0xE0
  248. {
  249. USBKeys_Modifiers |= 1 << (key ^ KEY_LCTRL); // Left shift 1 by key XOR 0xE0
  250. // Modifier processed, move on to the next key
  251. continue;
  252. }
  253. // Too many keys
  254. if ( USBKeys_Sent >= USBKeys_MaxSize )
  255. {
  256. warn_msg("USB Key limit reached");
  257. errorLED( 1 );
  258. break;
  259. }
  260. // Allow ignoring keys with 0's
  261. if ( key != 0 )
  262. {
  263. USBKeys_Array[USBKeys_Sent++] = key;
  264. }
  265. else
  266. {
  267. // Key was not mapped
  268. erro_msg( "Key not mapped... - " );
  269. printHex( key );
  270. errorLED( 1 );
  271. }
  272. }
  273. */
  274. // Signal buffer that we've used it
  275. Scan_finishedWithBuffer( KeyIndex_BufferUsed );
  276. // If Macro debug mode is set, clear the USB Buffer
  277. if ( macroDebugMode )
  278. {
  279. USBKeys_Modifiers = 0;
  280. USBKeys_Sent = 0;
  281. }
  282. }
  283. inline void Macro_setup()
  284. {
  285. // Register Macro CLI dictionary
  286. CLI_registerDictionary( macroCLIDict, macroCLIDictName );
  287. // Disable Macro debug mode
  288. macroDebugMode = 0;
  289. // Disable Macro pause flag
  290. macroPauseMode = 0;
  291. // Set Macro step counter to zero
  292. macroStepCounter = 0;
  293. // Make sure macro trigger buffer is empty
  294. macroTriggerListBufferSize = 0;
  295. }
  296. // ----- CLI Command Functions -----
  297. void cliFunc_capList( char* args )
  298. {
  299. print( NL );
  300. info_msg("Capabilities List");
  301. // Iterate through all of the capabilities and display them
  302. for ( unsigned int cap = 0; cap < CapabilitiesNum; cap++ )
  303. {
  304. print( NL "\t" );
  305. printHex( cap );
  306. print(" - ");
  307. // Display/Lookup Capability Name (utilize debug mode of capability)
  308. void (*capability)(uint8_t, uint8_t, uint8_t*) = (void(*)(uint8_t, uint8_t, uint8_t*))(CapabilitiesList[ cap ]);
  309. capability( 0xFF, 0xFF, 0 );
  310. }
  311. }
  312. void cliFunc_capSelect( char* args )
  313. {
  314. // Parse code from argument
  315. // NOTE: Only first argument is used
  316. char* arg1Ptr;
  317. char* arg2Ptr;
  318. CLI_argumentIsolation( args, &arg1Ptr, &arg2Ptr );
  319. // Depending on the first character, the lookup changes
  320. switch ( arg1Ptr[0] )
  321. {
  322. // Keyboard Capability
  323. case 'K':
  324. // TODO
  325. break;
  326. // USB Code
  327. case 'U':
  328. // Just add the key to the USB Buffer
  329. if ( KeyIndex_BufferUsed < KEYBOARD_BUFFER )
  330. {
  331. KeyIndex_Buffer[KeyIndex_BufferUsed++] = decToInt( &arg1Ptr[1] );
  332. }
  333. break;
  334. }
  335. }
  336. void cliFunc_keyPress( char* args )
  337. {
  338. // Parse codes from arguments
  339. char* curArgs;
  340. char* arg1Ptr;
  341. char* arg2Ptr = args;
  342. // Process all args
  343. for ( ;; )
  344. {
  345. curArgs = arg2Ptr;
  346. CLI_argumentIsolation( curArgs, &arg1Ptr, &arg2Ptr );
  347. // Stop processing args if no more are found
  348. if ( *arg1Ptr == '\0' )
  349. break;
  350. // Ignore non-Scancode numbers
  351. switch ( arg1Ptr[0] )
  352. {
  353. // Scancode
  354. case 'S':
  355. Macro_keyState( (uint8_t)decToInt( &arg1Ptr[1] ), 0x01 ); // Press scancode
  356. break;
  357. }
  358. }
  359. }
  360. void cliFunc_keyRelease( char* args )
  361. {
  362. // Parse codes from arguments
  363. char* curArgs;
  364. char* arg1Ptr;
  365. char* arg2Ptr = args;
  366. // Process all args
  367. for ( ;; )
  368. {
  369. curArgs = arg2Ptr;
  370. CLI_argumentIsolation( curArgs, &arg1Ptr, &arg2Ptr );
  371. // Stop processing args if no more are found
  372. if ( *arg1Ptr == '\0' )
  373. break;
  374. // Ignore non-Scancode numbers
  375. switch ( arg1Ptr[0] )
  376. {
  377. // Scancode
  378. case 'S':
  379. Macro_keyState( (uint8_t)decToInt( &arg1Ptr[1] ), 0x03 ); // Release scancode
  380. break;
  381. }
  382. }
  383. }
  384. void cliFunc_layerLatch( char* args )
  385. {
  386. // TODO
  387. }
  388. void cliFunc_layerList( char* args )
  389. {
  390. // TODO
  391. }
  392. void cliFunc_layerLock( char* args )
  393. {
  394. // TODO
  395. }
  396. void cliFunc_macroDebug( char* args )
  397. {
  398. // Toggle macro debug mode
  399. macroDebugMode = macroDebugMode ? 0 : 1;
  400. print( NL );
  401. info_msg("Macro Debug Mode: ");
  402. printInt8( macroDebugMode );
  403. }
  404. void cliFunc_macroList( char* args )
  405. {
  406. // TODO
  407. }
  408. void cliFunc_macroProc( char* args )
  409. {
  410. // Toggle macro pause mode
  411. macroPauseMode = macroPauseMode ? 0 : 1;
  412. print( NL );
  413. info_msg("Macro Processing Mode: ");
  414. printInt8( macroPauseMode );
  415. }
  416. void macroDebugShowTrigger( unsigned int index )
  417. {
  418. // Only proceed if the macro exists
  419. if ( index >= TriggerMacroNum )
  420. return;
  421. // Trigger Macro Show
  422. TriggerMacro *macro = &TriggerMacroList[ index ];
  423. print( NL );
  424. info_msg("Trigger Macro Index: ");
  425. printInt16( (uint16_t)index ); // Hopefully large enough :P (can't assume 32-bit)
  426. print( NL );
  427. // Read the comboLength for combo in the sequence (sequence of combos)
  428. unsigned int pos = 0;
  429. uint8_t comboLength = macro->guide[ pos ];
  430. // Iterate through and interpret the guide
  431. while ( comboLength != 0 )
  432. {
  433. // Initial position of the combo
  434. unsigned int comboPos = ++pos;
  435. // Iterate through the combo
  436. while ( pos < comboLength * TriggerGuideSize + comboPos )
  437. {
  438. // Assign TriggerGuide element (key type, state and scancode)
  439. TriggerGuide *guide = (TriggerGuide*)(&macro->guide[ pos ]);
  440. // Display guide information about trigger key
  441. printHex( guide->scancode );
  442. print("|");
  443. printHex( guide->type );
  444. print("|");
  445. printHex( guide->state );
  446. // Increment position
  447. pos += TriggerGuideSize;
  448. // Only show combo separator if there are combos left in the sequence element
  449. if ( pos < comboLength * TriggerGuideSize + comboPos )
  450. print("+");
  451. }
  452. // Read the next comboLength
  453. comboLength = macro->guide[ pos ];
  454. // Only show sequence separator if there is another combo to process
  455. if ( comboLength != 0 )
  456. print(";");
  457. }
  458. // Display current position
  459. print( NL "Position: " );
  460. printInt16( (uint16_t)macro->pos ); // Hopefully large enough :P (can't assume 32-bit)
  461. // Display result macro index
  462. print( NL "Result Macro Index: " );
  463. printInt16( (uint16_t)macro->result ); // Hopefully large enough :P (can't assume 32-bit)
  464. }
  465. void macroDebugShowResult( unsigned int index )
  466. {
  467. // Only proceed if the macro exists
  468. if ( index >= ResultMacroNum )
  469. return;
  470. // Trigger Macro Show
  471. ResultMacro *macro = &ResultMacroList[ index ];
  472. print( NL );
  473. info_msg("Result Macro Index: ");
  474. printInt16( (uint16_t)index ); // Hopefully large enough :P (can't assume 32-bit)
  475. print( NL );
  476. // Read the comboLength for combo in the sequence (sequence of combos)
  477. unsigned int pos = 0;
  478. uint8_t comboLength = macro->guide[ pos++ ];
  479. // Iterate through and interpret the guide
  480. while ( comboLength != 0 )
  481. {
  482. // Function Counter, used to keep track of the combos processed
  483. unsigned int funcCount = 0;
  484. // Iterate through the combo
  485. while ( funcCount < comboLength )
  486. {
  487. // Assign TriggerGuide element (key type, state and scancode)
  488. ResultGuide *guide = (ResultGuide*)(&macro->guide[ pos ]);
  489. // Display Function Index
  490. printHex( guide->index );
  491. print("|");
  492. // Display Function Ptr Address
  493. printHex( (unsigned int)CapabilitiesList[ guide->index ] );
  494. print("|");
  495. // Display/Lookup Capability Name (utilize debug mode of capability)
  496. void (*capability)(uint8_t, uint8_t, uint8_t*) = (void(*)(uint8_t, uint8_t, uint8_t*))(CapabilitiesList[ guide->index ]);
  497. capability( 0xFF, 0xFF, 0 );
  498. // Display Argument(s)
  499. print("(");
  500. for ( unsigned int arg = 0; arg < guide->argCount; arg++ )
  501. {
  502. // Arguments are only 8 bit values
  503. printHex( (&guide->args)[ arg ] );
  504. // Only show arg separator if there are args left
  505. if ( arg + 1 < guide->argCount )
  506. print(",");
  507. }
  508. print(")");
  509. // Increment position
  510. pos += ResultGuideSize( guide );
  511. // Increment function count
  512. funcCount++;
  513. // Only show combo separator if there are combos left in the sequence element
  514. if ( funcCount < comboLength )
  515. print("+");
  516. }
  517. // Read the next comboLength
  518. comboLength = macro->guide[ pos++ ];
  519. // Only show sequence separator if there is another combo to process
  520. if ( comboLength != 0 )
  521. print(";");
  522. }
  523. // Display current position
  524. print( NL "Position: " );
  525. printInt16( (uint16_t)macro->pos ); // Hopefully large enough :P (can't assume 32-bit)
  526. // Display final trigger state/type
  527. print( NL "Final Trigger State (State/Type): " );
  528. printHex( macro->state );
  529. print("/");
  530. printHex( macro->stateType );
  531. }
  532. void cliFunc_macroShow( char* args )
  533. {
  534. // Parse codes from arguments
  535. char* curArgs;
  536. char* arg1Ptr;
  537. char* arg2Ptr = args;
  538. // Process all args
  539. for ( ;; )
  540. {
  541. curArgs = arg2Ptr;
  542. CLI_argumentIsolation( curArgs, &arg1Ptr, &arg2Ptr );
  543. // Stop processing args if no more are found
  544. if ( *arg1Ptr == '\0' )
  545. break;
  546. // Ignore invalid codes
  547. switch ( arg1Ptr[0] )
  548. {
  549. // Indexed Trigger Macro
  550. case 'T':
  551. macroDebugShowTrigger( decToInt( &arg1Ptr[1] ) );
  552. break;
  553. // Indexed Result Macro
  554. case 'R':
  555. macroDebugShowResult( decToInt( &arg1Ptr[1] ) );
  556. break;
  557. }
  558. }
  559. }
  560. void cliFunc_macroStep( char* args )
  561. {
  562. // Parse number from argument
  563. // NOTE: Only first argument is used
  564. char* arg1Ptr;
  565. char* arg2Ptr;
  566. CLI_argumentIsolation( args, &arg1Ptr, &arg2Ptr );
  567. // Set the macro step counter, negative int's are cast to uint
  568. macroStepCounter = (unsigned int)decToInt( arg1Ptr );
  569. }