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...
 

Detailed Description

Console framework API structure. Console implementations will use the following API.

Field Documentation

◆ argumentFind

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.

Implemented as
Parameters
[in]p_argPointer to argument to find.
[in]p_srcPointer to source string to find the argument in.
[out]p_indexPointer 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_dataPointer 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.

◆ close

ssp_err_t(* sf_console_api_t::close) (sf_console_ctrl_t *const p_ctrl)

The close API handles cleans up internal driver data.

Implemented as
Parameters
[in]p_ctrlPointer to device control block initialized in Open call for UART driver.

◆ open

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.

Implemented as
Parameters
[in,out]p_ctrlPointer to a device structure allocated by user. The device control structure is initialized in this function.
[in]p_cfgPointer to configuration structure. All elements of the structure must be set by user.

◆ parse

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.

Implemented as
Parameters
[in]p_ctrlPointer to device control block initialized in Open call for UART driver.
[in]p_cmd_listPointer to a menu of valid input commands for this prompt
[in]p_inputPointer to a null terminated string to search for in the command list
[in]bytesLength of the input string.

◆ prompt

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.

Implemented as
Parameters
[in]p_ctrlPointer to device control block initialized in Open call for UART driver.
[in]p_menuSet to NULL to stay on current menu maintained by the console framework. To change menus, pass a pointer to the new menu.
[in]timeoutThreadX timeout. Options include TX_NO_WAIT (0x00000000), TX_WAIT_FOREVER (0xFFFFFFFF), and timeout value (0x00000001 through 0xFFFFFFFE) in ThreadX tick counts.

◆ read

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.

Implemented as
Parameters
[in]p_ctrlPointer to device control block initialized in Open call for UART driver.
[in]p_destDestination address to read data out
[in]bytesRead data length
[in]timeoutThreadX timeout. Options include TX_NO_WAIT (0x00000000), TX_WAIT_FOREVER (0xFFFFFFFF), and timeout value (0x00000001 through 0xFFFFFFFE) in ThreadX tick counts.

◆ versionGet

ssp_err_t(* sf_console_api_t::versionGet) (ssp_version_t *const p_version)

Stores version information in provided pointer.

Implemented as
Parameters
[out]p_versionCode and API version used stored here.

◆ write

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.

Implemented as
Parameters
[in]p_ctrlPointer to device control block initialized in Open call for UART driver.
[in]p_srcPointer to a NULL terminated string. Length must be less than SF_CONSOLE_MAX_WRITE_LENGTH.
[in]timeoutThreadX timeout. Options include TX_NO_WAIT (0x00000000), TX_WAIT_FOREVER (0xFFFFFFFF), and timeout value (0x00000001 through 0xFFFFFFFE) in ThreadX tick counts.

The documentation for this struct was generated from the following file: