This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2642R: CC2652R: How to remove two buttons menu (two_btn_menu) and display from simple_peripheral project

Part Number: CC2642R
Other Parts Discussed in Thread: CC1352R, CC2652P, CC2652R, CC1352P, SYSCONFIG

CC26x2


Note: The following instructions have been written for SDK 3_40_00_02 but can be adapted to quite any SDK version (that is why I provided the sources but also the diff files). In addition, the code was written for CC2642R but can be adapted to all the devices of the family (CC2652R, CC2652P, CC1352R, CC1352P)


By removing the two_btn_menu and the display from the simple_peripheral project, you can significantly increase the remaining memory available on the device.
Remaining FLASH memory:
+ 8.7kB (in comparison with OOB example)

How to do this?

1. Import the simple_peripheral project

2. Change the IO Capabilities (used for pairing/bonding) of your device. This requires SysConfig: BLE > Bond Manager > IO Capabilities. Set it to “No Display or Input Device”. You can also directly use the .syscfg I have modified for you:

Here is the .syscfg file already modified: simple_peripheral.syscfg

3. Remove all the occurrences of "display" and "tbm" in main.c, simple_peripheral.c and simple_peripheral.h.

Here is the diff file for main.c (and the content of main.c at the end of the modification):

1300.main_removeDisplay.diff
--- C:\ti\simplelink_cc13x2_26x2_sdk_3_40_00_02\examples\rtos\CC26X2R1_LAUNCHXL\ble5stack\simple_peripheral\Startup\main.c	Wed Dec 18 22:55:20 2019
+++ C:\ti\simplelink_cc13x2_26x2_sdk_3_40_00_02\examples\rtos\CC26X2R1_LAUNCHXL\ble5stack\simple_peripheral\Startup\main_SIMPLE.c	Mon Feb 10 15:53:38 2020
@@ -73,8 +73,6 @@
 icall_userCfg_t user0Cfg = BLE_USER_CFG;
 #endif // USE_DEFAULT_USER_CFG
 
-#include <ti/display/Display.h>
-
 /*******************************************************************************
  * MACROS
  */
@@ -100,8 +98,6 @@
  */
 
 extern void AssertHandler(uint8 assertCause, uint8 assertSubcause);
-
-extern Display_Handle dispHandle;
 
 /*******************************************************************************
  * @fn          Main
@@ -199,61 +195,7 @@
  */
 void AssertHandler(uint8 assertCause, uint8 assertSubcause)
 {
-  // Open the display if the app has not already done so
-  if ( !dispHandle )
-  {
-    dispHandle = Display_open(Display_Type_ANY, NULL);
-  }
-
-  Display_print0(dispHandle, 0, 0, ">>>STACK ASSERT");
-
-  // check the assert cause
-  switch (assertCause)
-  {
-    case HAL_ASSERT_CAUSE_OUT_OF_MEMORY:
-      Display_print0(dispHandle, 0, 0, "***ERROR***");
-      Display_print0(dispHandle, 2, 0, ">> OUT OF MEMORY!");
-      break;
-
-    case HAL_ASSERT_CAUSE_INTERNAL_ERROR:
-      // check the subcause
-      if (assertSubcause == HAL_ASSERT_SUBCAUSE_FW_INERNAL_ERROR)
-      {
-        Display_print0(dispHandle, 0, 0, "***ERROR***");
-        Display_print0(dispHandle, 2, 0, ">> INTERNAL FW ERROR!");
-      }
-      else
-      {
-        Display_print0(dispHandle, 0, 0, "***ERROR***");
-        Display_print0(dispHandle, 2, 0, ">> INTERNAL ERROR!");
-      }
-      break;
-
-    case HAL_ASSERT_CAUSE_ICALL_ABORT:
-      Display_print0(dispHandle, 0, 0, "***ERROR***");
-      Display_print0(dispHandle, 2, 0, ">> ICALL ABORT!");
-      HAL_ASSERT_SPINLOCK;
-      break;
-
-    case HAL_ASSERT_CAUSE_ICALL_TIMEOUT:
-      Display_print0(dispHandle, 0, 0, "***ERROR***");
-      Display_print0(dispHandle, 2, 0, ">> ICALL TIMEOUT!");
-      HAL_ASSERT_SPINLOCK;
-      break;
-
-    case HAL_ASSERT_CAUSE_WRONG_API_CALL:
-      Display_print0(dispHandle, 0, 0, "***ERROR***");
-      Display_print0(dispHandle, 2, 0, ">> WRONG API CALL!");
-      HAL_ASSERT_SPINLOCK;
-      break;
-
-  default:
-      Display_print0(dispHandle, 0, 0, "***ERROR***");
-      Display_print0(dispHandle, 2, 0, ">> DEFAULT SPINLOCK!");
-      HAL_ASSERT_SPINLOCK;
-  }
-
-  return;
+    HAL_ASSERT_SPINLOCK;
 }
 
 

7484.main.c
/******************************************************************************

 @file  main.c

 @brief main entry of the BLE stack sample application.

 Group: WCS, BTS
 Target Device: cc13x2_26x2

 ******************************************************************************
 
 Copyright (c) 2013-2019, Texas Instruments Incorporated
 All rights reserved.

 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions
 are met:

 *  Redistributions of source code must retain the above copyright
    notice, this list of conditions and the following disclaimer.

 *  Redistributions in binary form must reproduce the above copyright
    notice, this list of conditions and the following disclaimer in the
    documentation and/or other materials provided with the distribution.

 *  Neither the name of Texas Instruments Incorporated nor the names of
    its contributors may be used to endorse or promote products derived
    from this software without specific prior written permission.

 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
 OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

 ******************************************************************************
 
 
 *****************************************************************************/

/*******************************************************************************
 * INCLUDES
 */

#include <xdc/runtime/Error.h>

#include <ti/sysbios/knl/Clock.h>
#include <ti/drivers/Power.h>
#include <ti/drivers/power/PowerCC26XX.h>
#include <ti/sysbios/BIOS.h>

#include <icall.h>
#include "hal_assert.h"
#include "bcomdef.h"
#include "simple_peripheral.h"
#ifdef PTM_MODE
#include "npi_task.h"
#endif // PTM_MODE

/* Header files required to enable instruction fetch cache */
#include <inc/hw_memmap.h>
#include <driverlib/vims.h>

#ifndef USE_DEFAULT_USER_CFG
#include "ble_user_config.h"
// BLE user defined configuration
icall_userCfg_t user0Cfg = BLE_USER_CFG;
#endif // USE_DEFAULT_USER_CFG

/*******************************************************************************
 * MACROS
 */

/*******************************************************************************
 * CONSTANTS
 */

/*******************************************************************************
 * TYPEDEFS
 */

/*******************************************************************************
 * LOCAL VARIABLES
 */

/*******************************************************************************
 * GLOBAL VARIABLES
 */

/*******************************************************************************
 * EXTERNS
 */

extern void AssertHandler(uint8 assertCause, uint8 assertSubcause);

/*******************************************************************************
 * @fn          Main
 *
 * @brief       Application Main
 *
 * input parameters
 *
 * @param       None.
 *
 * output parameters
 *
 * @param       None.
 *
 * @return      None.
 */
int main()
{
  /* Register Application callback to trap asserts raised in the Stack */
  RegisterAssertCback(AssertHandler);

  Board_initGeneral();

  // Enable iCache prefetching
  VIMSConfigure(VIMS_BASE, TRUE, TRUE);
  // Enable cache
  VIMSModeSet(VIMS_BASE, VIMS_MODE_ENABLED);

#if !defined( POWER_SAVING )
  /* Set constraints for Standby, powerdown and idle mode */
  // PowerCC26XX_SB_DISALLOW may be redundant
  Power_setConstraint(PowerCC26XX_SB_DISALLOW);
  Power_setConstraint(PowerCC26XX_IDLE_PD_DISALLOW);
#endif // POWER_SAVING

  /* Update User Configuration of the stack */
  user0Cfg.appServiceInfo->timerTickPeriod = Clock_tickPeriod;
  user0Cfg.appServiceInfo->timerMaxMillisecond  = ICall_getMaxMSecs();

  /* Initialize ICall module */
  ICall_init();

  /* Start tasks of external images - Priority 5 */
  ICall_createRemoteTasks();

#ifdef PTM_MODE
  /* Start task for NPI task */
  NPITask_createTask(ICALL_SERVICE_CLASS_BLE);
#endif // PTM_MODE

  SimplePeripheral_createTask();

  /* enable interrupts and start SYS/BIOS */
  BIOS_start();

  return 0;
}


/*******************************************************************************
 * @fn          AssertHandler
 *
 * @brief       This is the Application's callback handler for asserts raised
 *              in the stack.  When EXT_HAL_ASSERT is defined in the Stack Wrapper
 *              project this function will be called when an assert is raised,
 *              and can be used to observe or trap a violation from expected
 *              behavior.
 *
 *              As an example, for Heap allocation failures the Stack will raise
 *              HAL_ASSERT_CAUSE_OUT_OF_MEMORY as the assertCause and
 *              HAL_ASSERT_SUBCAUSE_NONE as the assertSubcause.  An application
 *              developer could trap any malloc failure on the stack by calling
 *              HAL_ASSERT_SPINLOCK under the matching case.
 *
 *              An application developer is encouraged to extend this function
 *              for use by their own application.  To do this, add hal_assert.c
 *              to your project workspace, the path to hal_assert.h (this can
 *              be found on the stack side). Asserts are raised by including
 *              hal_assert.h and using macro HAL_ASSERT(cause) to raise an
 *              assert with argument assertCause.  the assertSubcause may be
 *              optionally set by macro HAL_ASSERT_SET_SUBCAUSE(subCause) prior
 *              to asserting the cause it describes. More information is
 *              available in hal_assert.h.
 *
 * input parameters
 *
 * @param       assertCause    - Assert cause as defined in hal_assert.h.
 * @param       assertSubcause - Optional assert subcause (see hal_assert.h).
 *
 * output parameters
 *
 * @param       None.
 *
 * @return      None.
 */
void AssertHandler(uint8 assertCause, uint8 assertSubcause)
{
    HAL_ASSERT_SPINLOCK;
}


/*******************************************************************************
 * @fn          smallErrorHook
 *
 * @brief       Error handler to be hooked into TI-RTOS.
 *
 * input parameters
 *
 * @param       eb - Pointer to Error Block.
 *
 * output parameters
 *
 * @param       None.
 *
 * @return      None.
 */
void smallErrorHook(Error_Block *eb)
{
  for (;;);
}

/*******************************************************************************
 */

Here is the diff file for simple_peripheral.c (and the content of simple_peripheral.c at the end of the modification):

8741.simple_peripheral_removeDisplay.diff
--- C:\ti\simplelink_cc13x2_26x2_sdk_3_40_00_02\examples\rtos\CC26X2R1_LAUNCHXL\ble5stack\simple_peripheral\Application\simple_peripheral.c	Wed Dec 18 22:55:20 2019
+++ C:\ti\simplelink_cc13x2_26x2_sdk_3_40_00_02\examples\rtos\CC26X2R1_LAUNCHXL\ble5stack\simple_peripheral\Application\simple_peripheral_SIMPLE.c	Mon Feb 10 15:50:31 2020
@@ -55,8 +55,6 @@
 #include <ti/sysbios/knl/Event.h>
 #include <ti/sysbios/knl/Queue.h>
 
-#include <ti/display/Display.h>
-
 #if !(defined __TI_COMPILER_VERSION__)
 #include <intrinsics.h>
 #endif
@@ -77,11 +75,7 @@
 #endif //USE_RCOSC
 
 #include <ti_drivers_config.h>
-#include <board_key.h>
-
-#include <menu/two_btn_menu.h>
-
-#include "simple_peripheral_menu.h"
+
 #include "simple_peripheral.h"
 #include "ti_ble_config.h"
 
@@ -131,18 +125,6 @@
 
 // Size of string-converted device address ("0xXXXXXXXXXXXX")
 #define SP_ADDR_STR_SIZE     15
-
-// Row numbers for two-button menu
-#define SP_ROW_SEPARATOR_1   (TBM_ROW_APP + 0)
-#define SP_ROW_STATUS_1      (TBM_ROW_APP + 1)
-#define SP_ROW_STATUS_2      (TBM_ROW_APP + 2)
-#define SP_ROW_CONNECTION    (TBM_ROW_APP + 3)
-#define SP_ROW_ADVSTATE      (TBM_ROW_APP + 4)
-#define SP_ROW_RSSI          (TBM_ROW_APP + 5)
-#define SP_ROW_IDA           (TBM_ROW_APP + 6)
-#define SP_ROW_RPA           (TBM_ROW_APP + 7)
-#define SP_ROW_DEBUG         (TBM_ROW_APP + 8)
-#define SP_ROW_AC            (TBM_ROW_APP + 9)
 
 // For storing the active connections
 #define SP_RSSI_TRACK_CHNLS        1            // Max possible channels can be GAP_BONDINGS_MAX
@@ -244,9 +226,6 @@
 /*********************************************************************
  * GLOBAL VARIABLES
  */
-
-// Display Interface
-Display_Handle dispHandle = NULL;
 
 // Task configuration
 Task_Struct spTask;
@@ -337,8 +316,6 @@
 static void SimplePeripheral_processPasscode(spPasscodeData_t *pPasscodeData);
 static void SimplePeripheral_charValueChangeCB(uint8_t paramId);
 static status_t SimplePeripheral_enqueueMsg(uint8_t event, void *pData);
-static void SimplePeripheral_keyChangeHandler(uint8 keys);
-static void SimplePeripheral_handleKeys(uint8_t keys);
 static void SimplePeripheral_processCmdCompleteEvt(hciEvt_CmdComplete_t *pMsg);
 static void SimplePeripheral_initPHYRSSIArray(void);
 static void SimplePeripheral_updatePHYStat(uint16_t eventCode, uint8_t *pMsg);
@@ -352,8 +329,6 @@
                                         uint8_t txPhy, uint8_t rxPhy,
                                         uint16_t phyOpts);
 static uint8_t SimplePeripheral_clearConnListEntry(uint16_t connHandle);
-static void SimplePeripheral_menuSwitchCb(tbmMenuObj_t* pMenuObjCurr,
-                                          tbmMenuObj_t* pMenuObjNext);
 static void SimplePeripheral_connEvtCB(Gap_ConnEventRpt_t *pReport);
 static void SimplePeripheral_processConnEvt(Gap_ConnEventRpt_t *pReport);
 #ifdef PTM_MODE
@@ -485,9 +460,6 @@
  */
 static void SimplePeripheral_init(void)
 {
-  // Create the menu
-  SimplePeripheral_buildMenu();
-
   // ******************************************************************
   // N0 STACK API CALLS CAN OCCUR BEFORE THIS CALL TO ICall_registerApp
   // ******************************************************************
@@ -586,9 +558,6 @@
   // Initialize GATT Client
   GATT_InitClient();
 
-  // Init key debouncer
-  Board_initKeys(SimplePeripheral_keyChangeHandler);
-
   // Initialize Connection List
   SimplePeripheral_clearConnListEntry(LINKDB_CONNHANDLE_ALL);
 
@@ -597,17 +566,6 @@
 
   // Initialize array to store connection handle and RSSI values
   SimplePeripheral_initPHYRSSIArray();
-
-  // The type of display is configured based on the BOARD_DISPLAY_USE...
-  // preprocessor definitions
-  dispHandle = Display_open(Display_Type_ANY, NULL);
-
-  // Initialize Two-Button Menu module
-  TBM_SET_TITLE(&spMenuMain, "Simple Peripheral");
-  tbm_setItemStatus(&spMenuMain, TBM_ITEM_NONE, TBM_ITEM_ALL);
-
-  tbm_initTwoBtnMenu(dispHandle, &spMenuMain, 5, SimplePeripheral_menuSwitchCb);
-  Display_printf(dispHandle, SP_ROW_SEPARATOR_1, 0, "====================");
 
 #ifdef PTM_MODE
   // Intercept NPI RX events.
@@ -746,18 +704,6 @@
           {
             case HCI_LE_SET_PHY:
             {
-              if (pMyMsg->cmdStatus == HCI_ERROR_CODE_UNSUPPORTED_REMOTE_FEATURE)
-              {
-                Display_printf(dispHandle, SP_ROW_STATUS_1, 0,
-                        "PHY Change failure, peer does not support this");
-              }
-              else
-              {
-                Display_printf(dispHandle, SP_ROW_STATUS_1, 0,
-                               "PHY Update Status Event: 0x%x",
-                               pMyMsg->cmdStatus);
-              }
-
               SimplePeripheral_updatePHYStat(HCI_LE_SET_PHY, (uint8_t *)pMsg);
               break;
             }
@@ -777,22 +723,6 @@
           // A Phy Update Has Completed or Failed
           if (pPUC->BLEEventCode == HCI_BLE_PHY_UPDATE_COMPLETE_EVENT)
           {
-            if (pPUC->status != SUCCESS)
-            {
-              Display_printf(dispHandle, SP_ROW_STATUS_1, 0,
-                             "PHY Change failure");
-            }
-            else
-            {
-              // Only symmetrical PHY is supported.
-              // rxPhy should be equal to txPhy.
-              Display_printf(dispHandle, SP_ROW_STATUS_2, 0,
-                             "PHY Updated to %s",
-                             (pPUC->rxPhy == PHY_UPDATE_COMPLETE_EVENT_1M) ? "1M" :
-                             (pPUC->rxPhy == PHY_UPDATE_COMPLETE_EVENT_2M) ? "2M" :
-                             (pPUC->rxPhy == PHY_UPDATE_COMPLETE_EVENT_CODED) ? "CODED" : "Unexpected PHY Value");
-            }
-
             SimplePeripheral_updatePHYStat(HCI_BLE_PHY_UPDATE_COMPLETE_EVENT, (uint8_t *)pMsg);
           }
           break;
@@ -861,21 +791,6 @@
  */
 static uint8_t SimplePeripheral_processGATTMsg(gattMsgEvent_t *pMsg)
 {
-  if (pMsg->method == ATT_FLOW_CTRL_VIOLATED_EVENT)
-  {
-    // ATT request-response or indication-confirmation flow control is
-    // violated. All subsequent ATT requests or indications will be dropped.
-    // The app is informed in case it wants to drop the connection.
-
-    // Display the opcode of the message that caused the violation.
-    Display_printf(dispHandle, SP_ROW_STATUS_1, 0, "FC Violated: %d", pMsg->msg.flowCtrlEvt.opcode);
-  }
-  else if (pMsg->method == ATT_MTU_UPDATED_EVENT)
-  {
-    // MTU size updated
-    Display_printf(dispHandle, SP_ROW_STATUS_1, 0, "MTU Size: %d", pMsg->msg.mtuEvt.MTU);
-  }
-
   // Free message payload. Needed only for ATT Protocol messages
   GATT_bm_free(&pMsg->msg, pMsg->method);
 
@@ -903,7 +818,6 @@
       break;
 
     case SP_KEY_CHANGE_EVT:
-      SimplePeripheral_handleKeys(*(uint8_t*)(pMsg->pData));
       break;
 
     case SP_ADV_EVT:
@@ -992,8 +906,6 @@
 
         // Set Device Info Service Parameter
         DevInfo_SetParameter(DEVINFO_SYSTEM_ID, DEVINFO_SYSTEM_ID_LEN, systemId);
-
-        Display_printf(dispHandle, SP_ROW_STATUS_1, 0, "Initialized");
 
         // Setup and start Advertising
         // For more information, see the GAP section in the User's Guide:
@@ -1044,11 +956,6 @@
         status = GapAdv_enable(advHandleLongRange, GAP_ADV_ENABLE_OPTIONS_USE_MAX , 0);
         SIMPLEPERIPHERAL_ASSERT(status == SUCCESS);
 
-        // Display device address
-        Display_printf(dispHandle, SP_ROW_IDA, 0, "%s Addr: %s",
-                       (addrMode <= ADDRMODE_RANDOM) ? "Dev" : "ID",
-                       Util_convertBdAddr2Str(pPkt->devAddr));
-
         if (addrMode > ADDRMODE_RANDOM)
         {
           SimplePeripheral_updateRPA();
@@ -1058,7 +965,6 @@
                               READ_RPA_PERIOD, 0, true,
                               (UArg) &argRpaRead);
         }
-        tbm_setItemStatus(&spMenuMain, SP_ITEM_AUTOCONNECT, TBM_ITEM_NONE);
       }
 
       break;
@@ -1068,22 +974,12 @@
     {
       gapEstLinkReqEvent_t *pPkt = (gapEstLinkReqEvent_t *)pMsg;
 
-      // Display the amount of current connections
       uint8_t numActive = linkDB_NumActive();
-      Display_printf(dispHandle, SP_ROW_STATUS_2, 0, "Num Conns: %d",
-                     (uint16_t)numActive);
 
       if (pPkt->hdr.status == SUCCESS)
       {
         // Add connection to list and start RSSI
         SimplePeripheral_addConn(pPkt->connectionHandle);
-
-        // Display the address of this connection
-        Display_printf(dispHandle, SP_ROW_STATUS_1, 0, "Connected to %s",
-                       Util_convertBdAddr2Str(pPkt->devAddr));
-
-        // Enable connection selection option
-        tbm_setItemStatus(&spMenuMain, SP_ITEM_SELECT_CONN,SP_ITEM_AUTOCONNECT);
 
         // Start Periodic Clock.
         Util_startClock(&clkPeriodic);
@@ -1107,11 +1003,7 @@
     {
       gapTerminateLinkEvent_t *pPkt = (gapTerminateLinkEvent_t *)pMsg;
 
-      // Display the amount of current connections
       uint8_t numActive = linkDB_NumActive();
-      Display_printf(dispHandle, SP_ROW_STATUS_1, 0, "Device Disconnected!");
-      Display_printf(dispHandle, SP_ROW_STATUS_2, 0, "Num Conns: %d",
-                     (uint16_t)numActive);
 
       // Remove the connection from the list and disable RSSI if needed
       SimplePeripheral_removeConn(pPkt->connectionHandle);
@@ -1121,18 +1013,11 @@
       {
         // Stop periodic clock
         Util_stopClock(&clkPeriodic);
-
-        // Disable Connection Selection option
-        tbm_setItemStatus(&spMenuMain, SP_ITEM_AUTOCONNECT, SP_ITEM_SELECT_CONN);
       }
 
       // Start advertising since there is room for more connections
       GapAdv_enable(advHandleLegacy, GAP_ADV_ENABLE_OPTIONS_USE_MAX , 0);
       GapAdv_enable(advHandleLongRange, GAP_ADV_ENABLE_OPTIONS_USE_MAX , 0);
-
-      // Clear remaining lines
-      Display_clearLine(dispHandle, SP_ROW_CONNECTION);
-
       break;
     }
 
@@ -1174,20 +1059,6 @@
       linkDBInfo_t linkInfo;
       linkDB_GetInfo(pPkt->connectionHandle, &linkInfo);
 
-      if(pPkt->status == SUCCESS)
-      {
-        // Display the address of the connection update
-        Display_printf(dispHandle, SP_ROW_STATUS_2, 0, "Link Param Updated: %s",
-                       Util_convertBdAddr2Str(linkInfo.addr));
-      }
-      else
-      {
-        // Display the address of the connection update failure
-        Display_printf(dispHandle, SP_ROW_STATUS_2, 0,
-                       "Link Param Update Failed 0x%x: %s", pPkt->opcode,
-                       Util_convertBdAddr2Str(linkInfo.addr));
-      }
-
       // Check if there are any queued parameter updates
       spConnHandleEntry_t *connHandleEntry = (spConnHandleEntry_t *)List_get(&paramUpdateList);
       if (connHandleEntry != NULL)
@@ -1203,7 +1074,6 @@
     }
 
     default:
-      Display_clearLines(dispHandle, SP_ROW_STATUS_1, SP_ROW_STATUS_2);
       break;
   }
 }
@@ -1249,14 +1119,10 @@
   {
     case SIMPLEPROFILE_CHAR1:
       SimpleProfile_GetParameter(SIMPLEPROFILE_CHAR1, &newValue);
-
-      Display_printf(dispHandle, SP_ROW_STATUS_1, 0, "Char 1: %d", (uint16_t)newValue);
       break;
 
     case SIMPLEPROFILE_CHAR3:
       SimpleProfile_GetParameter(SIMPLEPROFILE_CHAR3, &newValue);
-
-      Display_printf(dispHandle, SP_ROW_STATUS_1, 0, "Char 3: %d", (uint16_t)newValue);
       break;
 
     default:
@@ -1297,7 +1163,7 @@
 /*********************************************************************
  * @fn      SimplePeripheral_updateRPA
  *
- * @brief   Read the current RPA from the stack and update display
+ * @brief   Read the current RPA from the stack
  *          if the RPA has changed.
  *
  * @param   None.
@@ -1314,8 +1180,6 @@
   if (memcmp(pRpaNew, rpa, B_ADDR_LEN))
   {
     // If the RPA has changed, update the display
-    Display_printf(dispHandle, SP_ROW_RPA, 0, "RP Addr: %s",
-                   Util_convertBdAddr2Str(pRpaNew));
     memcpy(rpa, pRpaNew, B_ADDR_LEN);
   }
 }
@@ -1357,59 +1221,6 @@
 }
 
 /*********************************************************************
- * @fn      SimplePeripheral_keyChangeHandler
- *
- * @brief   Key event handler function
- *
- * @param   keys - bitmap of pressed keys
- *
- * @return  none
- */
-static void SimplePeripheral_keyChangeHandler(uint8_t keys)
-{
-  uint8_t *pValue = ICall_malloc(sizeof(uint8_t));
-
-  if (pValue)
-  {
-    *pValue = keys;
-
-    if(SimplePeripheral_enqueueMsg(SP_KEY_CHANGE_EVT, pValue) != SUCCESS)
-    {
-      ICall_free(pValue);
-    }
-  }
-}
-
-/*********************************************************************
- * @fn      SimplePeripheral_handleKeys
- *
- * @brief   Handles all key events for this device.
- *
- * @param   keys - bit field for key events. Valid entries:
- *                 KEY_LEFT
- *                 KEY_RIGHT
- */
-static void SimplePeripheral_handleKeys(uint8_t keys)
-{
-  if (keys & KEY_LEFT)
-  {
-    // Check if the key is still pressed. Workaround for possible bouncing.
-    if (PIN_getInputValue(CONFIG_PIN_BTN1) == 0)
-    {
-      tbm_buttonLeft();
-    }
-  }
-  else if (keys & KEY_RIGHT)
-  {
-    // Check if the key is still pressed. Workaround for possible bouncing.
-    if (PIN_getInputValue(CONFIG_PIN_BTN2) == 0)
-    {
-      tbm_buttonRight();
-    }
-  }
-}
-
-/*********************************************************************
  * @fn      SimplePeripheral_doSetConnPhy
  *
  * @brief   Set PHY preference.
@@ -1435,7 +1246,6 @@
   uint8_t connIndex = SimplePeripheral_getConnIndex(menuConnHandle);
   if (connIndex >= MAX_NUM_BLE_CONNS)
   {
-    Display_printf(dispHandle, SP_ROW_STATUS_1, 0, "Connection handle is not in the connList !!!");
     return FALSE;
   }
 
@@ -1450,9 +1260,6 @@
     SimplePeripheral_stopAutoPhyChange(connList[connIndex].connHandle);
 
     SimplePeripheral_setPhy(menuConnHandle, 0, phy[index], phy[index], 0);
-
-    Display_printf(dispHandle, SP_ROW_STATUS_1, 0, "PHY preference: %s",
-                   TBM_GET_ACTION_DESC(&spMenuConnPhy, index));
   }
   else
   {
@@ -1497,13 +1304,9 @@
   switch (pEventData->event)
   {
     case GAP_EVT_ADV_START_AFTER_ENABLE:
-      Display_printf(dispHandle, SP_ROW_ADVSTATE, 0, "Adv Set %d Enabled",
-                     *(uint8_t *)(pEventData->pBuf));
       break;
 
     case GAP_EVT_ADV_END_AFTER_DISABLE:
-      Display_printf(dispHandle, SP_ROW_ADVSTATE, 0, "Adv Set %d Disabled",
-                     *(uint8_t *)(pEventData->pBuf));
       break;
 
     case GAP_EVT_ADV_START:
@@ -1513,14 +1316,6 @@
       break;
 
     case GAP_EVT_ADV_SET_TERMINATED:
-    {
-#ifndef Display_DISABLE_ALL
-      GapAdv_setTerm_t *advSetTerm = (GapAdv_setTerm_t *)(pEventData->pBuf);
-
-      Display_printf(dispHandle, SP_ROW_ADVSTATE, 0, "Adv Set %d disabled after conn %d",
-                     advSetTerm->handle, advSetTerm->connHandle );
-#endif
-    }
     break;
 
     case GAP_EVT_SCAN_REQ_RECEIVED:
@@ -1611,45 +1406,19 @@
 static void SimplePeripheral_processPairState(spPairStateData_t *pPairData)
 {
   uint8_t state = pPairData->state;
-  uint8_t status = pPairData->status;
 
   switch (state)
   {
     case GAPBOND_PAIRING_STATE_STARTED:
-      Display_printf(dispHandle, SP_ROW_CONNECTION, 0, "Pairing started");
       break;
 
     case GAPBOND_PAIRING_STATE_COMPLETE:
-      if (status == SUCCESS)
-      {
-        Display_printf(dispHandle, SP_ROW_CONNECTION, 0, "Pairing success");
-      }
-      else
-      {
-        Display_printf(dispHandle, SP_ROW_CONNECTION, 0, "Pairing fail: %d", status);
-      }
       break;
 
     case GAPBOND_PAIRING_STATE_ENCRYPTED:
-      if (status == SUCCESS)
-      {
-        Display_printf(dispHandle, SP_ROW_CONNECTION, 0, "Encryption success");
-      }
-      else
-      {
-        Display_printf(dispHandle, SP_ROW_CONNECTION, 0, "Encryption failed: %d", status);
-      }
       break;
 
     case GAPBOND_PAIRING_STATE_BOND_SAVED:
-      if (status == SUCCESS)
-      {
-        Display_printf(dispHandle, SP_ROW_CONNECTION, 0, "Bond save success");
-      }
-      else
-      {
-        Display_printf(dispHandle, SP_ROW_CONNECTION, 0, "Bond save failed: %d", status);
-      }
       break;
 
     default:
@@ -1666,13 +1435,6 @@
  */
 static void SimplePeripheral_processPasscode(spPasscodeData_t *pPasscodeData)
 {
-  // Display passcode to user
-  if (pPasscodeData->uiOutputs != 0)
-  {
-    Display_printf(dispHandle, SP_ROW_CONNECTION, 0, "Passcode: %d",
-                   B_APP_DEFAULT_PASSCODE);
-  }
-
   // Send passcode response
   GAPBondMgr_PasscodeRsp(pPasscodeData->connHandle , SUCCESS,
                          B_APP_DEFAULT_PASSCODE);
@@ -1706,12 +1468,6 @@
   // Get index from handle
   uint8_t connIndex = SimplePeripheral_getConnIndex(pReport->handle);
 
-  if (connIndex >= MAX_NUM_BLE_CONNS)
-  {
-    Display_printf(dispHandle, SP_ROW_STATUS_1, 0, "Connection handle is not in the connList !!!");
-    return;
-  }
-
   // If auto phy change is enabled
   if (connList[connIndex].isAutoPHYEnable == TRUE)
   {
@@ -1748,29 +1504,6 @@
   return(bleMemAllocError);
 }
 
-/*********************************************************************
- * @fn      SimplePeripheral_doSelectConn
- *
- * @brief   Select a connection to communicate with
- *
- * @param   index - item index from the menu
- *
- * @return  always true
- */
-bool SimplePeripheral_doSelectConn(uint8_t index)
-{
-  menuConnHandle = connList[index].connHandle;
-
-  // Set the menu title and go to this connection's context
-  TBM_SET_TITLE(&spMenuPerConn, TBM_GET_ACTION_DESC(&spMenuSelectConn, index));
-
-  // Clear non-connection-related message
-  Display_clearLine(dispHandle, SP_ROW_CONNECTION);
-
-  tbm_goTo(&spMenuPerConn);
-
-  return (true);
-}
 /*********************************************************************
  * @fn      SimplePeripheral_doAutoConnect
  *
@@ -1798,7 +1531,6 @@
         GapAdv_enable(advHandleLongRange, GAP_ADV_ENABLE_OPTIONS_USE_MAX , 0);
         autoConnect = AUTOCONNECT_GROUP_A;
       }	
-	  Display_printf(dispHandle, SP_ROW_AC, 0, "AutoConnect enabled: Group A");
     }
     else if (index == 2)
     {
@@ -1814,7 +1546,6 @@
         GapAdv_enable(advHandleLongRange, GAP_ADV_ENABLE_OPTIONS_USE_MAX , 0);
         autoConnect = AUTOCONNECT_GROUP_B;
       } 
-      Display_printf(dispHandle, SP_ROW_AC, 0, "AutoConnect enabled: Group B");
     }
     else
     {
@@ -1830,9 +1561,7 @@
         GapAdv_enable(advHandleLongRange, GAP_ADV_ENABLE_OPTIONS_USE_MAX , 0);
         autoConnect = AUTOCONNECT_DISABLE;
       } 
-      Display_printf(dispHandle, SP_ROW_AC, 0, "AutoConnect disabled");
-    }
-    tbm_goTo(&spMenuMain);
+    }
     
     return (true);
 }
@@ -2052,7 +1781,6 @@
   connIndex = SimplePeripheral_getConnIndex(connHandle);
   if (connIndex >= MAX_NUM_BLE_CONNS)
   {
-    Display_printf(dispHandle, SP_ROW_STATUS_1, 0, "Connection handle is not in the connList !!!");
     return;
   }
 
@@ -2112,7 +1840,6 @@
         uint8_t index = SimplePeripheral_getConnIndex(handle);
         if (index >= MAX_NUM_BLE_CONNS)
         {
-          Display_printf(dispHandle, SP_ROW_STATUS_1, 0, "Connection handle is not in the connList !!!");
           return;
         }
 
@@ -2200,11 +1927,6 @@
           } // end of if (connList[index].phyCngRq == FALSE)
         } // end of if (rssi != LL_RSSI_NOT_AVAILABLE)
 
-        Display_printf(dispHandle, SP_ROW_RSSI, 0,
-                       "RSSI:%d dBm, AVG RSSI:%d dBm",
-                       (uint32_t)(rssi),
-                       connList[index].rssiAvg);
-
 	  } // end of if (status == SUCCESS)
       break;
     }
@@ -2212,10 +1934,6 @@
     case HCI_LE_READ_PHY:
     {
       if (status == SUCCESS)
-      {
-        Display_printf(dispHandle, SP_ROW_RSSI + 2, 0, "RXPh: %d, TXPh: %d",
-                       pMsg->pReturnParam[3], pMsg->pReturnParam[4]);
-      }
       break;
     }
 
@@ -2418,78 +2136,4 @@
 }
 
 /*********************************************************************
- * @fn      SimplePeripheral_menuSwitchCb
- *
- * @brief   Detect menu context switching
- *
- * @param   pMenuObjCurr - the current menu object
- * @param   pMenuObjNext - the menu object the context is about to switch to
- *
- * @return  none
- */
-static void SimplePeripheral_menuSwitchCb(tbmMenuObj_t* pMenuObjCurr,
-                                       tbmMenuObj_t* pMenuObjNext)
-{
-  uint8_t NUMB_ACTIVE_CONNS = linkDB_NumActive();
-
-  // interested in only the events of
-  // entering scMenuConnect, spMenuSelectConn, and scMenuMain for now
-  if (pMenuObjNext == &spMenuSelectConn)
-  {
-    static uint8_t* pAddrs;
-    uint8_t* pAddrTemp;
-
-    if (pAddrs != NULL)
-    {
-      ICall_free(pAddrs);
-    }
-
-    // Allocate buffer to display addresses
-    pAddrs = ICall_malloc(NUMB_ACTIVE_CONNS * SP_ADDR_STR_SIZE);
-
-    if (pAddrs == NULL)
-    {
-      TBM_SET_NUM_ITEM(&spMenuSelectConn, 0);
-    }
-    else
-    {
-      uint8_t i;
-
-      TBM_SET_NUM_ITEM(&spMenuSelectConn, MAX_NUM_BLE_CONNS);
-
-      pAddrTemp = pAddrs;
-
-      // Add active connection info to the menu object
-      for (i = 0; i < MAX_NUM_BLE_CONNS; i++)
-      {
-        if (connList[i].connHandle != LINKDB_CONNHANDLE_INVALID)
-        {
-          // Get the address from the connection handle
-          linkDBInfo_t linkInfo;
-          linkDB_GetInfo(connList[i].connHandle, &linkInfo);
-          // This connection is active. Set the corresponding menu item with
-          // the address of this connection and enable the item.
-          memcpy(pAddrTemp, Util_convertBdAddr2Str(linkInfo.addr),
-                 SP_ADDR_STR_SIZE);
-          TBM_SET_ACTION_DESC(&spMenuSelectConn, i, pAddrTemp);
-          tbm_setItemStatus(&spMenuSelectConn, (1 << i), SP_ITEM_NONE);
-          pAddrTemp += SP_ADDR_STR_SIZE;
-        }
-        else
-        {
-          // This connection is not active. Disable the corresponding menu item.
-          tbm_setItemStatus(&spMenuSelectConn, SP_ITEM_NONE, (1 << i));
-        }
-      }
-    }
-  }
-  else if (pMenuObjNext == &spMenuMain)
-  {
-    // Now we are not in a specific connection's context
-
-    // Clear connection-related message
-    Display_clearLine(dispHandle, SP_ROW_CONNECTION);
-  }
-}
-/*********************************************************************
 *********************************************************************/

0728.simple_peripheral.c

Here is the diff file for simple_peripheral.h (and the content of simple_peripheral.h at the end of the modification):

2376.simple_peripheral_h_removeDisplay.diff
--- C:\ti\simplelink_cc13x2_26x2_sdk_3_40_00_02\examples\rtos\CC26X2R1_LAUNCHXL\ble5stack\simple_peripheral\Application\simple_peripheral.h	Wed Dec 18 22:55:20 2019
+++ C:\ti\simplelink_cc13x2_26x2_sdk_3_40_00_02\examples\rtos\CC26X2R1_LAUNCHXL\ble5stack\simple_peripheral\Application\simple_peripheral_SIMPLE.h	Mon Feb 10 15:38:58 2020
@@ -56,7 +56,6 @@
 /*********************************************************************
  * INCLUDES
  */
-#include <menu/two_btn_menu.h>
 
 /*********************************************************************
 *  EXTERNAL VARIABLES
@@ -79,18 +78,6 @@
  */
 extern void SimplePeripheral_createTask(void);
 
-/*
- * Functions for menu action
- */
-/* Actions for Menu: Choose connection to work with */
-bool SimplePeripheral_doSelectConn(uint8 index);
-
-/* Action for Menu: AutoConnect */
-bool SimplePeripheral_doAutoConnect(uint8_t index);
-
-/* Actions for Menu: Set PHY - Select */
-bool SimplePeripheral_doSetConnPhy(uint8 index);
-
 /*********************************************************************
 *********************************************************************/
 

3000.simple_peripheral.h

4. The following files can be removed(facultative) from the Application folder: board_key.c, board_key.h, simple_peripheral_menu.c, simple_peripheral_menu.h, two_btn_menu.c, two_btn_menu.h

5. Test the example: it should still compile and work smoothly