Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
build
output
.vscode
2 changes: 1 addition & 1 deletion examples/apps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ if(OT_APP_CLI)
add_subdirectory(cli)
endif()

add_subdirectory(ncp)
#add_subdirectory(ncp)
111 changes: 105 additions & 6 deletions examples/apps/cli/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,112 @@
set(COMMON_INCLUDES
${OT_PUBLIC_INCLUDES}
${TI_PUBLIC_INCLUDES}
${PROJECT_SOURCE_DIR}/src
${PROJECT_SOURCE_DIR}/openthread/examples/platforms
${PROJECT_SOURCE_DIR}/openthread/src/core

# JJM include paths for ICall module
${TI_SIMPLELINK_SDK_DIR}/source/ti/drivers/dpl
${TI_SIMPLELINK_SDK_DIR}/source
${TI_SIMPLELINK_SDK_DIR}/source/ti
${TI_SIMPLELINK_SDK_DIR}/source/ti/ble5stack_flash
${TI_SIMPLELINK_SDK_DIR}/source/ti/ble5stack_flash/controller/cc26xx/inc
${TI_SIMPLELINK_SDK_DIR}/source/ti/ble5stack_flash/inc
${TI_SIMPLELINK_SDK_DIR}/source/ti/ble5stack_flash/rom
${TI_SIMPLELINK_SDK_DIR}/source/ti/common/cc26xx
${TI_SIMPLELINK_SDK_DIR}/source/ti/ble5stack_flash/icall/inc
${TI_SIMPLELINK_SDK_DIR}/source/ti/ble5stack_flash/hal/src/target/_common
${TI_SIMPLELINK_SDK_DIR}/source/ti/ble5stack_flash/common/cc26xx/npi/stack/
${TI_SIMPLELINK_SDK_DIR}/source/ti/ble5stack_flash/hal/src/inc
${TI_SIMPLELINK_SDK_DIR}/source/ti/ble5stack_flash/heapmgr
${TI_SIMPLELINK_SDK_DIR}/source/ti/ble5stack_flash/profiles/dev_info
${TI_SIMPLELINK_SDK_DIR}/source/ti/ble5stack_flash/profiles/simple_profile
${TI_SIMPLELINK_SDK_DIR}/source/ti/ble5stack_flash/icall/src/inc
${TI_SIMPLELINK_SDK_DIR}/source/ti/ble5stack_flash/npi/src/
${TI_SIMPLELINK_SDK_DIR}/source/ti/ble5stack_flash/osal/src/inc
${TI_SIMPLELINK_SDK_DIR}/source/ti/ble5stack_flash/services/src/saddr
${TI_SIMPLELINK_SDK_DIR}/source/ti/ble5stack_flash/services/src/sdata
${TI_SIMPLELINK_SDK_DIR}/source/ti/common/nv
${TI_SIMPLELINK_SDK_DIR}/source/ti/ble5stack_flash/common/cc26xx
${TI_SIMPLELINK_SDK_DIR}/source/ti/ble5stack_flash/icall/src
${TI_SIMPLELINK_SDK_DIR}/kernel/tirtos7/packages
${TI_SIMPLELINK_SDK_DIR}/source/ti/devices/cc13x4_cc26x4
${TI_SIMPLELINK_SDK_DIR}/source/ti/posix/gcc

${TI_SIMPLELINK_SDK_DIR}/kernel/freertos
${TI_SIMPLELINK_SDK_DIR}/kernel

# Needed for bget.h
${TI_SIMPLELINK_SDK_DIR}/source/ti/ble5stack/common/cc26xx/freertos
)

set(COMMON_SOURCES
cli_uart.cpp
main.c
#bleAppTask.c
#bleStackMenu.c
app_main.c
app_data.c
app_pairing.c
app_peripheral.c
app_dev_info.c
app_simple_gatt.c
osal_icall_ble.c
${TI_SIMPLELINK_SDK_DIR}/source/ti/ble5stack/common/cc26xx/freertos/bget.c
${TI_SIMPLELINK_SDK_DIR}/source/ti/ble5stack/common/cc26xx/freertos/TI_heap_wrapper.c
#${TI_SIMPLELINK_SDK_DIR}/source/ti/dmm/apps/common/ble_remote_display/stack/osal_icall_ble.c
${TI_SIMPLELINK_SDK_DIR}/source/ti/ble5stack_flash/rom/agama_r1/rom_init.c
#${TI_SIMPLELINK_SDK_DIR}/source/ti/ble5stack_flash/common/cc26xx/util.c
#${TI_SIMPLELINK_SDK_DIR}/source/ti/ble5stack_flash/common/cc26xx/menu/two_btn_menu.c
#${TI_SIMPLELINK_SDK_DIR}/source/ti/display/Display.c
#${TI_SIMPLELINK_SDK_DIR}/source/ti/ble5stack_flash/common/cc26xx/board_key.c
${TI_SIMPLELINK_SDK_DIR}/kernel/nortos/dpl/SystemP_nortos.c
#${TI_SIMPLELINK_SDK_DIR}/source/ti/ble5stack/common/cc26xx/freertos/bget.c
)

set(USR_COMPILE_DEFINITIONS
"USE_DMM"
"SYSCFG"
"CC13X4"
"CC13XX"
"POWER_SAVING"
"TBM_ACTIVE_ITEMS_ONLY"
"STACK_LIBRARY"
"EXTENDED_STACK_SETTINGS=EXTENDED_STACK_SETTINGS_DEFAULT"
"NPI_USE_UART"
"ICALL_EVENTS"
"ICALL_JT"
"ICALL_LITE"
"ICALL_STACK0_ADDR"
"USE_ICALL"
"ICALL_MAX_NUM_ENTITIES=6"
"ICALL_MAX_NUM_TASKS=3"
"OSAL_CBTIMER_NUM_TASKS=1"
"ONE_BLE_LIB_SIZE_OPTIMIZATION"

# the following are from ti_build_config.opt
"HOST_CONFIG=PERIPHERAL_CFG"
"USE_AE"
"GAP_BOND_MGR"
"HCI_TL_NONE"
"FREERTOS"

# from basic_ble_LP_EM_CC1354P10_1_freertos_ticlang
"ICALL_NO_APP_EVENTS"
"UARTLOG_ENABLE"
"uartlog_FILE=0"
"DeviceFamily_CC13X4"
"FLASH_ONLY_BUILD"
"NVOCMP_NWSAMEITEM=1"
"EM_CC1354P10_1_LP"
"NVOCMP_POSIX_MUTEX"
)

set(APPEND CMAKE_C_FLAGS -std=c99)

target_compile_options(openthread-cc13xx_cc26xx
PUBLIC
-O0
)

if(TI_SIMPLELINK_KERNEL STREQUAL "freertos")
Expand All @@ -48,14 +147,14 @@ else()
message(FATAL_ERROR "Unsuported TI_SIMPLELINK_KERNEL: ${TI_SIMPLELINK_KERNEL}")
endif()

if(OT_FTD)
include(ftd.cmake)
endif()
#if(OT_FTD)
# include(ftd.cmake)
#endif()

if(OT_MTD)
include(mtd.cmake)
endif()

if(OT_RCP)
include(radio.cmake)
endif()
#if(OT_RCP)
# include(radio.cmake)
#endif()
6 changes: 6 additions & 0 deletions examples/apps/cli/Logger.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#pragma once
#include <openthread/platform/logging.h>

#if OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_APP
void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, ...);
#endif
139 changes: 139 additions & 0 deletions examples/apps/cli/app_data.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
/******************************************************************************

@file app_data.c

@brief This file contains the application data functionality

Group: WCS, BTS
Target Device: cc13xx_cc26xx

******************************************************************************

Copyright (c) 2022-2023, 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 <string.h>
#include <ti/bleapp/ble_app_util/inc/bleapputil_api.h>

//*****************************************************************************
//! Defines
//*****************************************************************************

//*****************************************************************************
//! Globals
//*****************************************************************************

static void GATT_EventHandler(uint32 event, BLEAppUtil_msgHdr_t *pMsgData);

// Events handlers struct, contains the handlers and event masks
// of the application data module
BLEAppUtil_EventHandler_t dataGATTHandler =
{
.handlerType = BLEAPPUTIL_GATT_TYPE,
.pEventHandler = GATT_EventHandler,
.eventMask = BLEAPPUTIL_ATT_FLOW_CTRL_VIOLATED_EVENT |
BLEAPPUTIL_ATT_MTU_UPDATED_EVENT
};

//*****************************************************************************
//! Functions
//*****************************************************************************

/*********************************************************************
* @fn GATT_EventHandler
*
* @brief The purpose of this function is to handle GATT events
* that rise from the GATT and were registered in
* @ref BLEAppUtil_RegisterGAPEvent
*
* @param event - message event.
* @param pMsgData - pointer to message data.
*
* @return none
*/
static void GATT_EventHandler(uint32 event, BLEAppUtil_msgHdr_t *pMsgData)
{
gattMsgEvent_t *gattMsg = ( gattMsgEvent_t * )pMsgData;
switch ( gattMsg->method )
{
case ATT_FLOW_CTRL_VIOLATED_EVENT:
{
Display_printf( dispHandle, dispIndex, 0,
"#%5d ATT_FLOW_CTRL_VIOLATED_EVENT",
dispIndex ); dispIndex++;
}
break;

case ATT_MTU_UPDATED_EVENT:
{
Display_printf( dispHandle, dispIndex, 0,
"#%5d ATT_MTU_UPDATED_EVENT",
dispIndex ); dispIndex++;
}
break;


default:
break;
}
}

/*********************************************************************
* @fn Data_start
*
* @brief This function is called after stack initialization,
* the purpose of this function is to initialize and
* register the specific events handlers of the data
* application module
*
* @return SUCCESS, errorInfo
*/
bStatus_t Data_start( void )
{
bStatus_t status = SUCCESS;

Display_printf( dispHandle, dispIndex, 0,
"#%5d Data_start: Register Handlers",
dispIndex ); dispIndex++;

// Register the handlers
status = BLEAppUtil_registerEventHandler( &dataGATTHandler );

// Return status value
return( status );
}
Loading