![]() |
Synergy Software Package User's Manual
|
#include <sf_console_api.h>
Data Fields | |
| ssp_err_t(* | open )(sf_console_ctrl_t *const p_ctrl, sf_console_cfg_t const *const p_cfg) |
| This function configures the console. This function must be called before any other console functions. More... | |
| ssp_err_t(* | close )(sf_console_ctrl_t *const p_ctrl) |
| The close API handles cleans up internal driver data. More... | |
| ssp_err_t(* | prompt )(sf_console_ctrl_t *const p_ctrl, sf_console_menu_t const *const p_menu, UINT const timeout) |
| Prints prompt string from menu, waits for input, parses input based on menu, and calls callback function if a command is identified. More... | |
| ssp_err_t(* | parse )(sf_console_ctrl_t *const p_ctrl, sf_console_menu_t const *const p_cmd_list, uint8_t const *const p_input, uint32_t const bytes) |
| Looks for input string in menu, and calls callback function if found. More... | |
| ssp_err_t(* | read )(sf_console_ctrl_t *const p_ctrl, uint8_t *const p_dest, uint32_t const bytes, uint32_t const timeout) |
| Reads data into the destination byte by byte and echos input to the console. Backspace, delete, and left/right arrow keys supported. Read completes when a line ending CR, CR+LF, or CR+NULL is received, or when the input exceeds the number of bytes input. If the buffer overflows SF_CONSOLE_MAX_INPUT_LENGTH, read will return an error code. More... | |
| ssp_err_t(* | write )(sf_console_ctrl_t *const p_ctrl, uint8_t const *const p_src, uint32_t const timeout) |
| The write API gets mutex object and handles UART data transmission at UART HAL layer. gets event flag to synchronize to completion of data transfer. More... | |
| ssp_err_t(* | argumentFind )(uint8_t const *const p_arg, uint8_t const *const p_str, int32_t *const p_index, int32_t *const p_data) |
| Finds a command line argument in an input string and returns the index of the character immediately following the argument and any string numbers converted to integers. More... | |
| ssp_err_t(* | versionGet )(ssp_version_t *const p_version) |
| Stores version information in provided pointer. More... | |
Console framework API structure. Console implementations will use the following API.
| ssp_err_t(* sf_console_api_t::argumentFind) (uint8_t const *const p_arg, uint8_t const *const p_str, int32_t *const p_index, int32_t *const p_data) |
Finds a command line argument in an input string and returns the index of the character immediately following the argument and any string numbers converted to integers.
| [in] | p_arg | Pointer to argument to find. |
| [in] | p_src | Pointer to source string to find the argument in. |
| [out] | p_index | Pointer to location to store index. Set to -1 if argument is not found in input string. Pass NULL if index is not requested. |
| [out] | p_data | Pointer to location to store data following the argument. Set to -1 if argument is not found in input string. Pass NULL if data is not requested. |
| ssp_err_t(* sf_console_api_t::close) (sf_console_ctrl_t *const p_ctrl) |
The close API handles cleans up internal driver data.
| [in] | p_ctrl | Pointer to device control block initialized in Open call for UART driver. |
| ssp_err_t(* sf_console_api_t::open) (sf_console_ctrl_t *const p_ctrl, sf_console_cfg_t const *const p_cfg) |
This function configures the console. This function must be called before any other console functions.
| [in,out] | p_ctrl | Pointer to a device structure allocated by user. The device control structure is initialized in this function. |
| [in] | p_cfg | Pointer to configuration structure. All elements of the structure must be set by user. |
| ssp_err_t(* sf_console_api_t::parse) (sf_console_ctrl_t *const p_ctrl, sf_console_menu_t const *const p_cmd_list, uint8_t const *const p_input, uint32_t const bytes) |
Looks for input string in menu, and calls callback function if found.
| [in] | p_ctrl | Pointer to device control block initialized in Open call for UART driver. |
| [in] | p_cmd_list | Pointer to a menu of valid input commands for this prompt |
| [in] | p_input | Pointer to a null terminated string to search for in the command list |
| [in] | bytes | Length of the input string. |
| ssp_err_t(* sf_console_api_t::prompt) (sf_console_ctrl_t *const p_ctrl, sf_console_menu_t const *const p_menu, UINT const timeout) |
Prints prompt string from menu, waits for input, parses input based on menu, and calls callback function if a command is identified.
| [in] | p_ctrl | Pointer to device control block initialized in Open call for UART driver. |
| [in] | p_menu | Set to NULL to stay on current menu maintained by the console framework. To change menus, pass a pointer to the new menu. |
| [in] | timeout | ThreadX timeout. Options include TX_NO_WAIT (0x00000000), TX_WAIT_FOREVER (0xFFFFFFFF), and timeout value (0x00000001 through 0xFFFFFFFE) in ThreadX tick counts. |
| ssp_err_t(* sf_console_api_t::read) (sf_console_ctrl_t *const p_ctrl, uint8_t *const p_dest, uint32_t const bytes, uint32_t const timeout) |
Reads data into the destination byte by byte and echos input to the console. Backspace, delete, and left/right arrow keys supported. Read completes when a line ending CR, CR+LF, or CR+NULL is received, or when the input exceeds the number of bytes input. If the buffer overflows SF_CONSOLE_MAX_INPUT_LENGTH, read will return an error code.
| [in] | p_ctrl | Pointer to device control block initialized in Open call for UART driver. |
| [in] | p_dest | Destination address to read data out |
| [in] | bytes | Read data length |
| [in] | timeout | ThreadX timeout. Options include TX_NO_WAIT (0x00000000), TX_WAIT_FOREVER (0xFFFFFFFF), and timeout value (0x00000001 through 0xFFFFFFFE) in ThreadX tick counts. |
| ssp_err_t(* sf_console_api_t::versionGet) (ssp_version_t *const p_version) |
Stores version information in provided pointer.
| [out] | p_version | Code and API version used stored here. |
| ssp_err_t(* sf_console_api_t::write) (sf_console_ctrl_t *const p_ctrl, uint8_t const *const p_src, uint32_t const timeout) |
The write API gets mutex object and handles UART data transmission at UART HAL layer. gets event flag to synchronize to completion of data transfer.
| [in] | p_ctrl | Pointer to device control block initialized in Open call for UART driver. |
| [in] | p_src | Pointer to a NULL terminated string. Length must be less than SF_CONSOLE_MAX_WRITE_LENGTH. |
| [in] | timeout | ThreadX timeout. Options include TX_NO_WAIT (0x00000000), TX_WAIT_FOREVER (0xFFFFFFFF), and timeout value (0x00000001 through 0xFFFFFFFE) in ThreadX tick counts. |