Other Parts Discussed in Thread: SYSCONFIG
Hi,
I'm trying to disable and remove uart in the latest sensor_oad_offchip_secure example.
In cui.h I read the following:
By calling CUI_paramsInit() you are setting the cuiParams to their default
values.
cuiParams.manageBtns = true
cuiParams.manageLeds = true
cuiParams.manageUart = true
If your application requires special management of buttons, leds, or uart
the developer can set the parameters appropriately before calling CUI_init()
I then found the following in cui.c:
void CUI_paramsInit(CUI_params_t* _pParams)
{
_pParams->manageBtns = true;
_pParams->manageLeds = true;
_pParams->manageUart = true;
}
But when I change manageUart to false and remove the uart interface in sensor.syscfg, I get compile errors.
I would have thought setting it to false would skip the part below:
if (_pParams->manageUart)
{
gManageUart = true;
// UART semaphore setup
Semaphore_construct(&gUartSemStruct, 1, &gSemParams);
gUartSem = Semaphore_handle(&gUartSemStruct);
Semaphore_construct(&gMenuSemStruct, 1, &gSemParams);
gMenuSem = Semaphore_handle(&gMenuSemStruct);
{
// General UART setup
UART_init();
UART_Params_init(&gUartParams);
gUartParams.baudRate = 115200;
gUartParams.writeMode = UART_MODE_CALLBACK;
gUartParams.writeDataMode = UART_DATA_BINARY;
gUartParams.writeCallback = UartWriteCallback;
gUartParams.readMode = UART_MODE_CALLBACK;
gUartParams.readDataMode = UART_DATA_BINARY;
gUartParams.readCallback = UartReadCallback;
gUartHandle = UART_open(CONFIG_DISPLAY_UART, &gUartParams);
if (NULL == gUartHandle)
{
return CUI_FAILURE;
}
else
{
UART_read(gUartHandle, gUartRxBuffer, sizeof(gUartRxBuffer));
UART_control(gUartHandle, UARTCC26XX_CMD_RETURN_PARTIAL_ENABLE, NULL);
gUartWriteComplete = true;
strncpy(menuBuff, CUI_ESC_CLR CUI_ESC_TRM_MODE CUI_ESC_CUR_HIDE, sizeof(menuBuff));
if (CUI_SUCCESS != CUI_writeString(menuBuff, strlen(menuBuff)))
{
UART_close(gUartHandle);
return CUI_FAILURE;
}
memset(menuBuff, 0, sizeof(menuBuff));
}
}
// Multi Menu Initialization
{
memset(gMenuResources, 0, sizeof(gMenuResources) / sizeof(gMenuResources[0]));
/*
* No additional initialization is needed in the case of a single
* menu being registered to the CUI module. In the case of 2 or more
* menus being registered the global cuiMultiMenu object will
* be used as the top level menu and every registered menu will be a
* sub menu of the cuiMultiMenu instead.
*/
for (int i = 0; i < MAX_REGISTERED_MENUS + 1; i++)
{
memset(&cuiMultiMenu.menuItems[i], 0, sizeof(cuiMultiMenu.menuItems[i]));
}
}
// Status Lines Setup
{
Semaphore_construct(&gStatusSemStruct, 1, &gSemParams);
gStatusSem = Semaphore_handle(&gStatusSemStruct);
}
}
I also tried removing the param from cui.h:
typedef struct {
bool manageBtns;
bool manageLeds;
bool manageUart;
} CUI_params_t;
I would like to be able to disable and remove the led's, buttons and uart without changing a lot of code