CUI API  1.00.00.00
Data Structures | Macros | Typedefs | Enumerations | Functions
cui.h File Reference
#include <stdlib.h>
#include <stdint.h>
#include <ti/drivers/apps/Button.h>
#include <ti/drivers/apps/LED.h>

Go to the source code of this file.

Data Structures

struct  CUI_params_t
 
struct  CUI_clientParams_t
 
struct  CUI_cursorInfo_t
 
struct  CUI_menuItem_t
 
struct  CUI_menu_s
 
struct  CUI_list_s
 

Macros

#define MAX_CLIENTS   2
 
#define MAX_CLIENT_NAME_LEN   64
 
#define MAX_REGISTERED_MENUS   4
 
#define MAX_MENU_LINE_LEN   128
 
#define MAX_STATUS_LINE_LABEL_LEN   32
 
#define MAX_STATUS_LINE_VALUE_LEN   128
 
#define CUI_MAIN_MENU(_menuSymbol, _pMenuTitle, _numItems, _pMenuUpdateFn)
 
#define CUI_SUB_MENU(_menuSymbol, _pMenuTitle, _numItems, _pUpperMenu)
 
#define CUI_MENU_ITEM_SUBMENU(_pSubMenu)
 
#define CUI_MENU_ITEM_ACTION(_pItemDesc, _pFnAction)
 
#define CUI_MENU_ITEM_INT_ACTION(_pItemDesc, _pFnIntercept)
 
#define CUI_MENU_ITEM_LIST_ACTION(_pItemDesc, _maxListItems, _pFnListAction)
 
#define CUI_MENU_ITEM_HELP   CUI_MENU_ITEM_INT_ACTION(CUI_MENU_ACTION_HELP_DESC, (CUI_pFnIntercept_t) CUI_menuActionHelp)
 
#define CUI_MENU_ITEM_BACK   CUI_MENU_ITEM_ACTION(CUI_MENU_ACTION_BACK_DESC, (CUI_pFnAction_t) CUI_menuActionBack)
 
#define CUI_MAIN_MENU_END   CUI_MENU_ITEM_HELP }};
 
#define CUI_SUB_MENU_END   CUI_MENU_ITEM_BACK }};
 
#define CUI_MENU_ACTION_BACK_DESC   "< BACK >"
 
#define CUI_MENU_ACTION_HELP_DESC   "< HELP >"
 
#define CUI_IS_INPUT_NUM(_input)   ((_input >= '0') && (_input <= '9'))
 
#define CUI_IS_INPUT_ALPHA(_input)   ((_input >= 'a') && (_input <= 'z'))
 
#define CUI_IS_INPUT_ALPHA_NUM(_input)   ((CUI_IS_INPUT_ALPHA(_input)) && (CUI_IS_INPUT_NUM(_input)))
 
#define CUI_IS_INPUT_HEX(_input)   ((CUI_IS_INPUT_NUM(_input)) || ((_input >= 'a') && (_input <= 'f')))
 
#define CUI_IS_INPUT_BINARY(_input)   ((_input == '0') || (_input == '1'))
 
#define CUI_ITEM_PREVIEW   0x00
 
#define CUI_ITEM_INTERCEPT_START   0xFE
 
#define CUI_ITEM_INTERCEPT_STOP   0xFF
 
#define CUI_ITEM_INTERCEPT_CANCEL   0xF9
 
#define CUI_INPUT_UP   0xFA
 
#define CUI_INPUT_DOWN   0xFB
 
#define CUI_INPUT_RIGHT   0xFC
 
#define CUI_INPUT_LEFT   0xFD
 
#define CUI_INPUT_BACK   0x7F
 
#define CUI_INPUT_EXECUTE   0x0D
 
#define CUI_INPUT_ESC   0x1B
 
#define CUI_COLOR_RESET   "\033[0m"
 
#define CUI_COLOR_RED   "\033[31m"
 
#define CUI_COLOR_GREEN   "\033[32m"
 
#define CUI_COLOR_YELLOW   "\033[33m"
 
#define CUI_COLOR_BLUE   "\033[34m"
 
#define CUI_COLOR_MAGENTA   "\033[35m"
 
#define CUI_COLOR_CYAN   "\033[36m"
 
#define CUI_COLOR_WHITE   "\033[37m"
 
#define CUI_DEBUG_MSG_START   "\0337"
 
#define CUI_DEBUG_MSG_END   "\0338"
 

Typedefs

typedef enum CUI_retVal CUI_retVal_t
 
typedef uint32_t CUI_clientHandle_t
 
typedef void(* CUI_pFnClientMenuUpdate_t) (void)
 
typedef void(* CUI_pFnAction_t) (const int32_t _itemEntry)
 
typedef void(* CUI_pFnIntercept_t) (const char _input, char *_lines[3], CUI_cursorInfo_t *_curInfo)
 
typedef void(* CUI_pFnListAction_t) (const uint32_t _listIndex, char *_lines[3], bool _selected)
 
typedef struct CUI_menu_s CUI_menu_t
 
typedef struct CUI_list_s CUI_list_t
 
typedef enum CUI_menuItems CUI_itemType_t
 

Enumerations

enum  CUI_retVal {
  CUI_SUCCESS, CUI_FAILURE, CUI_INVALID_CB, CUI_RESOURCE_ALREADY_ACQUIRED,
  CUI_RESOURCE_NOT_ACQUIRED, CUI_MODULE_UNINITIALIZED, CUI_INVALID_CLIENT_HANDLE, CUI_MAX_CLIENTS_REACHED,
  CUI_NO_ASYNC_LINES_RELEASED, CUI_INVALID_LINE_ID, CUI_UNKOWN_VALUE_TYPE, CUI_UART_FAILURE,
  CUI_INVALID_PARAM, CUI_MAX_MENUS_REACHED, CUI_PREV_WRITE_UNFINISHED, CUI_MISSING_UART_UPDATE_FN,
  CUI_NOT_MANAGING_UART
}
 
enum  CUI_menuItems { CUI_MENU_ITEM_TYPE_SUBMENU, CUI_MENU_ITEM_TYPE_ACTION, CUI_MENU_ITEM_TYPE_INTERCEPT, CUI_MENU_ITEM_TYPE_LIST }
 

Functions

CUI_retVal_t CUI_init (CUI_params_t *_pParams)
 
void CUI_paramsInit (CUI_params_t *_pParams)
 
CUI_clientHandle_t CUI_clientOpen (CUI_clientParams_t *_pParams)
 
void CUI_clientParamsInit (CUI_clientParams_t *_pClientParams)
 
CUI_retVal_t CUI_close ()
 
CUI_retVal_t CUI_registerMenu (const CUI_clientHandle_t _clientHandle, CUI_menu_t *_pMenu)
 
CUI_retVal_t CUI_deRegisterMenu (const CUI_clientHandle_t _clientHandle, CUI_menu_t *_pMenu)
 
CUI_retVal_t CUI_updateMultiMenuTitle (const char *_pTitle)
 
CUI_retVal_t CUI_menuNav (const CUI_clientHandle_t _clientHandle, CUI_menu_t *_pMenu, const uint32_t _itemIndex)
 
CUI_retVal_t CUI_processMenuUpdate (void)
 
CUI_retVal_t CUI_statusLineResourceRequest (const CUI_clientHandle_t _clientHandle, const char _pLabel[MAX_STATUS_LINE_LABEL_LEN], const bool _refreshInd, uint32_t *_pLineId)
 
CUI_retVal_t CUI_statusLinePrintf (const CUI_clientHandle_t _clientHandle, const uint32_t _lineId, const char *format,...)
 
void CUI_wrappedIncrement (size_t *_pValue, int32_t _incAmt, size_t _maxValue)
 
void CUI_assert (const char *_assertMsg, const bool _spinLock)
 
void CUI_menuActionBack (const int32_t _itemEntry)
 
void CUI_menuActionHelp (const char _input, char *_pLines[3], CUI_cursorInfo_t *_pCurInfo)
 

Macro Definition Documentation

§ MAX_CLIENTS

#define MAX_CLIENTS   2

§ MAX_CLIENT_NAME_LEN

#define MAX_CLIENT_NAME_LEN   64

§ MAX_REGISTERED_MENUS

#define MAX_REGISTERED_MENUS   4

§ MAX_MENU_LINE_LEN

#define MAX_MENU_LINE_LEN   128

§ MAX_STATUS_LINE_LABEL_LEN

#define MAX_STATUS_LINE_LABEL_LEN   32

§ MAX_STATUS_LINE_VALUE_LEN

#define MAX_STATUS_LINE_VALUE_LEN   128

§ CUI_MAIN_MENU

#define CUI_MAIN_MENU (   _menuSymbol,
  _pMenuTitle,
  _numItems,
  _pMenuUpdateFn 
)
Value:
CUI_menu_t _menuSymbol = { \
.uartUpdateFn=_pMenuUpdateFn, \
.pTitle=_pMenuTitle, \
.numItems=_numItems + 1, \
.pUpper=NULL, \
.menuItems = {
Definition: cui.h:784
CUI_pFnClientMenuUpdate_t uartUpdateFn
Definition: cui.h:785

§ CUI_SUB_MENU

#define CUI_SUB_MENU (   _menuSymbol,
  _pMenuTitle,
  _numItems,
  _pUpperMenu 
)
Value:
extern CUI_menu_t _pUpperMenu; \
CUI_menu_t _menuSymbol = { \
.uartUpdateFn=NULL, \
.pTitle=_pMenuTitle, \
.numItems=_numItems + 1, \
.pUpper=&_pUpperMenu, \
.menuItems = {
Definition: cui.h:784
CUI_pFnClientMenuUpdate_t uartUpdateFn
Definition: cui.h:785
CUI_menuItem_t menuItems[]
Definition: cui.h:789

§ CUI_MENU_ITEM_SUBMENU

#define CUI_MENU_ITEM_SUBMENU (   _pSubMenu)
Value:
{ \
.pDesc=NULL, \
.item.pSubMenu=(&_pSubMenu)},
Definition: cui.h:764

§ CUI_MENU_ITEM_ACTION

#define CUI_MENU_ITEM_ACTION (   _pItemDesc,
  _pFnAction 
)
Value:
{ \
.pDesc=(_pItemDesc), \
.interceptActive=false, \
.item.pFnAction=(_pFnAction)},
Definition: cui.h:765

§ CUI_MENU_ITEM_INT_ACTION

#define CUI_MENU_ITEM_INT_ACTION (   _pItemDesc,
  _pFnIntercept 
)
Value:
{ \
.pDesc=(_pItemDesc), \
.interceptActive=false, \
.item.pFnIntercept=(_pFnIntercept)},
Definition: cui.h:766

§ CUI_MENU_ITEM_LIST_ACTION

#define CUI_MENU_ITEM_LIST_ACTION (   _pItemDesc,
  _maxListItems,
  _pFnListAction 
)
Value:
{ \
.pDesc=(_pItemDesc), \
.interceptActive=false, \
.item.pList=&((CUI_list_t){ \
.pFnListAction=(_pFnListAction), \
.maxListItems=_maxListItems, \
.currListIndex=0})},
Definition: cui.h:767
Definition: cui.h:793

§ CUI_MENU_ITEM_HELP

§ CUI_MENU_ITEM_BACK

§ CUI_MAIN_MENU_END

#define CUI_MAIN_MENU_END   CUI_MENU_ITEM_HELP }};

§ CUI_SUB_MENU_END

#define CUI_SUB_MENU_END   CUI_MENU_ITEM_BACK }};

§ CUI_MENU_ACTION_BACK_DESC

#define CUI_MENU_ACTION_BACK_DESC   "< BACK >"

§ CUI_MENU_ACTION_HELP_DESC

#define CUI_MENU_ACTION_HELP_DESC   "< HELP >"

§ CUI_IS_INPUT_NUM

#define CUI_IS_INPUT_NUM (   _input)    ((_input >= '0') && (_input <= '9'))

§ CUI_IS_INPUT_ALPHA

#define CUI_IS_INPUT_ALPHA (   _input)    ((_input >= 'a') && (_input <= 'z'))

§ CUI_IS_INPUT_ALPHA_NUM

#define CUI_IS_INPUT_ALPHA_NUM (   _input)    ((CUI_IS_INPUT_ALPHA(_input)) && (CUI_IS_INPUT_NUM(_input)))

§ CUI_IS_INPUT_HEX

#define CUI_IS_INPUT_HEX (   _input)    ((CUI_IS_INPUT_NUM(_input)) || ((_input >= 'a') && (_input <= 'f')))

§ CUI_IS_INPUT_BINARY

#define CUI_IS_INPUT_BINARY (   _input)    ((_input == '0') || (_input == '1'))

§ CUI_ITEM_PREVIEW

#define CUI_ITEM_PREVIEW   0x00

§ CUI_ITEM_INTERCEPT_START

#define CUI_ITEM_INTERCEPT_START   0xFE

§ CUI_ITEM_INTERCEPT_STOP

#define CUI_ITEM_INTERCEPT_STOP   0xFF

§ CUI_ITEM_INTERCEPT_CANCEL

#define CUI_ITEM_INTERCEPT_CANCEL   0xF9

§ CUI_INPUT_UP

#define CUI_INPUT_UP   0xFA

§ CUI_INPUT_DOWN

#define CUI_INPUT_DOWN   0xFB

§ CUI_INPUT_RIGHT

#define CUI_INPUT_RIGHT   0xFC

§ CUI_INPUT_LEFT

#define CUI_INPUT_LEFT   0xFD

§ CUI_INPUT_BACK

#define CUI_INPUT_BACK   0x7F

§ CUI_INPUT_EXECUTE

#define CUI_INPUT_EXECUTE   0x0D

§ CUI_INPUT_ESC

#define CUI_INPUT_ESC   0x1B

§ CUI_COLOR_RESET

#define CUI_COLOR_RESET   "\033[0m"

§ CUI_COLOR_RED

#define CUI_COLOR_RED   "\033[31m"

§ CUI_COLOR_GREEN

#define CUI_COLOR_GREEN   "\033[32m"

§ CUI_COLOR_YELLOW

#define CUI_COLOR_YELLOW   "\033[33m"

§ CUI_COLOR_BLUE

#define CUI_COLOR_BLUE   "\033[34m"

§ CUI_COLOR_MAGENTA

#define CUI_COLOR_MAGENTA   "\033[35m"

§ CUI_COLOR_CYAN

#define CUI_COLOR_CYAN   "\033[36m"

§ CUI_COLOR_WHITE

#define CUI_COLOR_WHITE   "\033[37m"

§ CUI_DEBUG_MSG_START

#define CUI_DEBUG_MSG_START   "\0337"

§ CUI_DEBUG_MSG_END

#define CUI_DEBUG_MSG_END   "\0338"

Typedef Documentation

§ CUI_retVal_t

typedef enum CUI_retVal CUI_retVal_t

§ CUI_clientHandle_t

typedef uint32_t CUI_clientHandle_t

§ CUI_pFnClientMenuUpdate_t

typedef void(* CUI_pFnClientMenuUpdate_t) (void)

§ CUI_pFnAction_t

typedef void(* CUI_pFnAction_t) (const int32_t _itemEntry)

§ CUI_pFnIntercept_t

typedef void(* CUI_pFnIntercept_t) (const char _input, char *_lines[3], CUI_cursorInfo_t *_curInfo)

§ CUI_pFnListAction_t

typedef void(* CUI_pFnListAction_t) (const uint32_t _listIndex, char *_lines[3], bool _selected)

§ CUI_menu_t

typedef struct CUI_menu_s CUI_menu_t

§ CUI_list_t

typedef struct CUI_list_s CUI_list_t

§ CUI_itemType_t

Enumeration Type Documentation

§ CUI_retVal

enum CUI_retVal
Enumerator
CUI_SUCCESS 
CUI_FAILURE 
CUI_INVALID_CB 
CUI_RESOURCE_ALREADY_ACQUIRED 
CUI_RESOURCE_NOT_ACQUIRED 
CUI_MODULE_UNINITIALIZED 
CUI_INVALID_CLIENT_HANDLE 
CUI_MAX_CLIENTS_REACHED 
CUI_NO_ASYNC_LINES_RELEASED 
CUI_INVALID_LINE_ID 
CUI_UNKOWN_VALUE_TYPE 
CUI_UART_FAILURE 
CUI_INVALID_PARAM 
CUI_MAX_MENUS_REACHED 
CUI_PREV_WRITE_UNFINISHED 
CUI_MISSING_UART_UPDATE_FN 
CUI_NOT_MANAGING_UART 

§ CUI_menuItems

Enumerator
CUI_MENU_ITEM_TYPE_SUBMENU 
CUI_MENU_ITEM_TYPE_ACTION 
CUI_MENU_ITEM_TYPE_INTERCEPT 
CUI_MENU_ITEM_TYPE_LIST 

Function Documentation

§ CUI_init()

CUI_retVal_t CUI_init ( CUI_params_t _pParams)

§ CUI_paramsInit()

void CUI_paramsInit ( CUI_params_t _pParams)

§ CUI_clientOpen()

CUI_clientHandle_t CUI_clientOpen ( CUI_clientParams_t _pParams)

§ CUI_clientParamsInit()

void CUI_clientParamsInit ( CUI_clientParams_t _pClientParams)

§ CUI_close()

CUI_retVal_t CUI_close ( )

§ CUI_registerMenu()

CUI_retVal_t CUI_registerMenu ( const CUI_clientHandle_t  _clientHandle,
CUI_menu_t _pMenu 
)

§ CUI_deRegisterMenu()

CUI_retVal_t CUI_deRegisterMenu ( const CUI_clientHandle_t  _clientHandle,
CUI_menu_t _pMenu 
)

§ CUI_updateMultiMenuTitle()

CUI_retVal_t CUI_updateMultiMenuTitle ( const char *  _pTitle)

§ CUI_menuNav()

CUI_retVal_t CUI_menuNav ( const CUI_clientHandle_t  _clientHandle,
CUI_menu_t _pMenu,
const uint32_t  _itemIndex 
)

§ CUI_processMenuUpdate()

CUI_retVal_t CUI_processMenuUpdate ( void  )

§ CUI_statusLineResourceRequest()

CUI_retVal_t CUI_statusLineResourceRequest ( const CUI_clientHandle_t  _clientHandle,
const char  _pLabel[MAX_STATUS_LINE_LABEL_LEN],
const bool  _refreshInd,
uint32_t *  _pLineId 
)

§ CUI_statusLinePrintf()

CUI_retVal_t CUI_statusLinePrintf ( const CUI_clientHandle_t  _clientHandle,
const uint32_t  _lineId,
const char *  format,
  ... 
)

§ CUI_wrappedIncrement()

void CUI_wrappedIncrement ( size_t *  _pValue,
int32_t  _incAmt,
size_t  _maxValue 
)

§ CUI_assert()

void CUI_assert ( const char *  _assertMsg,
const bool  _spinLock 
)

§ CUI_menuActionBack()

void CUI_menuActionBack ( const int32_t  _itemEntry)

§ CUI_menuActionHelp()

void CUI_menuActionHelp ( const char  _input,
char *  _pLines[3],
CUI_cursorInfo_t _pCurInfo 
)
© Copyright 1995-2022, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale