comparison Scan/UARTConnect/connect_scan.c @ 348:06225a619152

Adding connection type list
author Jacob Alexander <haata@kiibohd.com>
date Sat, 25 Jul 2015 14:54:36 -0700
parents 136e47478441
children 86b937945313
comparison
equal deleted inserted replaced
347:136e47478441 348:06225a619152
186 // ----- Function Declarations ----- 186 // ----- Function Declarations -----
187 187
188 // CLI Functions 188 // CLI Functions
189 void cliFunc_connectCmd ( char *args ); 189 void cliFunc_connectCmd ( char *args );
190 void cliFunc_connectIdl ( char *args ); 190 void cliFunc_connectIdl ( char *args );
191 void cliFunc_connectLst ( char *args );
191 void cliFunc_connectMst ( char *args ); 192 void cliFunc_connectMst ( char *args );
192 void cliFunc_connectRst ( char *args ); 193 void cliFunc_connectRst ( char *args );
193 void cliFunc_connectSts ( char *args ); 194 void cliFunc_connectSts ( char *args );
194 195
195 196
197 // ----- Variables ----- 198 // ----- Variables -----
198 199
199 // Connect Module command dictionary 200 // Connect Module command dictionary
200 CLIDict_Entry( connectCmd, "Sends a command via UART Connect, first arg is which uart, next arg is the command, rest are the arguments." ); 201 CLIDict_Entry( connectCmd, "Sends a command via UART Connect, first arg is which uart, next arg is the command, rest are the arguments." );
201 CLIDict_Entry( connectIdl, "Sends N number of Idle commands, 2 is the default value, and should be sufficient in most cases." ); 202 CLIDict_Entry( connectIdl, "Sends N number of Idle commands, 2 is the default value, and should be sufficient in most cases." );
203 CLIDict_Entry( connectLst, "Lists available UARTConnect commands and index id" );
202 CLIDict_Entry( connectMst, "Sets the device as master. Use argument of s to set as slave." ); 204 CLIDict_Entry( connectMst, "Sets the device as master. Use argument of s to set as slave." );
203 CLIDict_Entry( connectRst, "Resets both Rx and Tx connect buffers and state variables." ); 205 CLIDict_Entry( connectRst, "Resets both Rx and Tx connect buffers and state variables." );
204 CLIDict_Entry( connectSts, "UARTConnect status." ); 206 CLIDict_Entry( connectSts, "UARTConnect status." );
205 CLIDict_Def( uartConnectCLIDict, "UARTConnect Module Commands" ) = { 207 CLIDict_Def( uartConnectCLIDict, "UARTConnect Module Commands" ) = {
206 CLIDict_Item( connectCmd ), 208 CLIDict_Item( connectCmd ),
207 CLIDict_Item( connectIdl ), 209 CLIDict_Item( connectIdl ),
210 CLIDict_Item( connectLst ),
208 CLIDict_Item( connectMst ), 211 CLIDict_Item( connectMst ),
209 CLIDict_Item( connectRst ), 212 CLIDict_Item( connectRst ),
210 CLIDict_Item( connectSts ), 213 CLIDict_Item( connectSts ),
211 { 0, 0, 0 } // Null entry for dictionary end 214 { 0, 0, 0 } // Null entry for dictionary end
212 }; 215 };
883 TriggerGuide scanCodes[] = { { 0x00, 0x01, 0x05 }, { 0x00, 0x03, 0x16 } }; 886 TriggerGuide scanCodes[] = { { 0x00, 0x01, 0x05 }, { 0x00, 0x03, 0x16 } };
884 Connect_send_ScanCode( 10, scanCodes, 2 ); 887 Connect_send_ScanCode( 10, scanCodes, 2 );
885 break; 888 break;
886 } 889 }
887 case Animation: 890 case Animation:
891 break;
892
893 case RemoteCapability:
894 // TODO
895 break;
896
897 case RemoteOutput:
898 // TODO
899 break;
900
901 case RemoteInput:
902 // TODO
903 break;
904
888 default: 905 default:
889 break; 906 break;
890 } 907 }
891 } 908 }
892 909
905 // Default to 2 idles 922 // Default to 2 idles
906 if ( count == 0 ) 923 if ( count == 0 )
907 count = 2; 924 count = 2;
908 925
909 Connect_send_Idle( count ); 926 Connect_send_Idle( count );
927 }
928
929 void cliFunc_connectLst( char* args )
930 {
931 const char *Command_strs[] = {
932 "CableCheck",
933 "IdRequest",
934 "IdEnumeration",
935 "IdReport",
936 "ScanCode",
937 "Animation",
938 "RemoteCapability",
939 "RemoteOutput",
940 "RemoteInput",
941 };
942
943 print( NL );
944 info_msg("List of UARTConnect commands");
945 for ( uint8_t cmd = 0; cmd < Command_TOP; cmd++ )
946 {
947 print( NL );
948 printInt8( cmd );
949 print(" - ");
950 dPrint( (char*)Command_strs[ cmd ] );
951 }
910 } 952 }
911 953
912 void cliFunc_connectMst( char* args ) 954 void cliFunc_connectMst( char* args )
913 { 955 {
914 // Parse number from argument 956 // Parse number from argument
942 { 984 {
943 print( NL ); 985 print( NL );
944 info_msg("Resetting UARTConnect state..."); 986 info_msg("Resetting UARTConnect state...");
945 Connect_reset(); 987 Connect_reset();
946 988
947 // TODO - Argument for re-sync 989 // Reset node id
990 Connect_id = 0xFF;
948 } 991 }
949 992
950 void cliFunc_connectSts( char* args ) 993 void cliFunc_connectSts( char* args )
951 { 994 {
952 print( NL ); 995 print( NL );