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_btnRequest_t
 
struct  CUI_ledRequest_t
 
struct  CUI_cursorInfo_t
 
struct  CUI_menuItem_t
 
struct  CUI_menu_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)   {.pDesc=NULL, .item.pSubMenu=(&_pSubMenu)},
 
#define CUI_MENU_ITEM_ACTION(_pItemDesc, _pFnAction)   {.pDesc=(_pItemDesc), .interceptable=false, .interceptActive=false, .item.pFnAction=(_pFnAction)},
 
#define CUI_MENU_ITEM_INT_ACTION(_pItemDesc, _pFnIntercept)   {.pDesc=(_pItemDesc), .interceptable=true, .interceptActive=false, .item.pFnIntercept=(_pFnIntercept)},
 
#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\033[k"
 
#define CUI_BLINK_CONTINUOUS   0xFFFF
 

Typedefs

typedef enum CUI_retVal CUI_retVal_t
 
typedef uint32_t CUI_clientHandle_t
 
typedef void(* CUI_btnPressCB_t) (uint32_t _index, Button_EventMask _buttonEvents)
 
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 struct CUI_menu_s CUI_menu_t
 

Enumerations

enum  CUI_retVal {
  CUI_SUCCESS, CUI_FAILURE, CUI_INVALID_CB, CUI_INVALID_PIN_ID,
  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_WRONG_BTN_MODE, CUI_NOT_MANAGING_BTNS, CUI_NOT_MANAGING_LEDS,
  CUI_NOT_MANAGING_UART
}
 

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_btnResourceRequest (const CUI_clientHandle_t _clientHandle, const CUI_btnRequest_t *_pRequest)
 
CUI_retVal_t CUI_btnSetCb (const CUI_clientHandle_t _clientHandle, const uint32_t _index, const CUI_btnPressCB_t _appCb)
 
CUI_retVal_t CUI_btnGetValue (const CUI_clientHandle_t _clientHandle, const uint32_t _index, bool *_pBtnState)
 
CUI_retVal_t CUI_btnResourceRelease (const CUI_clientHandle_t _clientHandle, const uint32_t _index)
 
CUI_retVal_t CUI_ledResourceRequest (const CUI_clientHandle_t _clientHandle, const CUI_ledRequest_t *_pRequest)
 
CUI_retVal_t CUI_ledResourceRelease (const CUI_clientHandle_t _clientHandle, const uint32_t _index)
 
CUI_retVal_t CUI_ledOn (const CUI_clientHandle_t _clientHandle, const uint32_t _index, const uint8_t _brightness)
 
CUI_retVal_t CUI_ledOff (const CUI_clientHandle_t _clientHandle, const uint32_t _index)
 
CUI_retVal_t CUI_ledToggle (const CUI_clientHandle_t _clientHandle, const uint32_t _index)
 
CUI_retVal_t CUI_ledBlink (const CUI_clientHandle_t _clientHandle, const uint32_t _index, const uint16_t _numBlinks)
 
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], uint32_t *_pLineId)
 
CUI_retVal_t CUI_statusLinePrintf (const CUI_clientHandle_t _clientHandle, const uint32_t _lineId, const char *format,...)
 
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:723
CUI_pFnClientMenuUpdate_t uartUpdateFn
Definition: cui.h:724

§ 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:723
CUI_pFnClientMenuUpdate_t uartUpdateFn
Definition: cui.h:724
CUI_menuItem_t menuItems[]
Definition: cui.h:728

§ CUI_MENU_ITEM_SUBMENU

#define CUI_MENU_ITEM_SUBMENU (   _pSubMenu)    {.pDesc=NULL, .item.pSubMenu=(&_pSubMenu)},

§ CUI_MENU_ITEM_ACTION

#define CUI_MENU_ITEM_ACTION (   _pItemDesc,
  _pFnAction 
)    {.pDesc=(_pItemDesc), .interceptable=false, .interceptActive=false, .item.pFnAction=(_pFnAction)},

§ CUI_MENU_ITEM_INT_ACTION

#define CUI_MENU_ITEM_INT_ACTION (   _pItemDesc,
  _pFnIntercept 
)    {.pDesc=(_pItemDesc), .interceptable=true, .interceptActive=false, .item.pFnIntercept=(_pFnIntercept)},

§ 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\033[k"

§ CUI_BLINK_CONTINUOUS

#define CUI_BLINK_CONTINUOUS   0xFFFF

Typedef Documentation

§ CUI_retVal_t

typedef enum CUI_retVal CUI_retVal_t

§ CUI_clientHandle_t

typedef uint32_t CUI_clientHandle_t

§ CUI_btnPressCB_t

typedef void(* CUI_btnPressCB_t) (uint32_t _index, Button_EventMask _buttonEvents)

Btn Press Callback function typedef

§ 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_menu_t

typedef struct CUI_menu_s CUI_menu_t

Enumeration Type Documentation

§ CUI_retVal

enum CUI_retVal
Enumerator
CUI_SUCCESS 
CUI_FAILURE 
CUI_INVALID_CB 
CUI_INVALID_PIN_ID 
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_WRONG_BTN_MODE 
CUI_NOT_MANAGING_BTNS 
CUI_NOT_MANAGING_LEDS 
CUI_NOT_MANAGING_UART 

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_btnResourceRequest()

CUI_retVal_t CUI_btnResourceRequest ( const CUI_clientHandle_t  _clientHandle,
const CUI_btnRequest_t _pRequest 
)

§ CUI_btnSetCb()

CUI_retVal_t CUI_btnSetCb ( const CUI_clientHandle_t  _clientHandle,
const uint32_t  _index,
const CUI_btnPressCB_t  _appCb 
)

§ CUI_btnGetValue()

CUI_retVal_t CUI_btnGetValue ( const CUI_clientHandle_t  _clientHandle,
const uint32_t  _index,
bool *  _pBtnState 
)

§ CUI_btnResourceRelease()

CUI_retVal_t CUI_btnResourceRelease ( const CUI_clientHandle_t  _clientHandle,
const uint32_t  _index 
)

§ CUI_ledResourceRequest()

CUI_retVal_t CUI_ledResourceRequest ( const CUI_clientHandle_t  _clientHandle,
const CUI_ledRequest_t _pRequest 
)

§ CUI_ledResourceRelease()

CUI_retVal_t CUI_ledResourceRelease ( const CUI_clientHandle_t  _clientHandle,
const uint32_t  _index 
)

§ CUI_ledOn()

CUI_retVal_t CUI_ledOn ( const CUI_clientHandle_t  _clientHandle,
const uint32_t  _index,
const uint8_t  _brightness 
)

§ CUI_ledOff()

CUI_retVal_t CUI_ledOff ( const CUI_clientHandle_t  _clientHandle,
const uint32_t  _index 
)

§ CUI_ledToggle()

CUI_retVal_t CUI_ledToggle ( const CUI_clientHandle_t  _clientHandle,
const uint32_t  _index 
)

§ CUI_ledBlink()

CUI_retVal_t CUI_ledBlink ( const CUI_clientHandle_t  _clientHandle,
const uint32_t  _index,
const uint16_t  _numBlinks 
)

§ 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],
uint32_t *  _pLineId 
)

§ CUI_statusLinePrintf()

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

§ 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-2019, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale