Simple implementation of an command-interface. More...
#include "cmd_interface.h"
Functions | |
int8_t | execute_command () |
internal function which executes the commands | |
int8_t | split_command_line () |
internal function which splits the act. command line into separated components, which are separated by split signs. | |
void | cmd_interface_init () |
initialisation routine for command interface variables | |
uint8_t | cmd_interface_add_cmd (char(*cmd_string), uint8_t(*cmd_func_ptr)(int8_t argc, char *argval[])) |
adding a command to internal command - table | |
int8_t | execute_cmd_interface (char *string) |
routine called to execute command interface | |
Variables | |
char | c_ptr_cmd_line [_CMD_INTERFACE_MAX_LENGTH+1] |
cmd_interface_command_table_t | cmd_interface_table [_CMD_INTERFACE_NO_OF_COMMANDS] |
Simple implementation of an command-interface.
Target/Compiler: AVR_MEGA / GCC(WinAVR)
\
uint8_t cmd_interface_add_cmd | ( | char * | cmd_string, | |
uint8_t(*)(int8_t argc, char *argval[]) | cmd_func_ptr | |||
) |
adding a command to internal command - table
char | *cmd_string - String representing the command | |
uint8_t | (*cmd_func_ptr) - pointer to function which shall be executed if the command has been found |
This function shall add a given string and function-pointer to the internal command-table. The string in the command-table is used by the internal functions to determine whether a command is known or not. The function where the function-pointer is pointing to is called in the case the entered command matches to the given string. The function MUST have the following interface-declaration.... uint8_t cmd_func (int8_t argc, char *argval[])
void cmd_interface_init | ( | ) |
initialisation routine for command interface variables
none |
int8_t execute_cmd_interface | ( | char * | string | ) |
routine called to execute command interface
*string | - to attach at the actual command_line buffer |
This routine has to be called to execute the command-interface It attaches the forwarded string to the internal command-line buffer and its sub-functions interprets the line before it executes the corresponding command-function given by the user
int8_t execute_command | ( | ) |
internal function which executes the commands
none |
this functions checks whether the given command exists in the command-table if it exists it executes the function referenced in the function-pointer which belongs the specific command.
int8_t split_command_line | ( | ) |
internal function which splits the act. command line into separated components, which are separated by split signs.
none |
cmd_interface_command_table_t cmd_interface_table[_CMD_INTERFACE_NO_OF_COMMANDS] |
internal table used to store the differen combinations of commands and functions