User Input

Description

If no UART is available for command input, the CodeComposer input can be used to enter commands. Since all stdin functions are blocking, gets() can not be used in DSP systems when a continuous processing of main is required. To avoid a permanent blocking of main a GEL-input is used to enter the blocking stdin function on demand.


GEL file user_input.gel

Load gel file user_input.gel

CCS3_load_gel.png

This installs a new GEL dialog function:

dialog UserInput(input "enter 1 and press execute for next command")
{
user_input = input;
}




Function process_user_input()

Add function process_user_input() to your applications code and call it regularly from main

int process_user_input (void)
{
//**************************************************************************
// locals
//**************************************************************************
//**************************************************************************
// wait for user input (use user_input.gel)
//**************************************************************************
if ( user_input == -1 )
{
return (0);
} // if
//**************************************************************************
// enter blocking stdin function to read a new command from stdin
//**************************************************************************
gets(aCmdLine);
user_input = -1;
CPrintf("%s", aCmdLine);
return (1);
}
void main ( void )
{
while (running)
{
//**********************************************************************
// user input:
// process_user_input() returns TRUE if enter key was pressed
//**********************************************************************
if ( process_user_input () )
{
//******************************************************************
// process command
//******************************************************************
...
}
}
}

Trigger user input

Open GEL dialog UserInput

CCS3_gel_input.png

Enter 1 into the new opened dialog and press "Execute"

CCS3_gel_input2.png




CCS3 Input dialog

The standard input dialog opens and waits for the user input. Note that this action is blocking.

CCS3_standard_input.png

Enter a new command, e.g. dir, and press OK or enter key:

CCS3_standard_input2.png

The new command is processed by the application and the main loop is processed regularly again:

CCS3_printout.png




CCS4/CCS5 Input

CCS4/CCS5 does not open an input dialog. Instead the Debug window shows a message "Running - Waiting for user input in Console"

CCS5_wait_for_input.png

Set the cursor into the Console window

CCS5_wait_for_input2.png

... and type a command:

CCS5_input.png

If you hit enter, this command is received by fgets() function and the command is issued:

CCS5_input2.png