comparison Scan/MatrixARM/matrix_scan.c @ 431:7bc4c6249dff

Move matrix information to a cli command
author Jacob Alexander <haata@kiibohd.com>
date Tue, 22 Mar 2016 19:51:43 -0700
parents 0d1cc6ec4af7
children eae9fd6acc9a
comparison
equal deleted inserted replaced
430:d3cef419c849 431:7bc4c6249dff
50 50
51 // ----- Function Declarations ----- 51 // ----- Function Declarations -----
52 52
53 // CLI Functions 53 // CLI Functions
54 void cliFunc_matrixDebug( char* args ); 54 void cliFunc_matrixDebug( char* args );
55 void cliFunc_matrixInfo( char* args );
55 void cliFunc_matrixState( char* args ); 56 void cliFunc_matrixState( char* args );
56 57
57 58
58 59
59 // ----- Variables ----- 60 // ----- Variables -----
60 61
61 // Scan Module command dictionary 62 // Scan Module command dictionary
62 CLIDict_Entry( matrixDebug, "Enables matrix debug mode, prints out each scan code." NL "\t\tIf argument \033[35mT\033[0m is given, prints out each scan code state transition." ); 63 CLIDict_Entry( matrixDebug, "Enables matrix debug mode, prints out each scan code." NL "\t\tIf argument \033[35mT\033[0m is given, prints out each scan code state transition." );
64 CLIDict_Entry( matrixInfo, "Print info about the configured matrix." );
63 CLIDict_Entry( matrixState, "Prints out the current scan table N times." NL "\t\t \033[1mO\033[0m - Off, \033[1;33mP\033[0m - Press, \033[1;32mH\033[0m - Hold, \033[1;35mR\033[0m - Release, \033[1;31mI\033[0m - Invalid" ); 65 CLIDict_Entry( matrixState, "Prints out the current scan table N times." NL "\t\t \033[1mO\033[0m - Off, \033[1;33mP\033[0m - Press, \033[1;32mH\033[0m - Hold, \033[1;35mR\033[0m - Release, \033[1;31mI\033[0m - Invalid" );
64 66
65 CLIDict_Def( matrixCLIDict, "Matrix Module Commands" ) = { 67 CLIDict_Def( matrixCLIDict, "Matrix Module Commands" ) = {
66 CLIDict_Item( matrixDebug ), 68 CLIDict_Item( matrixDebug ),
69 CLIDict_Item( matrixInfo ),
67 CLIDict_Item( matrixState ), 70 CLIDict_Item( matrixState ),
68 { 0, 0, 0 } // Null entry for dictionary end 71 { 0, 0, 0 } // Null entry for dictionary end
69 }; 72 };
70 73
71 // Debounce Array 74 // Debounce Array
202 void Matrix_setup() 205 void Matrix_setup()
203 { 206 {
204 // Register Matrix CLI dictionary 207 // Register Matrix CLI dictionary
205 CLI_registerDictionary( matrixCLIDict, matrixCLIDictName ); 208 CLI_registerDictionary( matrixCLIDict, matrixCLIDictName );
206 209
207 info_msg("Columns: ");
208 printHex( Matrix_colsNum );
209
210 // Setup Strobe Pins 210 // Setup Strobe Pins
211 for ( uint8_t pin = 0; pin < Matrix_colsNum; pin++ ) 211 for ( uint8_t pin = 0; pin < Matrix_colsNum; pin++ )
212 { 212 {
213 Matrix_pin( Matrix_cols[ pin ], Type_StrobeSetup ); 213 Matrix_pin( Matrix_cols[ pin ], Type_StrobeSetup );
214 } 214 }
215 215
216 print( NL );
217 info_msg("Rows: ");
218 printHex( Matrix_rowsNum );
219
220 // Setup Sense Pins 216 // Setup Sense Pins
221 for ( uint8_t pin = 0; pin < Matrix_rowsNum; pin++ ) 217 for ( uint8_t pin = 0; pin < Matrix_rowsNum; pin++ )
222 { 218 {
223 Matrix_pin( Matrix_rows[ pin ], Type_SenseSetup ); 219 Matrix_pin( Matrix_rows[ pin ], Type_SenseSetup );
224 } 220 }
225
226 print( NL );
227 info_msg("Max Keys: ");
228 printHex( Matrix_maxKeys );
229 print( NL );
230 221
231 // Clear out Debounce Array 222 // Clear out Debounce Array
232 for ( uint8_t item = 0; item < Matrix_maxKeys; item++ ) 223 for ( uint8_t item = 0; item < Matrix_maxKeys; item++ )
233 { 224 {
234 Matrix_scanArray[ item ].prevState = KeyState_Off; 225 Matrix_scanArray[ item ].prevState = KeyState_Off;
596 587
597 588
598 589
599 // ----- CLI Command Functions ----- 590 // ----- CLI Command Functions -----
600 591
601 void cliFunc_matrixDebug ( char* args ) 592 void cliFunc_matrixInfo( char* args )
593 {
594 print( NL );
595 info_msg("Columns: ");
596 printHex( Matrix_colsNum );
597
598 print( NL );
599 info_msg("Rows: ");
600 printHex( Matrix_rowsNum );
601
602 print( NL );
603 info_msg("Max Keys: ");
604 printHex( Matrix_maxKeys );
605 }
606
607 void cliFunc_matrixDebug( char* args )
602 { 608 {
603 // Parse number from argument 609 // Parse number from argument
604 // NOTE: Only first argument is used 610 // NOTE: Only first argument is used
605 char* arg1Ptr; 611 char* arg1Ptr;
606 char* arg2Ptr; 612 char* arg2Ptr;
630 print( NL ); 636 print( NL );
631 info_msg("Matrix Debug Mode: "); 637 info_msg("Matrix Debug Mode: ");
632 printInt8( matrixDebugMode ); 638 printInt8( matrixDebugMode );
633 } 639 }
634 640
635 void cliFunc_matrixState ( char* args ) 641 void cliFunc_matrixState( char* args )
636 { 642 {
637 // Parse number from argument 643 // Parse number from argument
638 // NOTE: Only first argument is used 644 // NOTE: Only first argument is used
639 char* arg1Ptr; 645 char* arg1Ptr;
640 char* arg2Ptr; 646 char* arg2Ptr;