Skip to content

Instantly share code, notes, and snippets.

@cfriedt
Created January 1, 2020 03:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cfriedt/34b4b67e9593c91d73bb21a82c68bce2 to your computer and use it in GitHub Desktop.
Save cfriedt/34b4b67e9593c91d73bb21a82c68bce2 to your computer and use it in GitHub Desktop.
rfBleConnect SimpleLink SDK-style example that runs on top of Zephyr
diff --git a/samples/rfBleConnect/CMakeLists.txt b/samples/rfBleConnect/CMakeLists.txt
new file mode 100644
index 0000000000..54b14914b5
--- /dev/null
+++ b/samples/rfBleConnect/CMakeLists.txt
@@ -0,0 +1,20 @@
+# SPDX-License-Identifier: Apache-2.0
+
+cmake_minimum_required(VERSION 3.13.1)
+
+include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
+project(rfPacketErrorRate)
+
+target_sources(app PRIVATE
+ src/RFQueue.c
+ src/config.c
+ src/main_nortos.c
+ src/menu_nortos.c
+ src/power.c
+ src/rfBleConnect_nortos.c
+ src/rx.c
+ src/smartrf_settings/smartrf_settings_ble.c
+ src/smartrf_settings/smartrf_settings_predefined.c
+ src/smartrf_settings/smartrf_settings.c
+ src/tx.c
+)
diff --git a/samples/rfBleConnect/prj.conf b/samples/rfBleConnect/prj.conf
new file mode 100644
index 0000000000..a67b6948b8
--- /dev/null
+++ b/samples/rfBleConnect/prj.conf
@@ -0,0 +1,25 @@
+CONFIG_BT_DEBUG_A2DP=y
+CONFIG_BT_DEBUG_ATT=y
+CONFIG_BT_DEBUG_AVDTP=y
+CONFIG_BT_DEBUG_CONN=y
+CONFIG_BT_DEBUG_GATT=y
+CONFIG_BT_DEBUG_HCI_CORE=y
+CONFIG_BT_DEBUG_HCI_DRIVER=y
+CONFIG_BT_DEBUG_HFP_HF=y
+CONFIG_BT_DEBUG_KEYS=y
+CONFIG_BT_DEBUG_L2CAP=y
+CONFIG_BT_DEBUG_LOG=y
+CONFIG_BT_DEBUG_RFCOMM=y
+CONFIG_BT_DEBUG_RPA=y
+CONFIG_BT_DEBUG_SDP=y
+CONFIG_BT_DEBUG_SERVICE=y
+CONFIG_BT_DEBUG_SETTINGS=y
+CONFIG_BT_DEBUG_SMP=y
+
+CONFIG_UART_CC13XX_CC26XX_0=y
+CONFIG_CONSOLE_SUBSYS=y
+CONFIG_SIMPLELINK_HOST_DRIVER=y
+CONFIG_HAS_CC13X2_CC26X2_SDK=y
+CONFIG_SOC_CC1352R=y
+
+CONFIG_NO_OPTIMIZATIONS=y
diff --git a/samples/rfBleConnect/src/Board.h b/samples/rfBleConnect/src/Board.h
new file mode 100644
index 0000000000..8ca78356c2
--- /dev/null
+++ b/samples/rfBleConnect/src/Board.h
@@ -0,0 +1,169 @@
+/*
+ * Copyright (c) 2017-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.
+ */
+
+#ifndef __BOARD_H
+#define __BOARD_H
+
+#define Board_CC1352R1_LAUNCHXL
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//#include <ti/drivers/Board.h>
+
+//#define Board_initGeneral() Board_init() /* deprecated */
+
+#include "CC1352R1_LAUNCHXL.h"
+
+#define Board_shutDownExtFlash() CC1352R1_LAUNCHXL_shutDownExtFlash()
+#define Board_wakeUpExtFlash() CC1352R1_LAUNCHXL_wakeUpExtFlash()
+
+/* These #defines allow us to reuse TI-RTOS across other device families */
+
+#define Board_ADC0 CC1352R1_LAUNCHXL_ADC0
+#define Board_ADC1 CC1352R1_LAUNCHXL_ADC1
+
+#define Board_ADCBUF0 CC1352R1_LAUNCHXL_ADCBUF0
+#define Board_ADCBUF0CHANNEL0 CC1352R1_LAUNCHXL_ADCBUF0CHANNEL0
+#define Board_ADCBUF0CHANNEL1 CC1352R1_LAUNCHXL_ADCBUF0CHANNEL1
+
+#define Board_ECDH0 CC1352R1_LAUNCHXL_ECDH0
+#define Board_ECDSA0 CC1352R1_LAUNCHXL_ECDSA0
+#define Board_ECJPAKE0 CC1352R1_LAUNCHXL_ECJPAKE0
+#define Board_AESCCM0 CC1352R1_LAUNCHXL_AESCCM0
+#define Board_AESGCM0 CC1352R1_LAUNCHXL_AESGCM0
+#define Board_AESCBC0 CC1352R1_LAUNCHXL_AESCBC0
+#define Board_AESCTR0 CC1352R1_LAUNCHXL_AESCTR0
+#define Board_AESECB0 CC1352R1_LAUNCHXL_AESECB0
+#define Board_AESCTRDRBG0 CC1352R1_LAUNCHXL_AESCTRDRBG0
+#define Board_SHA20 CC1352R1_LAUNCHXL_SHA20
+#define Board_TRNG0 CC1352R1_LAUNCHXL_TRNG0
+
+#define Board_DIO12 CC1352R1_LAUNCHXL_DIO12
+#define Board_DIO15 CC1352R1_LAUNCHXL_DIO15
+#define Board_DIO16_TDO CC1352R1_LAUNCHXL_DIO16_TDO
+#define Board_DIO17_TDI CC1352R1_LAUNCHXL_DIO17_TDI
+#define Board_DIO21 CC1352R1_LAUNCHXL_DIO21
+#define Board_DIO22 CC1352R1_LAUNCHXL_DIO22
+
+#define Board_DIO23_ANALOG CC1352R1_LAUNCHXL_DIO23_ANALOG
+#define Board_DIO24_ANALOG CC1352R1_LAUNCHXL_DIO24_ANALOG
+#define Board_DIO25_ANALOG CC1352R1_LAUNCHXL_DIO25_ANALOG
+#define Board_DIO26_ANALOG CC1352R1_LAUNCHXL_DIO26_ANALOG
+#define Board_DIO27_ANALOG CC1352R1_LAUNCHXL_DIO27_ANALOG
+#define Board_DIO28_ANALOG CC1352R1_LAUNCHXL_DIO28_ANALOG
+#define Board_DIO29_ANALOG CC1352R1_LAUNCHXL_DIO29_ANALOG
+
+/*
+ * Board_RF_SUB1GHZ is the name generated by SysConfig. Define it
+ * here so that RF callback function can reference it.
+ */
+#define Board_RF_SUB1GHZ CC1352R1_LAUNCHXL_DIO30_RF_SUB1GHZ
+
+#define Board_GPIO_BUTTON0 CC1352R1_LAUNCHXL_GPIO_S1
+#define Board_GPIO_BUTTON1 CC1352R1_LAUNCHXL_GPIO_S2
+#define Board_GPIO_BTN1 CC1352R1_LAUNCHXL_GPIO_S1
+#define Board_GPIO_BTN2 CC1352R1_LAUNCHXL_GPIO_S2
+#define Board_GPIO_LED0 CC1352R1_LAUNCHXL_GPIO_LED_RED
+#define Board_GPIO_LED1 CC1352R1_LAUNCHXL_GPIO_LED_GREEN
+#define Board_GPIO_LED2 CC1352R1_LAUNCHXL_GPIO_LED_RED
+#define Board_GPIO_RLED CC1352R1_LAUNCHXL_GPIO_LED_RED
+#define Board_GPIO_GLED CC1352R1_LAUNCHXL_GPIO_LED_GREEN
+#define Board_GPIO_LED_ON CC1352R1_LAUNCHXL_GPIO_LED_ON
+#define Board_GPIO_LED_OFF CC1352R1_LAUNCHXL_GPIO_LED_OFF
+#define Board_GPIO_TMP116_EN CC1352R1_LAUNCHXL_GPIO_TMP116_EN
+
+#define Board_GPTIMER0A CC1352R1_LAUNCHXL_GPTIMER0A
+#define Board_GPTIMER0B CC1352R1_LAUNCHXL_GPTIMER0B
+#define Board_GPTIMER1A CC1352R1_LAUNCHXL_GPTIMER1A
+#define Board_GPTIMER1B CC1352R1_LAUNCHXL_GPTIMER1B
+#define Board_GPTIMER2A CC1352R1_LAUNCHXL_GPTIMER2A
+#define Board_GPTIMER2B CC1352R1_LAUNCHXL_GPTIMER2B
+#define Board_GPTIMER3A CC1352R1_LAUNCHXL_GPTIMER3A
+#define Board_GPTIMER3B CC1352R1_LAUNCHXL_GPTIMER3B
+
+#define Board_I2C0 CC1352R1_LAUNCHXL_I2C0
+#define Board_I2C_TMP Board_I2C0
+
+#define Board_I2S0 CC1352R1_LAUNCHXL_I2S0
+#define Board_I2S_ADO CC1352R1_LAUNCHXL_I2S_ADO
+#define Board_I2S_ADI CC1352R1_LAUNCHXL_I2S_ADI
+#define Board_I2S_BCLK CC1352R1_LAUNCHXL_I2S_BCLK
+#define Board_I2S_MCLK CC1352R1_LAUNCHXL_I2S_MCLK
+#define Board_I2S_WCLK CC1352R1_LAUNCHXL_I2S_WCLK
+
+#define Board_NVSINTERNAL CC1352R1_LAUNCHXL_NVSCC26XX0
+#define Board_NVSEXTERNAL CC1352R1_LAUNCHXL_NVSSPI25X0
+
+#define Board_PIN_BUTTON0 CC1352R1_LAUNCHXL_PIN_BTN1
+#define Board_PIN_BUTTON1 CC1352R1_LAUNCHXL_PIN_BTN2
+#define Board_PIN_BTN1 CC1352R1_LAUNCHXL_PIN_BTN1
+#define Board_PIN_BTN2 CC1352R1_LAUNCHXL_PIN_BTN2
+#define Board_PIN_LED0 CC1352R1_LAUNCHXL_PIN_RLED
+#define Board_PIN_LED1 CC1352R1_LAUNCHXL_PIN_GLED
+#define Board_PIN_LED2 CC1352R1_LAUNCHXL_PIN_RLED
+#define Board_PIN_RLED CC1352R1_LAUNCHXL_PIN_RLED
+#define Board_PIN_GLED CC1352R1_LAUNCHXL_PIN_GLED
+
+#define Board_PWM0 CC1352R1_LAUNCHXL_PWM0
+#define Board_PWM1 CC1352R1_LAUNCHXL_PWM1
+#define Board_PWM2 CC1352R1_LAUNCHXL_PWM2
+#define Board_PWM3 CC1352R1_LAUNCHXL_PWM3
+#define Board_PWM4 CC1352R1_LAUNCHXL_PWM4
+#define Board_PWM5 CC1352R1_LAUNCHXL_PWM5
+#define Board_PWM6 CC1352R1_LAUNCHXL_PWM6
+#define Board_PWM7 CC1352R1_LAUNCHXL_PWM7
+
+#define Board_SD0 CC1352R1_LAUNCHXL_SDSPI0
+
+#define Board_SPI0 CC1352R1_LAUNCHXL_SPI0
+#define Board_SPI1 CC1352R1_LAUNCHXL_SPI1
+#define Board_SPI_FLASH_CS CC1352R1_LAUNCHXL_SPI_FLASH_CS
+#define Board_FLASH_CS_ON 0
+#define Board_FLASH_CS_OFF 1
+
+#define Board_SPI_MASTER CC1352R1_LAUNCHXL_SPI0
+#define Board_SPI_SLAVE CC1352R1_LAUNCHXL_SPI0
+#define Board_SPI_MASTER_READY CC1352R1_LAUNCHXL_SPI_MASTER_READY
+#define Board_SPI_SLAVE_READY CC1352R1_LAUNCHXL_SPI_SLAVE_READY
+
+#define Board_UART0 CC1352R1_LAUNCHXL_UART0
+#define Board_UART1 CC1352R1_LAUNCHXL_UART1
+
+#define Board_WATCHDOG0 CC1352R1_LAUNCHXL_WATCHDOG0
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __BOARD_H */
diff --git a/samples/rfBleConnect/src/CC1352R1_LAUNCHXL.c b/samples/rfBleConnect/src/CC1352R1_LAUNCHXL.c
new file mode 100644
index 0000000000..3b0e72ec3d
--- /dev/null
+++ b/samples/rfBleConnect/src/CC1352R1_LAUNCHXL.c
@@ -0,0 +1,1127 @@
+/*
+ * Copyright (c) 2017-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.
+ */
+
+/*
+ * ====================== CC1352R1_LAUNCHXL.c ===================================
+ * This file is responsible for setting up the board specific items for the
+ * CC1352R1_LAUNCHXL board.
+ */
+
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+
+#include <ti/devices/cc13x2_cc26x2/driverlib/ioc.h>
+#include <ti/devices/cc13x2_cc26x2/driverlib/udma.h>
+#include <ti/devices/cc13x2_cc26x2/inc/hw_ints.h>
+#include <ti/devices/cc13x2_cc26x2/inc/hw_memmap.h>
+
+#include "CC1352R1_LAUNCHXL.h"
+
+/*
+ * =============================== ADCBuf ===============================
+ */
+#include <ti/drivers/ADCBuf.h>
+#include <ti/drivers/adcbuf/ADCBufCC26X2.h>
+
+ADCBufCC26X2_Object adcBufCC26xxObjects[CC1352R1_LAUNCHXL_ADCBUFCOUNT];
+
+/*
+ * This table converts a virtual adc channel into a dio and internal analogue
+ * input signal. This table is necessary for the functioning of the adcBuf
+ * driver. Comment out unused entries to save flash. Dio and internal signal
+ * pairs are hardwired. Do not remap them in the table. You may reorder entire
+ * entries. The mapping of dio and internal signals is package dependent.
+ */
+const ADCBufCC26X2_AdcChannelLutEntry ADCBufCC26X2_adcChannelLut[CC1352R1_LAUNCHXL_ADCBUF0CHANNELCOUNT] = {
+ {CC1352R1_LAUNCHXL_DIO23_ANALOG, ADC_COMPB_IN_AUXIO7},
+ {CC1352R1_LAUNCHXL_DIO24_ANALOG, ADC_COMPB_IN_AUXIO6},
+ {CC1352R1_LAUNCHXL_DIO25_ANALOG, ADC_COMPB_IN_AUXIO5},
+ {CC1352R1_LAUNCHXL_DIO26_ANALOG, ADC_COMPB_IN_AUXIO4},
+ {CC1352R1_LAUNCHXL_DIO27_ANALOG, ADC_COMPB_IN_AUXIO3},
+ {CC1352R1_LAUNCHXL_DIO28_ANALOG, ADC_COMPB_IN_AUXIO2},
+ {CC1352R1_LAUNCHXL_DIO29_ANALOG, ADC_COMPB_IN_AUXIO1},
+ {PIN_UNASSIGNED, ADC_COMPB_IN_VDDS},
+ {PIN_UNASSIGNED, ADC_COMPB_IN_DCOUPL},
+ {PIN_UNASSIGNED, ADC_COMPB_IN_VSS},
+};
+
+const ADCBufCC26X2_HWAttrs adcBufCC26xxHWAttrs[CC1352R1_LAUNCHXL_ADCBUFCOUNT] = {
+ {
+ .intPriority = ~0,
+ .swiPriority = 0,
+ .adcChannelLut = ADCBufCC26X2_adcChannelLut,
+ .gpTimerUnit = CC1352R1_LAUNCHXL_GPTIMER0A,
+ }
+};
+
+const ADCBuf_Config ADCBuf_config[CC1352R1_LAUNCHXL_ADCBUFCOUNT] = {
+ {
+ &ADCBufCC26X2_fxnTable,
+ &adcBufCC26xxObjects[CC1352R1_LAUNCHXL_ADCBUF0],
+ &adcBufCC26xxHWAttrs[CC1352R1_LAUNCHXL_ADCBUF0]
+ },
+};
+
+const uint_least8_t ADCBuf_count = CC1352R1_LAUNCHXL_ADCBUFCOUNT;
+
+/*
+ * =============================== ADC ===============================
+ */
+#include <ti/drivers/ADC.h>
+#include <ti/drivers/adc/ADCCC26XX.h>
+
+ADCCC26XX_Object adcCC26xxObjects[CC1352R1_LAUNCHXL_ADCCOUNT];
+
+const ADCCC26XX_HWAttrs adcCC26xxHWAttrs[CC1352R1_LAUNCHXL_ADCCOUNT] = {
+ {
+ .adcDIO = CC1352R1_LAUNCHXL_DIO23_ANALOG,
+ .adcCompBInput = ADC_COMPB_IN_AUXIO7,
+ .refSource = ADCCC26XX_FIXED_REFERENCE,
+ .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
+ .inputScalingEnabled = true,
+ .triggerSource = ADCCC26XX_TRIGGER_MANUAL,
+ .returnAdjustedVal = false
+ },
+ {
+ .adcDIO = CC1352R1_LAUNCHXL_DIO24_ANALOG,
+ .adcCompBInput = ADC_COMPB_IN_AUXIO6,
+ .refSource = ADCCC26XX_FIXED_REFERENCE,
+ .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
+ .inputScalingEnabled = true,
+ .triggerSource = ADCCC26XX_TRIGGER_MANUAL,
+ .returnAdjustedVal = false
+ },
+ {
+ .adcDIO = CC1352R1_LAUNCHXL_DIO25_ANALOG,
+ .adcCompBInput = ADC_COMPB_IN_AUXIO5,
+ .refSource = ADCCC26XX_FIXED_REFERENCE,
+ .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
+ .inputScalingEnabled = true,
+ .triggerSource = ADCCC26XX_TRIGGER_MANUAL,
+ .returnAdjustedVal = false
+ },
+ {
+ .adcDIO = CC1352R1_LAUNCHXL_DIO26_ANALOG,
+ .adcCompBInput = ADC_COMPB_IN_AUXIO4,
+ .refSource = ADCCC26XX_FIXED_REFERENCE,
+ .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
+ .inputScalingEnabled = true,
+ .triggerSource = ADCCC26XX_TRIGGER_MANUAL,
+ .returnAdjustedVal = false
+ },
+ {
+ .adcDIO = CC1352R1_LAUNCHXL_DIO27_ANALOG,
+ .adcCompBInput = ADC_COMPB_IN_AUXIO3,
+ .refSource = ADCCC26XX_FIXED_REFERENCE,
+ .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
+ .inputScalingEnabled = true,
+ .triggerSource = ADCCC26XX_TRIGGER_MANUAL,
+ .returnAdjustedVal = false
+ },
+ {
+ .adcDIO = CC1352R1_LAUNCHXL_DIO28_ANALOG,
+ .adcCompBInput = ADC_COMPB_IN_AUXIO2,
+ .refSource = ADCCC26XX_FIXED_REFERENCE,
+ .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
+ .inputScalingEnabled = true,
+ .triggerSource = ADCCC26XX_TRIGGER_MANUAL,
+ .returnAdjustedVal = false
+ },
+ {
+ .adcDIO = CC1352R1_LAUNCHXL_DIO29_ANALOG,
+ .adcCompBInput = ADC_COMPB_IN_AUXIO1,
+ .refSource = ADCCC26XX_FIXED_REFERENCE,
+ .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
+ .inputScalingEnabled = true,
+ .triggerSource = ADCCC26XX_TRIGGER_MANUAL,
+ .returnAdjustedVal = false
+ },
+ {
+ .adcDIO = PIN_UNASSIGNED,
+ .adcCompBInput = ADC_COMPB_IN_DCOUPL,
+ .refSource = ADCCC26XX_FIXED_REFERENCE,
+ .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
+ .inputScalingEnabled = true,
+ .triggerSource = ADCCC26XX_TRIGGER_MANUAL,
+ .returnAdjustedVal = false
+ },
+ {
+ .adcDIO = PIN_UNASSIGNED,
+ .adcCompBInput = ADC_COMPB_IN_VSS,
+ .refSource = ADCCC26XX_FIXED_REFERENCE,
+ .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
+ .inputScalingEnabled = true,
+ .triggerSource = ADCCC26XX_TRIGGER_MANUAL,
+ .returnAdjustedVal = false
+ },
+ {
+ .adcDIO = PIN_UNASSIGNED,
+ .adcCompBInput = ADC_COMPB_IN_VDDS,
+ .refSource = ADCCC26XX_FIXED_REFERENCE,
+ .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
+ .inputScalingEnabled = true,
+ .triggerSource = ADCCC26XX_TRIGGER_MANUAL,
+ .returnAdjustedVal = false
+ }
+};
+
+const ADC_Config ADC_config[CC1352R1_LAUNCHXL_ADCCOUNT] = {
+ {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352R1_LAUNCHXL_ADC0], &adcCC26xxHWAttrs[CC1352R1_LAUNCHXL_ADC0]},
+ {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352R1_LAUNCHXL_ADC1], &adcCC26xxHWAttrs[CC1352R1_LAUNCHXL_ADC1]},
+ {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352R1_LAUNCHXL_ADC2], &adcCC26xxHWAttrs[CC1352R1_LAUNCHXL_ADC2]},
+ {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352R1_LAUNCHXL_ADC3], &adcCC26xxHWAttrs[CC1352R1_LAUNCHXL_ADC3]},
+ {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352R1_LAUNCHXL_ADC4], &adcCC26xxHWAttrs[CC1352R1_LAUNCHXL_ADC4]},
+ {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352R1_LAUNCHXL_ADC5], &adcCC26xxHWAttrs[CC1352R1_LAUNCHXL_ADC5]},
+ {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352R1_LAUNCHXL_ADC6], &adcCC26xxHWAttrs[CC1352R1_LAUNCHXL_ADC6]},
+ {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352R1_LAUNCHXL_ADCDCOUPL], &adcCC26xxHWAttrs[CC1352R1_LAUNCHXL_ADCDCOUPL]},
+ {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352R1_LAUNCHXL_ADCVSS], &adcCC26xxHWAttrs[CC1352R1_LAUNCHXL_ADCVSS]},
+ {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352R1_LAUNCHXL_ADCVDDS], &adcCC26xxHWAttrs[CC1352R1_LAUNCHXL_ADCVDDS]},
+};
+
+const uint_least8_t ADC_count = CC1352R1_LAUNCHXL_ADCCOUNT;
+
+/*
+ * =============================== ECDH ===============================
+ */
+#include <ti/drivers/ECDH.h>
+#include <ti/drivers/ecdh/ECDHCC26X2.h>
+
+ECDHCC26X2_Object ecdhCC26X2Objects[CC1352R1_LAUNCHXL_ECDHCOUNT];
+
+const ECDHCC26X2_HWAttrs ecdhCC26X2HWAttrs[CC1352R1_LAUNCHXL_ECDHCOUNT] = {
+ {
+ .intPriority = ~0,
+ }
+};
+
+const ECDH_Config ECDH_config[CC1352R1_LAUNCHXL_ECDHCOUNT] = {
+ {
+ .object = &ecdhCC26X2Objects[CC1352R1_LAUNCHXL_ECDH0],
+ .hwAttrs = &ecdhCC26X2HWAttrs[CC1352R1_LAUNCHXL_ECDH0]
+ },
+};
+
+const uint_least8_t ECDH_count = CC1352R1_LAUNCHXL_ECDHCOUNT;
+
+/*
+ * =============================== ECDSA ===============================
+ */
+#include <ti/drivers/ECDSA.h>
+#include <ti/drivers/ecdsa/ECDSACC26X2.h>
+
+ECDSACC26X2_Object ecdsaCC26X2Objects[CC1352R1_LAUNCHXL_ECDSACOUNT];
+
+const ECDSACC26X2_HWAttrs ecdsaCC26X2HWAttrs[CC1352R1_LAUNCHXL_ECDSACOUNT] = {
+ {
+ .intPriority = ~0,
+ }
+};
+
+const ECDSA_Config ECDSA_config[CC1352R1_LAUNCHXL_ECDSACOUNT] = {
+ {
+ .object = &ecdsaCC26X2Objects[CC1352R1_LAUNCHXL_ECDSA0],
+ .hwAttrs = &ecdsaCC26X2HWAttrs[CC1352R1_LAUNCHXL_ECDSA0]
+ },
+};
+
+const uint_least8_t ECDSA_count = CC1352R1_LAUNCHXL_ECDSACOUNT;
+
+/*
+ * =============================== ECJPAKE ===============================
+ */
+#include <ti/drivers/ECJPAKE.h>
+#include <ti/drivers/ecjpake/ECJPAKECC26X2.h>
+
+ECJPAKECC26X2_Object ecjpakeCC26X2Objects[CC1352R1_LAUNCHXL_ECJPAKECOUNT];
+
+const ECJPAKECC26X2_HWAttrs ecjpakeCC26X2HWAttrs[CC1352R1_LAUNCHXL_ECJPAKECOUNT] = {
+ {
+ .intPriority = ~0,
+ }
+};
+
+const ECJPAKE_Config ECJPAKE_config[CC1352R1_LAUNCHXL_ECJPAKECOUNT] = {
+ {
+ .object = &ecjpakeCC26X2Objects[CC1352R1_LAUNCHXL_ECJPAKE0],
+ .hwAttrs = &ecjpakeCC26X2HWAttrs[CC1352R1_LAUNCHXL_ECJPAKE0]
+ },
+};
+
+const uint_least8_t ECJPAKE_count = CC1352R1_LAUNCHXL_ECJPAKECOUNT;
+
+
+/*
+ * =============================== SHA2 ===============================
+ */
+#include <ti/drivers/SHA2.h>
+#include <ti/drivers/sha2/SHA2CC26X2.h>
+
+SHA2CC26X2_Object sha2CC26X2Objects[CC1352R1_LAUNCHXL_SHA2COUNT];
+
+const SHA2CC26X2_HWAttrs sha2CC26X2HWAttrs[CC1352R1_LAUNCHXL_SHA2COUNT] = {
+ {
+ .intPriority = ~0,
+ }
+};
+
+const SHA2_Config SHA2_config[CC1352R1_LAUNCHXL_SHA2COUNT] = {
+ {
+ .object = &sha2CC26X2Objects[CC1352R1_LAUNCHXL_SHA20],
+ .hwAttrs = &sha2CC26X2HWAttrs[CC1352R1_LAUNCHXL_SHA20]
+ },
+};
+
+const uint_least8_t SHA2_count = CC1352R1_LAUNCHXL_SHA2COUNT;
+
+/*
+ * =============================== AESCCM ===============================
+ */
+#include <ti/drivers/AESCCM.h>
+#include <ti/drivers/aesccm/AESCCMCC26XX.h>
+
+AESCCMCC26XX_Object aesccmCC26XXObjects[CC1352R1_LAUNCHXL_AESCCMCOUNT];
+
+const AESCCMCC26XX_HWAttrs aesccmCC26XXHWAttrs[CC1352R1_LAUNCHXL_AESCCMCOUNT] = {
+ {
+ .intPriority = ~0,
+ }
+};
+
+const AESCCM_Config AESCCM_config[CC1352R1_LAUNCHXL_AESCCMCOUNT] = {
+ {
+ .object = &aesccmCC26XXObjects[CC1352R1_LAUNCHXL_AESCCM0],
+ .hwAttrs = &aesccmCC26XXHWAttrs[CC1352R1_LAUNCHXL_AESCCM0]
+ },
+};
+
+const uint_least8_t AESCCM_count = CC1352R1_LAUNCHXL_AESCCMCOUNT;
+
+/*
+ * =============================== AESGCM ===============================
+ */
+#include <ti/drivers/AESGCM.h>
+#include <ti/drivers/aesgcm/AESGCMCC26XX.h>
+
+AESGCMCC26XX_Object aesgcmCC26XXObjects[CC1352R1_LAUNCHXL_AESGCMCOUNT];
+
+const AESGCMCC26XX_HWAttrs aesgcmCC26XXHWAttrs[CC1352R1_LAUNCHXL_AESGCMCOUNT] = {
+ {
+ .intPriority = ~0,
+ }
+};
+
+const AESGCM_Config AESGCM_config[CC1352R1_LAUNCHXL_AESGCMCOUNT] = {
+ {
+ .object = &aesgcmCC26XXObjects[CC1352R1_LAUNCHXL_AESGCM0],
+ .hwAttrs = &aesgcmCC26XXHWAttrs[CC1352R1_LAUNCHXL_AESGCM0]
+ },
+};
+
+const uint_least8_t AESGCM_count = CC1352R1_LAUNCHXL_AESGCMCOUNT;
+
+/*
+ * =============================== AESCBC ===============================
+ */
+#include <ti/drivers/AESCBC.h>
+#include <ti/drivers/aescbc/AESCBCCC26XX.h>
+
+AESCBCCC26XX_Object aescbcCC26XXObjects[CC1352R1_LAUNCHXL_AESCBCCOUNT];
+
+const AESCBCCC26XX_HWAttrs aescbcCC26XXHWAttrs[CC1352R1_LAUNCHXL_AESCBCCOUNT] = {
+ {
+ .intPriority = ~0,
+ }
+};
+
+const AESCBC_Config AESCBC_config[CC1352R1_LAUNCHXL_AESCBCCOUNT] = {
+ {
+ .object = &aescbcCC26XXObjects[CC1352R1_LAUNCHXL_AESCBC0],
+ .hwAttrs = &aescbcCC26XXHWAttrs[CC1352R1_LAUNCHXL_AESCBC0]
+ },
+};
+
+const uint_least8_t AESCBC_count = CC1352R1_LAUNCHXL_AESCBCCOUNT;
+
+/*
+ * =============================== AESCTR ===============================
+ */
+#include <ti/drivers/AESCTR.h>
+#include <ti/drivers/aesctr/AESCTRCC26XX.h>
+
+AESCTRCC26XX_Object aesctrCC26XXObjects[CC1352R1_LAUNCHXL_AESCTRCOUNT];
+
+const AESCTRCC26XX_HWAttrs aesctrCC26XXHWAttrs[CC1352R1_LAUNCHXL_AESCTRCOUNT] = {
+ {
+ .intPriority = ~0,
+ }
+};
+
+const AESCTR_Config AESCTR_config[CC1352R1_LAUNCHXL_AESCTRCOUNT] = {
+ {
+ .object = &aesctrCC26XXObjects[CC1352R1_LAUNCHXL_AESCTR0],
+ .hwAttrs = &aesctrCC26XXHWAttrs[CC1352R1_LAUNCHXL_AESCTR0]
+ },
+};
+
+const uint_least8_t AESCTR_count = CC1352R1_LAUNCHXL_AESCTRCOUNT;
+
+/*
+ * =============================== AESECB ===============================
+ */
+#include <ti/drivers/AESECB.h>
+#include <ti/drivers/aesecb/AESECBCC26XX.h>
+
+AESECBCC26XX_Object aesecbCC26XXObjects[CC1352R1_LAUNCHXL_AESECBCOUNT];
+
+const AESECBCC26XX_HWAttrs aesecbCC26XXHWAttrs[CC1352R1_LAUNCHXL_AESECBCOUNT] = {
+ {
+ .intPriority = ~0,
+ }
+};
+
+const AESECB_Config AESECB_config[CC1352R1_LAUNCHXL_AESECBCOUNT] = {
+ {
+ .object = &aesecbCC26XXObjects[CC1352R1_LAUNCHXL_AESECB0],
+ .hwAttrs = &aesecbCC26XXHWAttrs[CC1352R1_LAUNCHXL_AESECB0]
+ },
+};
+
+const uint_least8_t AESECB_count = CC1352R1_LAUNCHXL_AESECBCOUNT;
+
+/*
+ * =============================== AESCTRDRBG ===============================
+ */
+#include <ti/drivers/AESCTRDRBG.h>
+#include <ti/drivers/aesctrdrbg/AESCTRDRBGXX.h>
+
+AESCTRDRBGXX_Object aesctrdrbgXXObjects[CC1352R1_LAUNCHXL_AESCTRDRBGCOUNT];
+
+const AESCTRDRBGXX_HWAttrs aesctrdrbgXXHWAttrs[CC1352R1_LAUNCHXL_AESCTRDRBGCOUNT] = {
+ {
+ .aesctrIndex = CC1352R1_LAUNCHXL_AESCTR0,
+ }
+};
+
+const AESCTRDRBG_Config AESCTRDRBG_config[CC1352R1_LAUNCHXL_AESCTRDRBGCOUNT] = {
+ {
+ .object = &aesctrdrbgXXObjects[CC1352R1_LAUNCHXL_AESCTRDRBG0],
+ .hwAttrs = &aesctrdrbgXXHWAttrs[CC1352R1_LAUNCHXL_AESCTRDRBG0]
+ },
+};
+
+const uint_least8_t AESCTRDRBG_count = CC1352R1_LAUNCHXL_AESCTRDRBGCOUNT;
+
+/*
+ * =============================== TRNG ===============================
+ */
+#include <ti/drivers/TRNG.h>
+#include <ti/drivers/trng/TRNGCC26XX.h>
+
+TRNGCC26XX_Object trngCC26XXObjects[CC1352R1_LAUNCHXL_TRNGCOUNT];
+
+const TRNGCC26XX_HWAttrs trngCC26X2HWAttrs[CC1352R1_LAUNCHXL_TRNGCOUNT] = {
+ {
+ .intPriority = ~0,
+ .swiPriority = 0,
+ .samplesPerCycle = 240000,
+ }
+};
+
+const TRNG_Config TRNG_config[CC1352R1_LAUNCHXL_TRNGCOUNT] = {
+ {
+ .object = &trngCC26XXObjects[CC1352R1_LAUNCHXL_TRNG0],
+ .hwAttrs = &trngCC26X2HWAttrs[CC1352R1_LAUNCHXL_TRNG0]
+ },
+};
+
+const uint_least8_t TRNG_count = CC1352R1_LAUNCHXL_TRNGCOUNT;
+
+/*
+ * =============================== Display ===============================
+ */
+#include <ti/display/Display.h>
+#include <ti/display/DisplayUart.h>
+#include <ti/display/DisplaySharp.h>
+
+#ifndef BOARD_DISPLAY_UART_STRBUF_SIZE
+#define BOARD_DISPLAY_UART_STRBUF_SIZE 128
+#endif
+
+/* This value can be changed to 96 for use with the 430BOOST-SHARP96 BoosterPack. */
+#define BOARD_DISPLAY_SHARP_SIZE 128
+
+DisplayUart_Object displayUartObject;
+DisplaySharp_Object displaySharpObject;
+
+static char uartStringBuf[BOARD_DISPLAY_UART_STRBUF_SIZE];
+static uint_least8_t sharpDisplayBuf[BOARD_DISPLAY_SHARP_SIZE * BOARD_DISPLAY_SHARP_SIZE / 8];
+
+const DisplayUart_HWAttrs displayUartHWAttrs = {
+ .uartIdx = CC1352R1_LAUNCHXL_UART0,
+ .baudRate = 115200,
+ .mutexTimeout = (unsigned int)(-1),
+ .strBuf = uartStringBuf,
+ .strBufLen = BOARD_DISPLAY_UART_STRBUF_SIZE,
+};
+
+const DisplaySharp_HWAttrsV1 displaySharpHWattrs = {
+ .spiIndex = CC1352R1_LAUNCHXL_SPI0,
+ .csPin = CC1352R1_LAUNCHXL_GPIO_LCD_CS,
+ .powerPin = CC1352R1_LAUNCHXL_GPIO_LCD_POWER,
+ .enablePin = CC1352R1_LAUNCHXL_GPIO_LCD_ENABLE,
+ .pixelWidth = BOARD_DISPLAY_SHARP_SIZE,
+ .pixelHeight = BOARD_DISPLAY_SHARP_SIZE,
+ .displayBuf = sharpDisplayBuf,
+};
+
+#ifndef BOARD_DISPLAY_USE_UART
+#define BOARD_DISPLAY_USE_UART 1
+#endif
+#ifndef BOARD_DISPLAY_USE_UART_ANSI
+#define BOARD_DISPLAY_USE_UART_ANSI 0
+#endif
+#ifndef BOARD_DISPLAY_USE_LCD
+#define BOARD_DISPLAY_USE_LCD 0
+#endif
+
+/*
+ * This #if/#else is needed to workaround a problem with the
+ * IAR compiler. The IAR compiler doesn't like the empty array
+ * initialization. (IAR Error[Pe1345])
+ */
+#if (BOARD_DISPLAY_USE_UART || BOARD_DISPLAY_USE_LCD)
+
+const Display_Config Display_config[] = {
+#if (BOARD_DISPLAY_USE_UART)
+ {
+# if (BOARD_DISPLAY_USE_UART_ANSI)
+ .fxnTablePtr = &DisplayUartAnsi_fxnTable,
+# else /* Default to minimal UART with no cursor placement */
+ .fxnTablePtr = &DisplayUartMin_fxnTable,
+# endif
+ .object = &displayUartObject,
+ .hwAttrs = &displayUartHWAttrs,
+ },
+#endif
+#if (BOARD_DISPLAY_USE_LCD)
+ {
+ .fxnTablePtr = &DisplaySharp_fxnTable,
+ .object = &displaySharpObject,
+ .hwAttrs = &displaySharpHWattrs
+ },
+#endif
+};
+
+const uint_least8_t Display_count = sizeof(Display_config) / sizeof(Display_Config);
+
+#else
+
+const Display_Config *Display_config = NULL;
+const uint_least8_t Display_count = 0;
+
+#endif /* (BOARD_DISPLAY_USE_UART || BOARD_DISPLAY_USE_LCD) */
+
+/*
+ * =============================== GPIO ===============================
+ */
+#include <ti/drivers/GPIO.h>
+#include <ti/drivers/gpio/GPIOCC26XX.h>
+
+/*
+ * Array of Pin configurations
+ * NOTE: The order of the pin configurations must coincide with what was
+ * defined in CC1352R1_LAUNCHXL.h
+ * NOTE: Pins not used for interrupts should be placed at the end of the
+ * array. Callback entries can be omitted from callbacks array to
+ * reduce memory usage.
+ */
+GPIO_PinConfig gpioPinConfigs[] = {
+ /* Input pins */
+ GPIOCC26XX_DIO_15 | GPIO_DO_NOT_CONFIG, /* Button 0 */
+ GPIOCC26XX_DIO_14 | GPIO_DO_NOT_CONFIG, /* Button 1 */
+
+ GPIOCC26XX_DIO_15 | GPIO_DO_NOT_CONFIG, /* CC1352R1_LAUNCHXL_SPI_MASTER_READY */
+ GPIOCC26XX_DIO_21 | GPIO_DO_NOT_CONFIG, /* CC1352R1_LAUNCHXL_SPI_SLAVE_READY */
+
+ /* Output pins */
+ GPIOCC26XX_DIO_07 | GPIO_DO_NOT_CONFIG, /* Green LED */
+ GPIOCC26XX_DIO_06 | GPIO_DO_NOT_CONFIG, /* Red LED */
+ GPIOCC26XX_DIO_30 | GPIO_DO_NOT_CONFIG, /* TMP116_EN */
+
+ /* SPI Flash CSN */
+ GPIOCC26XX_DIO_20 | GPIO_DO_NOT_CONFIG,
+
+ /* SD CS */
+ GPIOCC26XX_DIO_21 | GPIO_DO_NOT_CONFIG,
+
+ /* Sharp Display - GPIO configurations will be done in the Display files */
+ GPIOCC26XX_DIO_24 | GPIO_DO_NOT_CONFIG, /* SPI chip select */
+ GPIOCC26XX_DIO_22 | GPIO_DO_NOT_CONFIG, /* LCD power control */
+ GPIOCC26XX_DIO_23 | GPIO_DO_NOT_CONFIG, /* LCD enable */
+
+};
+
+/*
+ * Array of callback function pointers
+ * NOTE: The order of the pin configurations must coincide with what was
+ * defined in CC1352R1_LAUNCH.h
+ * NOTE: Pins not used for interrupts can be omitted from callbacks array to
+ * reduce memory usage (if placed at end of gpioPinConfigs array).
+ */
+GPIO_CallbackFxn gpioCallbackFunctions[] = {
+ NULL, /* Button 0 */
+ NULL, /* Button 1 */
+ NULL, /* CC1352R1_LAUNCHXL_SPI_MASTER_READY */
+ NULL, /* CC1352R1_LAUNCHXL_SPI_SLAVE_READY */
+};
+
+const GPIOCC26XX_Config GPIOCC26XX_config = {
+ .pinConfigs = (GPIO_PinConfig *)gpioPinConfigs,
+ .callbacks = (GPIO_CallbackFxn *)gpioCallbackFunctions,
+ .numberOfPinConfigs = CC1352R1_LAUNCHXL_GPIOCOUNT,
+ .numberOfCallbacks = sizeof(gpioCallbackFunctions)/sizeof(GPIO_CallbackFxn),
+ .intPriority = (~0)
+};
+
+/*
+ * =============================== GPTimer ===============================
+ * Remove unused entries to reduce flash usage both in Board.c and Board.h
+ */
+#include <ti/drivers/timer/GPTimerCC26XX.h>
+
+GPTimerCC26XX_Object gptimerCC26XXObjects[CC1352R1_LAUNCHXL_GPTIMERCOUNT];
+
+const GPTimerCC26XX_HWAttrs gptimerCC26xxHWAttrs[CC1352R1_LAUNCHXL_GPTIMERPARTSCOUNT] = {
+ { .baseAddr = GPT0_BASE, .intNum = INT_GPT0A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0A, },
+ { .baseAddr = GPT0_BASE, .intNum = INT_GPT0B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0B, },
+ { .baseAddr = GPT1_BASE, .intNum = INT_GPT1A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1A, },
+ { .baseAddr = GPT1_BASE, .intNum = INT_GPT1B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1B, },
+ { .baseAddr = GPT2_BASE, .intNum = INT_GPT2A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2A, },
+ { .baseAddr = GPT2_BASE, .intNum = INT_GPT2B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2B, },
+ { .baseAddr = GPT3_BASE, .intNum = INT_GPT3A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3A, },
+ { .baseAddr = GPT3_BASE, .intNum = INT_GPT3B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3B, },
+};
+
+const GPTimerCC26XX_Config GPTimerCC26XX_config[CC1352R1_LAUNCHXL_GPTIMERPARTSCOUNT] = {
+ { &gptimerCC26XXObjects[CC1352R1_LAUNCHXL_GPTIMER0], &gptimerCC26xxHWAttrs[CC1352R1_LAUNCHXL_GPTIMER0A], GPT_A },
+ { &gptimerCC26XXObjects[CC1352R1_LAUNCHXL_GPTIMER0], &gptimerCC26xxHWAttrs[CC1352R1_LAUNCHXL_GPTIMER0B], GPT_B },
+ { &gptimerCC26XXObjects[CC1352R1_LAUNCHXL_GPTIMER1], &gptimerCC26xxHWAttrs[CC1352R1_LAUNCHXL_GPTIMER1A], GPT_A },
+ { &gptimerCC26XXObjects[CC1352R1_LAUNCHXL_GPTIMER1], &gptimerCC26xxHWAttrs[CC1352R1_LAUNCHXL_GPTIMER1B], GPT_B },
+ { &gptimerCC26XXObjects[CC1352R1_LAUNCHXL_GPTIMER2], &gptimerCC26xxHWAttrs[CC1352R1_LAUNCHXL_GPTIMER2A], GPT_A },
+ { &gptimerCC26XXObjects[CC1352R1_LAUNCHXL_GPTIMER2], &gptimerCC26xxHWAttrs[CC1352R1_LAUNCHXL_GPTIMER2B], GPT_B },
+ { &gptimerCC26XXObjects[CC1352R1_LAUNCHXL_GPTIMER3], &gptimerCC26xxHWAttrs[CC1352R1_LAUNCHXL_GPTIMER3A], GPT_A },
+ { &gptimerCC26XXObjects[CC1352R1_LAUNCHXL_GPTIMER3], &gptimerCC26xxHWAttrs[CC1352R1_LAUNCHXL_GPTIMER3B], GPT_B },
+};
+
+/*
+ * =============================== I2C ===============================
+*/
+#include <ti/drivers/I2C.h>
+#include <ti/drivers/i2c/I2CCC26XX.h>
+
+I2CCC26XX_Object i2cCC26xxObjects[CC1352R1_LAUNCHXL_I2CCOUNT];
+
+const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC1352R1_LAUNCHXL_I2CCOUNT] = {
+ {
+ .baseAddr = I2C0_BASE,
+ .powerMngrId = PowerCC26XX_PERIPH_I2C0,
+ .intNum = INT_I2C_IRQ,
+ .intPriority = ~0,
+ .swiPriority = 0,
+ .sdaPin = CC1352R1_LAUNCHXL_I2C0_SDA0,
+ .sclPin = CC1352R1_LAUNCHXL_I2C0_SCL0,
+ }
+};
+
+const I2C_Config I2C_config[CC1352R1_LAUNCHXL_I2CCOUNT] = {
+ {
+ .fxnTablePtr = &I2CCC26XX_fxnTable,
+ .object = &i2cCC26xxObjects[CC1352R1_LAUNCHXL_I2C0],
+ .hwAttrs = &i2cCC26xxHWAttrs[CC1352R1_LAUNCHXL_I2C0]
+ },
+};
+
+const uint_least8_t I2C_count = CC1352R1_LAUNCHXL_I2CCOUNT;
+
+/*
+ * =============================== I2S ===============================
+*/
+#include <ti/drivers/I2S.h>
+#include <ti/drivers/i2s/I2SCC26XX.h>
+
+I2SCC26XX_Object i2sCC26XXObjects[CC1352R1_LAUNCHXL_I2SCOUNT];
+
+const I2SCC26XX_HWAttrs i2sCC26XXHWAttrs[CC1352R1_LAUNCHXL_I2SCOUNT] = {
+ {
+ .pinSD1 = CC1352R1_LAUNCHXL_I2S_ADI,
+ .pinSD0 = CC1352R1_LAUNCHXL_I2S_ADO,
+ .pinSCK = CC1352R1_LAUNCHXL_I2S_BCLK,
+ .pinMCLK = CC1352R1_LAUNCHXL_I2S_MCLK,
+ .pinWS = CC1352R1_LAUNCHXL_I2S_WCLK,
+ .intPriority = ~0,
+ }
+};
+
+const I2S_Config I2S_config[CC1352R1_LAUNCHXL_I2SCOUNT] = {
+ {
+ .object = &i2sCC26XXObjects[CC1352R1_LAUNCHXL_I2S0],
+ .hwAttrs = &i2sCC26XXHWAttrs[CC1352R1_LAUNCHXL_I2S0]
+ },
+};
+
+const uint_least8_t I2S_count = CC1352R1_LAUNCHXL_I2SCOUNT;
+
+/*
+ * =============================== NVS ===============================
+ */
+#include <ti/drivers/NVS.h>
+#include <ti/drivers/nvs/NVSSPI25X.h>
+#include <ti/drivers/nvs/NVSCC26XX.h>
+
+#define NVS_REGIONS_BASE 0x48000
+#define SECTORSIZE 0x2000
+#define REGIONSIZE (SECTORSIZE * 4)
+
+#ifndef Board_EXCLUDE_NVS_INTERNAL_FLASH
+
+/*
+ * Reserve flash sectors for NVS driver use by placing an uninitialized byte
+ * array at the desired flash address.
+ */
+#if defined(__TI_COMPILER_VERSION__)
+
+/*
+ * Place uninitialized array at NVS_REGIONS_BASE
+ */
+#pragma LOCATION(flashBuf, NVS_REGIONS_BASE);
+#pragma NOINIT(flashBuf);
+static char flashBuf[REGIONSIZE];
+
+#elif defined(__IAR_SYSTEMS_ICC__)
+
+/*
+ * Place uninitialized array at NVS_REGIONS_BASE
+ */
+static __no_init char flashBuf[REGIONSIZE] @ NVS_REGIONS_BASE;
+
+#elif defined(__GNUC__)
+
+/*
+ * Place the flash buffers in the .nvs section created in the gcc linker file.
+ * The .nvs section enforces alignment on a sector boundary but may
+ * be placed anywhere in flash memory. If desired the .nvs section can be set
+ * to a fixed address by changing the following in the gcc linker file:
+ *
+ * .nvs (FIXED_FLASH_ADDR) (NOLOAD) : AT (FIXED_FLASH_ADDR) {
+ * *(.nvs)
+ * } > REGION_TEXT
+ */
+__attribute__ ((section (".nvs")))
+static char flashBuf[REGIONSIZE];
+
+#endif
+
+/* Allocate objects for NVS Internal Regions */
+NVSCC26XX_Object nvsCC26xxObjects[1];
+
+/* Hardware attributes for NVS Internal Regions */
+const NVSCC26XX_HWAttrs nvsCC26xxHWAttrs[1] = {
+ {
+ .regionBase = (void *)flashBuf,
+ .regionSize = REGIONSIZE,
+ },
+};
+
+#endif /* Board_EXCLUDE_NVS_INTERNAL_FLASH */
+
+#ifndef Board_EXCLUDE_NVS_EXTERNAL_FLASH
+
+#define SPISECTORSIZE 0x1000
+#define SPIREGIONSIZE (SPISECTORSIZE * 32)
+#define VERIFYBUFSIZE 64
+
+static uint8_t verifyBuf[VERIFYBUFSIZE];
+
+/* Allocate objects for NVS External Regions */
+NVSSPI25X_Object nvsSPI25XObjects[1];
+
+/* Hardware attributes for NVS External Regions */
+const NVSSPI25X_HWAttrs nvsSPI25XHWAttrs[1] = {
+ {
+ .regionBaseOffset = 0,
+ .regionSize = SPIREGIONSIZE,
+ .sectorSize = SPISECTORSIZE,
+ .verifyBuf = verifyBuf,
+ .verifyBufSize = VERIFYBUFSIZE,
+ .spiHandle = NULL,
+ .spiIndex = 0,
+ .spiBitRate = 4000000,
+ .spiCsnGpioIndex = CC1352R1_LAUNCHXL_GPIO_SPI_FLASH_CS,
+ .statusPollDelayUs = 100,
+ },
+};
+
+#endif /* Board_EXCLUDE_NVS_EXTERNAL_FLASH */
+
+/* NVS Region index 0 and 1 refer to NVS and NVS SPI respectively */
+const NVS_Config NVS_config[CC1352R1_LAUNCHXL_NVSCOUNT] = {
+#ifndef Board_EXCLUDE_NVS_INTERNAL_FLASH
+ {
+ .fxnTablePtr = &NVSCC26XX_fxnTable,
+ .object = &nvsCC26xxObjects[0],
+ .hwAttrs = &nvsCC26xxHWAttrs[0],
+ },
+#endif
+#ifndef Board_EXCLUDE_NVS_EXTERNAL_FLASH
+ {
+ .fxnTablePtr = &NVSSPI25X_fxnTable,
+ .object = &nvsSPI25XObjects[0],
+ .hwAttrs = &nvsSPI25XHWAttrs[0],
+ },
+#endif
+};
+
+const uint_least8_t NVS_count = CC1352R1_LAUNCHXL_NVSCOUNT;
+
+/*
+ * =============================== PIN ===============================
+ */
+#include <ti/drivers/PIN.h>
+#include <ti/drivers/pin/PINCC26XX.h>
+
+const PIN_Config BoardGpioInitTable[] = {
+
+ CC1352R1_LAUNCHXL_PIN_RLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */
+ CC1352R1_LAUNCHXL_PIN_GLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */
+ CC1352R1_LAUNCHXL_PIN_BTN1 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
+ CC1352R1_LAUNCHXL_PIN_BTN2 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
+ CC1352R1_LAUNCHXL_SPI_FLASH_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */
+ CC1352R1_LAUNCHXL_UART0_RX | PIN_INPUT_EN | PIN_PULLDOWN, /* UART RX via debugger back channel */
+ CC1352R1_LAUNCHXL_UART0_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL, /* UART TX via debugger back channel */
+ CC1352R1_LAUNCHXL_SPI0_MOSI | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master out - slave in */
+ CC1352R1_LAUNCHXL_SPI0_MISO | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master in - slave out */
+ CC1352R1_LAUNCHXL_SPI0_CLK | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI clock */
+ PIN_TERMINATE
+};
+
+const PINCC26XX_HWAttrs PINCC26XX_hwAttrs = {
+ .intPriority = ~0,
+ .swiPriority = 0
+};
+
+/*
+ * =============================== Power ===============================
+ */
+#include <ti/drivers/Power.h>
+#include <ti/drivers/power/PowerCC26X2.h>
+
+const PowerCC26X2_Config PowerCC26X2_config = {
+ .policyInitFxn = NULL,
+ .policyFxn = &PowerCC26XX_standbyPolicy,
+ .calibrateFxn = &PowerCC26XX_calibrate,
+ .enablePolicy = true,
+ .calibrateRCOSC_LF = true,
+ .calibrateRCOSC_HF = true,
+};
+
+/*
+ * =============================== PWM ===============================
+ * Remove unused entries to reduce flash usage both in Board.c and Board.h
+ */
+#include <ti/drivers/PWM.h>
+#include <ti/drivers/pwm/PWMTimerCC26XX.h>
+
+PWMTimerCC26XX_Object pwmtimerCC26xxObjects[CC1352R1_LAUNCHXL_PWMCOUNT];
+
+const PWMTimerCC26XX_HwAttrs pwmtimerCC26xxHWAttrs[CC1352R1_LAUNCHXL_PWMCOUNT] = {
+ { .pwmPin = CC1352R1_LAUNCHXL_PWMPIN0, .gpTimerUnit = CC1352R1_LAUNCHXL_GPTIMER0A },
+ { .pwmPin = CC1352R1_LAUNCHXL_PWMPIN1, .gpTimerUnit = CC1352R1_LAUNCHXL_GPTIMER0B },
+ { .pwmPin = CC1352R1_LAUNCHXL_PWMPIN2, .gpTimerUnit = CC1352R1_LAUNCHXL_GPTIMER1A },
+ { .pwmPin = CC1352R1_LAUNCHXL_PWMPIN3, .gpTimerUnit = CC1352R1_LAUNCHXL_GPTIMER1B },
+ { .pwmPin = CC1352R1_LAUNCHXL_PWMPIN4, .gpTimerUnit = CC1352R1_LAUNCHXL_GPTIMER2A },
+ { .pwmPin = CC1352R1_LAUNCHXL_PWMPIN5, .gpTimerUnit = CC1352R1_LAUNCHXL_GPTIMER2B },
+ { .pwmPin = CC1352R1_LAUNCHXL_PWMPIN6, .gpTimerUnit = CC1352R1_LAUNCHXL_GPTIMER3A },
+ { .pwmPin = CC1352R1_LAUNCHXL_PWMPIN7, .gpTimerUnit = CC1352R1_LAUNCHXL_GPTIMER3B },
+};
+
+const PWM_Config PWM_config[CC1352R1_LAUNCHXL_PWMCOUNT] = {
+ { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352R1_LAUNCHXL_PWM0], &pwmtimerCC26xxHWAttrs[CC1352R1_LAUNCHXL_PWM0] },
+ { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352R1_LAUNCHXL_PWM1], &pwmtimerCC26xxHWAttrs[CC1352R1_LAUNCHXL_PWM1] },
+ { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352R1_LAUNCHXL_PWM2], &pwmtimerCC26xxHWAttrs[CC1352R1_LAUNCHXL_PWM2] },
+ { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352R1_LAUNCHXL_PWM3], &pwmtimerCC26xxHWAttrs[CC1352R1_LAUNCHXL_PWM3] },
+ { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352R1_LAUNCHXL_PWM4], &pwmtimerCC26xxHWAttrs[CC1352R1_LAUNCHXL_PWM4] },
+ { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352R1_LAUNCHXL_PWM5], &pwmtimerCC26xxHWAttrs[CC1352R1_LAUNCHXL_PWM5] },
+ { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352R1_LAUNCHXL_PWM6], &pwmtimerCC26xxHWAttrs[CC1352R1_LAUNCHXL_PWM6] },
+ { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352R1_LAUNCHXL_PWM7], &pwmtimerCC26xxHWAttrs[CC1352R1_LAUNCHXL_PWM7] },
+};
+
+const uint_least8_t PWM_count = CC1352R1_LAUNCHXL_PWMCOUNT;
+
+/*
+ * =============================== RF Driver ===============================
+ */
+#include <ti/drivers/rf/RF.h>
+
+const RFCC26XX_HWAttrsV2 RFCC26XX_hwAttrs = {
+ .hwiPriority = ~0, /* Lowest HWI priority */
+ .swiPriority = 0, /* Lowest SWI priority */
+ .xoscHfAlwaysNeeded = true, /* Keep XOSC dependency while in standby */
+ .globalCallback = NULL, /* No board specific callback */
+ .globalEventMask = 0 /* No events subscribed to */
+};
+
+/*
+ * =============================== SD ===============================
+ */
+#include <ti/drivers/SD.h>
+#include <ti/drivers/sd/SDSPI.h>
+
+SDSPI_Object sdspiObjects[CC1352R1_LAUNCHXL_SDCOUNT];
+
+const SDSPI_HWAttrs sdspiHWAttrs[CC1352R1_LAUNCHXL_SDCOUNT] = {
+ {
+ .spiIndex = CC1352R1_LAUNCHXL_SPI0,
+ .spiCsGpioIndex = CC1352R1_LAUNCHXL_SDSPI_CS
+ }
+};
+
+const SD_Config SD_config[CC1352R1_LAUNCHXL_SDCOUNT] = {
+ {
+ .fxnTablePtr = &SDSPI_fxnTable,
+ .object = &sdspiObjects[CC1352R1_LAUNCHXL_SDSPI0],
+ .hwAttrs = &sdspiHWAttrs[CC1352R1_LAUNCHXL_SDSPI0]
+ },
+};
+
+const uint_least8_t SD_count = CC1352R1_LAUNCHXL_SDCOUNT;
+
+/*
+ * =============================== SPI DMA ===============================
+ */
+#include <ti/drivers/SPI.h>
+#include <ti/drivers/spi/SPICC26X2DMA.h>
+
+SPICC26X2DMA_Object spiCC26X2DMAObjects[CC1352R1_LAUNCHXL_SPICOUNT];
+
+/*
+ * NOTE: The SPI instances below can be used by the SD driver to communicate
+ * with a SD card via SPI. The 'defaultTxBufValue' fields below are set to 0xFF
+ * to satisfy the SDSPI driver requirement.
+ */
+const SPICC26X2DMA_HWAttrs spiCC26X2DMAHWAttrs[CC1352R1_LAUNCHXL_SPICOUNT] = {
+ {
+ .baseAddr = SSI0_BASE,
+ .intNum = INT_SSI0_COMB,
+ .intPriority = ~0,
+ .swiPriority = 0,
+ .powerMngrId = PowerCC26XX_PERIPH_SSI0,
+ .defaultTxBufValue = 0xFF,
+ .rxChannelBitMask = 1<<UDMA_CHAN_SSI0_RX,
+ .txChannelBitMask = 1<<UDMA_CHAN_SSI0_TX,
+ .mosiPin = CC1352R1_LAUNCHXL_SPI0_MOSI,
+ .misoPin = CC1352R1_LAUNCHXL_SPI0_MISO,
+ .clkPin = CC1352R1_LAUNCHXL_SPI0_CLK,
+ .csnPin = CC1352R1_LAUNCHXL_SPI0_CSN,
+ .minDmaTransferSize = 10
+ },
+ {
+ .baseAddr = SSI1_BASE,
+ .intNum = INT_SSI1_COMB,
+ .intPriority = ~0,
+ .swiPriority = 0,
+ .powerMngrId = PowerCC26XX_PERIPH_SSI1,
+ .defaultTxBufValue = 0xFF,
+ .rxChannelBitMask = 1<<UDMA_CHAN_SSI1_RX,
+ .txChannelBitMask = 1<<UDMA_CHAN_SSI1_TX,
+ .mosiPin = CC1352R1_LAUNCHXL_SPI1_MOSI,
+ .misoPin = CC1352R1_LAUNCHXL_SPI1_MISO,
+ .clkPin = CC1352R1_LAUNCHXL_SPI1_CLK,
+ .csnPin = CC1352R1_LAUNCHXL_SPI1_CSN,
+ .minDmaTransferSize = 10
+ }
+};
+
+const SPI_Config SPI_config[CC1352R1_LAUNCHXL_SPICOUNT] = {
+ {
+ .fxnTablePtr = &SPICC26X2DMA_fxnTable,
+ .object = &spiCC26X2DMAObjects[CC1352R1_LAUNCHXL_SPI0],
+ .hwAttrs = &spiCC26X2DMAHWAttrs[CC1352R1_LAUNCHXL_SPI0]
+ },
+ {
+ .fxnTablePtr = &SPICC26X2DMA_fxnTable,
+ .object = &spiCC26X2DMAObjects[CC1352R1_LAUNCHXL_SPI1],
+ .hwAttrs = &spiCC26X2DMAHWAttrs[CC1352R1_LAUNCHXL_SPI1]
+ },
+};
+
+const uint_least8_t SPI_count = CC1352R1_LAUNCHXL_SPICOUNT;
+
+/*
+ * =============================== UART ===============================
+ */
+#include <ti/drivers/UART.h>
+#include <ti/drivers/uart/UARTCC26XX.h>
+
+UARTCC26XX_Object uartCC26XXObjects[CC1352R1_LAUNCHXL_UARTCOUNT];
+
+uint8_t uartCC26XXRingBuffer[CC1352R1_LAUNCHXL_UARTCOUNT][32];
+
+const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC1352R1_LAUNCHXL_UARTCOUNT] = {
+ {
+ .baseAddr = UART0_BASE,
+ .powerMngrId = PowerCC26XX_PERIPH_UART0,
+ .intNum = INT_UART0_COMB,
+ .intPriority = ~0,
+ .swiPriority = 0,
+ .txPin = CC1352R1_LAUNCHXL_UART0_TX,
+ .rxPin = CC1352R1_LAUNCHXL_UART0_RX,
+ .ctsPin = PIN_UNASSIGNED,
+ .rtsPin = PIN_UNASSIGNED,
+ .ringBufPtr = uartCC26XXRingBuffer[CC1352R1_LAUNCHXL_UART0],
+ .ringBufSize = sizeof(uartCC26XXRingBuffer[CC1352R1_LAUNCHXL_UART0]),
+ .txIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_1_8,
+ .rxIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_4_8,
+ .errorFxn = NULL
+ },
+ {
+ .baseAddr = UART1_BASE,
+ .powerMngrId = PowerCC26X2_PERIPH_UART1,
+ .intNum = INT_UART1_COMB,
+ .intPriority = ~0,
+ .swiPriority = 0,
+ .txPin = CC1352R1_LAUNCHXL_UART1_TX,
+ .rxPin = CC1352R1_LAUNCHXL_UART1_RX,
+ .ctsPin = PIN_UNASSIGNED,
+ .rtsPin = PIN_UNASSIGNED,
+ .ringBufPtr = uartCC26XXRingBuffer[CC1352R1_LAUNCHXL_UART1],
+ .ringBufSize = sizeof(uartCC26XXRingBuffer[CC1352R1_LAUNCHXL_UART1]),
+ .txIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_1_8,
+ .rxIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_4_8,
+ .errorFxn = NULL
+ }
+};
+
+const UART_Config UART_config[CC1352R1_LAUNCHXL_UARTCOUNT] = {
+ {
+ .fxnTablePtr = &UARTCC26XX_fxnTable,
+ .object = &uartCC26XXObjects[CC1352R1_LAUNCHXL_UART0],
+ .hwAttrs = &uartCC26XXHWAttrs[CC1352R1_LAUNCHXL_UART0]
+ },
+ {
+ .fxnTablePtr = &UARTCC26XX_fxnTable,
+ .object = &uartCC26XXObjects[CC1352R1_LAUNCHXL_UART1],
+ .hwAttrs = &uartCC26XXHWAttrs[CC1352R1_LAUNCHXL_UART1]
+ },
+};
+
+const uint_least8_t UART_count = CC1352R1_LAUNCHXL_UARTCOUNT;
+
+/*
+ * =============================== UDMA ===============================
+ */
+#include <ti/drivers/dma/UDMACC26XX.h>
+
+UDMACC26XX_Object udmaObjects[CC1352R1_LAUNCHXL_UDMACOUNT];
+
+const UDMACC26XX_HWAttrs udmaHWAttrs[CC1352R1_LAUNCHXL_UDMACOUNT] = {
+ {
+ .baseAddr = UDMA0_BASE,
+ .powerMngrId = PowerCC26XX_PERIPH_UDMA,
+ .intNum = INT_DMA_ERR,
+ .intPriority = ~0
+ }
+};
+
+const UDMACC26XX_Config UDMACC26XX_config[CC1352R1_LAUNCHXL_UDMACOUNT] = {
+ {
+ .object = &udmaObjects[CC1352R1_LAUNCHXL_UDMA0],
+ .hwAttrs = &udmaHWAttrs[CC1352R1_LAUNCHXL_UDMA0]
+ },
+};
+
+
+
+/*
+ * =============================== Watchdog ===============================
+ */
+#include <ti/drivers/Watchdog.h>
+#include <ti/drivers/watchdog/WatchdogCC26XX.h>
+
+WatchdogCC26XX_Object watchdogCC26XXObjects[CC1352R1_LAUNCHXL_WATCHDOGCOUNT];
+
+const WatchdogCC26XX_HWAttrs watchdogCC26XXHWAttrs[CC1352R1_LAUNCHXL_WATCHDOGCOUNT] = {
+ {
+ .baseAddr = WDT_BASE,
+ .reloadValue = 1000 /* Reload value in milliseconds */
+ },
+};
+
+const Watchdog_Config Watchdog_config[CC1352R1_LAUNCHXL_WATCHDOGCOUNT] = {
+ {
+ .fxnTablePtr = &WatchdogCC26XX_fxnTable,
+ .object = &watchdogCC26XXObjects[CC1352R1_LAUNCHXL_WATCHDOG0],
+ .hwAttrs = &watchdogCC26XXHWAttrs[CC1352R1_LAUNCHXL_WATCHDOG0]
+ },
+};
+
+const uint_least8_t Watchdog_count = CC1352R1_LAUNCHXL_WATCHDOGCOUNT;
+
+/*
+ * Board-specific initialization function to disable external flash.
+ * This function is defined in the file CC1352R1_LAUNCHXL_fxns.c
+ */
+extern void Board_initHook(void);
+
+/*
+ * ======== CC1352R1_LAUNCHXL_initGeneral ========
+ */
+void CC1352R1_LAUNCHXL_initGeneral(void)
+{
+ Power_init();
+
+ if (PIN_init(BoardGpioInitTable) != PIN_SUCCESS) {
+ /* Error with PIN_init */
+ while (1);
+ }
+
+ /* Perform board-specific initialization */
+ Board_initHook();
+}
+
+/*
+ * ======== Board_init ========
+ */
+void Board_init(void)
+{
+ CC1352R1_LAUNCHXL_initGeneral();
+}
diff --git a/samples/rfBleConnect/src/CC1352R1_LAUNCHXL.h b/samples/rfBleConnect/src/CC1352R1_LAUNCHXL.h
new file mode 100644
index 0000000000..adf4097e25
--- /dev/null
+++ b/samples/rfBleConnect/src/CC1352R1_LAUNCHXL.h
@@ -0,0 +1,502 @@
+/*
+ * Copyright (c) 2017-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.
+ */
+/** ===========================================================================
+ * @file CC1352R1_LAUNCHXL.h
+ *
+ * @brief CC1352R1_LAUNCHXL Board Specific header file.
+ *
+ * The CC1352R1_LAUNCHXL header file should be included in an application as
+ * follows:
+ * @code
+ * #include "CC1352R1_LAUNCHXL.h"
+ * @endcode
+ *
+ * ===========================================================================
+ */
+#ifndef __CC1352R1_LAUNCHXL_BOARD_H__
+#define __CC1352R1_LAUNCHXL_BOARD_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Includes */
+//#include <ti/drivers/PIN.h>
+#include <ti/devices/cc13x2_cc26x2/driverlib/ioc.h>
+
+/* Externs */
+//extern const PIN_Config BoardGpioInitTable[];
+
+/* Defines */
+#define CC1352R1_LAUNCHXL
+
+/* Mapping of pins to board signals using general board aliases
+ * <board signal alias> <pin mapping> <comments>
+ */
+
+/* Mapping of pins to board signals using general board aliases
+ * <board signal alias> <pin mapping>
+ */
+/* Analog Capable DIOs */
+#define CC1352R1_LAUNCHXL_DIO23_ANALOG IOID_23
+#define CC1352R1_LAUNCHXL_DIO24_ANALOG IOID_24
+#define CC1352R1_LAUNCHXL_DIO25_ANALOG IOID_25
+#define CC1352R1_LAUNCHXL_DIO26_ANALOG IOID_26
+#define CC1352R1_LAUNCHXL_DIO27_ANALOG IOID_27
+#define CC1352R1_LAUNCHXL_DIO28_ANALOG IOID_28
+#define CC1352R1_LAUNCHXL_DIO29_ANALOG IOID_29
+
+/* Digital IOs */
+#define CC1352R1_LAUNCHXL_DIO12 IOID_12
+#define CC1352R1_LAUNCHXL_DIO15 IOID_15
+#define CC1352R1_LAUNCHXL_DIO16_TDO IOID_16
+#define CC1352R1_LAUNCHXL_DIO17_TDI IOID_17
+#define CC1352R1_LAUNCHXL_DIO21 IOID_21
+#define CC1352R1_LAUNCHXL_DIO22 IOID_22
+#define CC1352R1_LAUNCHXL_DIO30 IOID_30
+
+/* Discrete Inputs */
+#define CC1352R1_LAUNCHXL_PIN_BTN1 IOID_15
+#define CC1352R1_LAUNCHXL_PIN_BTN2 IOID_14
+
+/* GPIO */
+#define CC1352R1_LAUNCHXL_GPIO_LED_ON 1
+#define CC1352R1_LAUNCHXL_GPIO_LED_OFF 0
+
+/* I2C */
+#define CC1352R1_LAUNCHXL_I2C0_SCL0 IOID_4
+#define CC1352R1_LAUNCHXL_I2C0_SDA0 IOID_5
+
+/* I2S */
+#define CC1352R1_LAUNCHXL_I2S_ADO IOID_25
+#define CC1352R1_LAUNCHXL_I2S_ADI IOID_26
+#define CC1352R1_LAUNCHXL_I2S_BCLK IOID_27
+#define CC1352R1_LAUNCHXL_I2S_MCLK PIN_UNASSIGNED
+#define CC1352R1_LAUNCHXL_I2S_WCLK IOID_28
+
+/* LEDs */
+#define CC1352R1_LAUNCHXL_PIN_LED_ON 1
+#define CC1352R1_LAUNCHXL_PIN_LED_OFF 0
+#define CC1352R1_LAUNCHXL_PIN_RLED IOID_6
+#define CC1352R1_LAUNCHXL_PIN_GLED IOID_7
+
+/* PWM Outputs */
+#define CC1352R1_LAUNCHXL_PWMPIN0 CC1352R1_LAUNCHXL_PIN_RLED
+#define CC1352R1_LAUNCHXL_PWMPIN1 CC1352R1_LAUNCHXL_PIN_GLED
+#define CC1352R1_LAUNCHXL_PWMPIN2 PIN_UNASSIGNED
+#define CC1352R1_LAUNCHXL_PWMPIN3 PIN_UNASSIGNED
+#define CC1352R1_LAUNCHXL_PWMPIN4 PIN_UNASSIGNED
+#define CC1352R1_LAUNCHXL_PWMPIN5 PIN_UNASSIGNED
+#define CC1352R1_LAUNCHXL_PWMPIN6 PIN_UNASSIGNED
+#define CC1352R1_LAUNCHXL_PWMPIN7 PIN_UNASSIGNED
+
+/* SPI */
+#define CC1352R1_LAUNCHXL_SPI_FLASH_CS IOID_20
+#define CC1352R1_LAUNCHXL_FLASH_CS_ON 0
+#define CC1352R1_LAUNCHXL_FLASH_CS_OFF 1
+
+/* SPI Board */
+#define CC1352R1_LAUNCHXL_SPI0_MISO IOID_8 /* RF1.20 */
+#define CC1352R1_LAUNCHXL_SPI0_MOSI IOID_9 /* RF1.18 */
+#define CC1352R1_LAUNCHXL_SPI0_CLK IOID_10 /* RF1.16 */
+#define CC1352R1_LAUNCHXL_SPI0_CSN IOID_11
+#define CC1352R1_LAUNCHXL_SPI1_MISO PIN_UNASSIGNED
+#define CC1352R1_LAUNCHXL_SPI1_MOSI PIN_UNASSIGNED
+#define CC1352R1_LAUNCHXL_SPI1_CLK PIN_UNASSIGNED
+#define CC1352R1_LAUNCHXL_SPI1_CSN PIN_UNASSIGNED
+
+/* UART Board */
+#define CC1352R1_LAUNCHXL_UART0_RX IOID_12 /* RXD */
+#define CC1352R1_LAUNCHXL_UART0_TX IOID_13 /* TXD */
+#define CC1352R1_LAUNCHXL_UART0_CTS IOID_19 /* CTS */
+#define CC1352R1_LAUNCHXL_UART0_RTS IOID_18 /* RTS */
+#define CC1352R1_LAUNCHXL_UART1_RX PIN_UNASSIGNED
+#define CC1352R1_LAUNCHXL_UART1_TX PIN_UNASSIGNED
+#define CC1352R1_LAUNCHXL_UART1_CTS PIN_UNASSIGNED
+#define CC1352R1_LAUNCHXL_UART1_RTS PIN_UNASSIGNED
+/* For backward compatibility */
+#define CC1352R1_LAUNCHXL_UART_RX CC1352R1_LAUNCHXL_UART0_RX
+#define CC1352R1_LAUNCHXL_UART_TX CC1352R1_LAUNCHXL_UART0_TX
+#define CC1352R1_LAUNCHXL_UART_CTS CC1352R1_LAUNCHXL_UART0_CTS
+#define CC1352R1_LAUNCHXL_UART_RTS CC1352R1_LAUNCHXL_UART0_RTS
+
+/*!
+ * @brief Initialize the general board specific settings
+ *
+ * This function initializes the general board specific settings.
+ */
+void CC1352R1_LAUNCHXL_initGeneral(void);
+
+/*!
+ * @brief Shut down the external flash present on the board files
+ *
+ * This function bitbangs the SPI sequence necessary to turn off
+ * the external flash on LaunchPads.
+ */
+void CC1352R1_LAUNCHXL_shutDownExtFlash(void);
+
+/*!
+ * @brief Wake up the external flash present on the board files
+ *
+ * This function toggles the chip select for the amount of time needed
+ * to wake the chip up.
+ */
+void CC1352R1_LAUNCHXL_wakeUpExtFlash(void);
+
+/*!
+ * @def CC1352R1_LAUNCHXL_ADCBufName
+ * @brief Enum of ADCs
+ */
+typedef enum CC1352R1_LAUNCHXL_ADCBufName {
+ CC1352R1_LAUNCHXL_ADCBUF0 = 0,
+
+ CC1352R1_LAUNCHXL_ADCBUFCOUNT
+} CC1352R1_LAUNCHXL_ADCBufName;
+
+/*!
+ * @def CC1352R1_LAUNCHXL_ADCBuf0SourceName
+ * @brief Enum of ADCBuf channels
+ */
+typedef enum CC1352R1_LAUNCHXL_ADCBuf0ChannelName {
+ CC1352R1_LAUNCHXL_ADCBUF0CHANNEL0 = 0,
+ CC1352R1_LAUNCHXL_ADCBUF0CHANNEL1,
+ CC1352R1_LAUNCHXL_ADCBUF0CHANNEL2,
+ CC1352R1_LAUNCHXL_ADCBUF0CHANNEL3,
+ CC1352R1_LAUNCHXL_ADCBUF0CHANNEL4,
+ CC1352R1_LAUNCHXL_ADCBUF0CHANNEL5,
+ CC1352R1_LAUNCHXL_ADCBUF0CHANNEL6,
+ CC1352R1_LAUNCHXL_ADCBUF0CHANNELVDDS,
+ CC1352R1_LAUNCHXL_ADCBUF0CHANNELDCOUPL,
+ CC1352R1_LAUNCHXL_ADCBUF0CHANNELVSS,
+
+ CC1352R1_LAUNCHXL_ADCBUF0CHANNELCOUNT
+} CC1352R1_LAUNCHXL_ADCBuf0ChannelName;
+
+/*!
+ * @def CC1352R1_LAUNCHXL_ADCName
+ * @brief Enum of ADCs
+ */
+typedef enum CC1352R1_LAUNCHXL_ADCName {
+ CC1352R1_LAUNCHXL_ADC0 = 0,
+ CC1352R1_LAUNCHXL_ADC1,
+ CC1352R1_LAUNCHXL_ADC2,
+ CC1352R1_LAUNCHXL_ADC3,
+ CC1352R1_LAUNCHXL_ADC4,
+ CC1352R1_LAUNCHXL_ADC5,
+ CC1352R1_LAUNCHXL_ADC6,
+ CC1352R1_LAUNCHXL_ADCDCOUPL,
+ CC1352R1_LAUNCHXL_ADCVSS,
+ CC1352R1_LAUNCHXL_ADCVDDS,
+
+ CC1352R1_LAUNCHXL_ADCCOUNT
+} CC1352R1_LAUNCHXL_ADCName;
+
+/*!
+ * @def CC1352R1_LAUNCHXL_ECDHName
+ * @brief Enum of ECDH names
+ */
+typedef enum CC1352R1_LAUNCHXL_ECDHName {
+ CC1352R1_LAUNCHXL_ECDH0 = 0,
+
+ CC1352R1_LAUNCHXL_ECDHCOUNT
+} CC1352R1_LAUNCHXL_ECDHName;
+
+/*!
+ * @def CC1352R1_LAUNCHXL_ECDSAName
+ * @brief Enum of ECDSA names
+ */
+typedef enum CC1352R1_LAUNCHXL_ECDSAName {
+ CC1352R1_LAUNCHXL_ECDSA0 = 0,
+
+ CC1352R1_LAUNCHXL_ECDSACOUNT
+} CC1352R1_LAUNCHXL_ECDSAName;
+
+/*!
+ * @def CC1352R1_LAUNCHXL_ECJPAKEName
+ * @brief Enum of ECJPAKE names
+ */
+typedef enum CC1352R1_LAUNCHXL_ECJPAKEName {
+ CC1352R1_LAUNCHXL_ECJPAKE0 = 0,
+
+ CC1352R1_LAUNCHXL_ECJPAKECOUNT
+} CC1352R1_LAUNCHXL_ECJPAKEName;
+
+/*!
+ * @def CC1352R1_LAUNCHXL_AESCCMName
+ * @brief Enum of AESCCM names
+ */
+typedef enum CC1352R1_LAUNCHXL_AESCCMName {
+ CC1352R1_LAUNCHXL_AESCCM0 = 0,
+
+ CC1352R1_LAUNCHXL_AESCCMCOUNT
+} CC1352R1_LAUNCHXL_AESCCMName;
+
+/*!
+ * @def CC1352R1_LAUNCHXL_AESGCMName
+ * @brief Enum of AESGCM names
+ */
+typedef enum CC1352R1_LAUNCHXL_AESGCMName {
+ CC1352R1_LAUNCHXL_AESGCM0 = 0,
+
+ CC1352R1_LAUNCHXL_AESGCMCOUNT
+} CC1352R1_LAUNCHXL_AESGCMName;
+
+/*!
+ * @def CC1352R1_LAUNCHXL_AESCBCName
+ * @brief Enum of AESCBC names
+ */
+typedef enum CC1352R1_LAUNCHXL_AESCBCName {
+ CC1352R1_LAUNCHXL_AESCBC0 = 0,
+
+ CC1352R1_LAUNCHXL_AESCBCCOUNT
+} CC1352R1_LAUNCHXL_AESCBCName;
+
+/*!
+ * @def CC1352R1_LAUNCHXL_AESCTRName
+ * @brief Enum of AESCTR names
+ */
+typedef enum CC1352R1_LAUNCHXL_AESCTRName {
+ CC1352R1_LAUNCHXL_AESCTR0 = 0,
+
+ CC1352R1_LAUNCHXL_AESCTRCOUNT
+} CC1352R1_LAUNCHXL_AESCTRName;
+
+/*!
+ * @def CC1352R1_LAUNCHXL_AESECBName
+ * @brief Enum of AESECB names
+ */
+typedef enum CC1352R1_LAUNCHXL_AESECBName {
+ CC1352R1_LAUNCHXL_AESECB0 = 0,
+
+ CC1352R1_LAUNCHXL_AESECBCOUNT
+} CC1352R1_LAUNCHXL_AESECBName;
+
+/*!
+ * @def CC1352R1_LAUNCHXL_AESCTRDRBGName
+ * @brief Enum of AESCTRDRBG names
+ */
+typedef enum CC1352R1_LAUNCHXL_AESCTRDRBGName {
+ CC1352R1_LAUNCHXL_AESCTRDRBG0 = 0,
+
+ CC1352R1_LAUNCHXL_AESCTRDRBGCOUNT
+} CC1352R1_LAUNCHXL_AESCTRDRBGName;
+
+/*!
+ * @def CC1352R1_LAUNCHXL_SHA2Name
+ * @brief Enum of SHA2 names
+ */
+typedef enum CC1352R1_LAUNCHXL_SHA2Name {
+ CC1352R1_LAUNCHXL_SHA20 = 0,
+
+ CC1352R1_LAUNCHXL_SHA2COUNT
+} CC1352R1_LAUNCHXL_SHA2Name;
+
+/*!
+ * @def CC1352R1_LAUNCHXL_TRNGName
+ * @brief Enum of TRNG names
+ */
+typedef enum CC1352R1_LAUNCHXL_TRNGName {
+ CC1352R1_LAUNCHXL_TRNG0 = 0,
+
+ CC1352R1_LAUNCHXL_TRNGCOUNT
+} CC1352R1_LAUNCHXL_TRNGName;
+
+/*!
+ * @def CC1352R1_LAUNCHXL_GPIOName
+ * @brief Enum of GPIO names
+ */
+typedef enum CC1352R1_LAUNCHXL_GPIOName {
+ CC1352R1_LAUNCHXL_GPIO_S1 = 0,
+ CC1352R1_LAUNCHXL_GPIO_S2,
+ CC1352R1_LAUNCHXL_SPI_MASTER_READY,
+ CC1352R1_LAUNCHXL_SPI_SLAVE_READY,
+ CC1352R1_LAUNCHXL_GPIO_LED_GREEN,
+ CC1352R1_LAUNCHXL_GPIO_LED_RED,
+ CC1352R1_LAUNCHXL_GPIO_TMP116_EN,
+ CC1352R1_LAUNCHXL_GPIO_SPI_FLASH_CS,
+ CC1352R1_LAUNCHXL_SDSPI_CS,
+ CC1352R1_LAUNCHXL_GPIO_LCD_CS,
+ CC1352R1_LAUNCHXL_GPIO_LCD_POWER,
+ CC1352R1_LAUNCHXL_GPIO_LCD_ENABLE,
+ CC1352R1_LAUNCHXL_GPIOCOUNT
+} CC1352R1_LAUNCHXL_GPIOName;
+
+/*!
+ * @def CC1352R1_LAUNCHXL_GPTimerName
+ * @brief Enum of GPTimer parts
+ */
+typedef enum CC1352R1_LAUNCHXL_GPTimerName {
+ CC1352R1_LAUNCHXL_GPTIMER0A = 0,
+ CC1352R1_LAUNCHXL_GPTIMER0B,
+ CC1352R1_LAUNCHXL_GPTIMER1A,
+ CC1352R1_LAUNCHXL_GPTIMER1B,
+ CC1352R1_LAUNCHXL_GPTIMER2A,
+ CC1352R1_LAUNCHXL_GPTIMER2B,
+ CC1352R1_LAUNCHXL_GPTIMER3A,
+ CC1352R1_LAUNCHXL_GPTIMER3B,
+
+ CC1352R1_LAUNCHXL_GPTIMERPARTSCOUNT
+} CC1352R1_LAUNCHXL_GPTimerName;
+
+/*!
+ * @def CC1352R1_LAUNCHXL_GPTimers
+ * @brief Enum of GPTimers
+ */
+typedef enum CC1352R1_LAUNCHXL_GPTimers {
+ CC1352R1_LAUNCHXL_GPTIMER0 = 0,
+ CC1352R1_LAUNCHXL_GPTIMER1,
+ CC1352R1_LAUNCHXL_GPTIMER2,
+ CC1352R1_LAUNCHXL_GPTIMER3,
+
+ CC1352R1_LAUNCHXL_GPTIMERCOUNT
+} CC1352R1_LAUNCHXL_GPTimers;
+
+/*!
+ * @def CC1352R1_LAUNCHXL_I2CName
+ * @brief Enum of I2C names
+ */
+typedef enum CC1352R1_LAUNCHXL_I2CName {
+ CC1352R1_LAUNCHXL_I2C0 = 0,
+
+ CC1352R1_LAUNCHXL_I2CCOUNT
+} CC1352R1_LAUNCHXL_I2CName;
+
+/*!
+ * @def CC1352R1_LAUNCHXL_I2SName
+ * @brief Enum of I2S names
+ */
+typedef enum CC1352R1_LAUNCHXL_I2SName {
+ CC1352R1_LAUNCHXL_I2S0 = 0,
+
+ CC1352R1_LAUNCHXL_I2SCOUNT
+} CC1352R1_LAUNCHXL_I2SName;
+
+/*!
+ * @def CC1352R1_LAUNCHXL_PDMName
+ * @brief Enum of I2S names
+ */
+typedef enum CC1352R1_LAUNCHXL_PDMCOUNT {
+ CC1352R1_LAUNCHXL_PDM0 = 0,
+
+ CC1352R1_LAUNCHXL_PDMCOUNT
+} CC1352R1_LAUNCHXL_PDMName;
+
+/*!
+ * @def CC1352R1_LAUNCHXL_NVSName
+ * @brief Enum of NVS names
+ */
+typedef enum CC1352R1_LAUNCHXL_NVSName {
+#ifndef Board_EXCLUDE_NVS_INTERNAL_FLASH
+ CC1352R1_LAUNCHXL_NVSCC26XX0 = 0,
+#endif
+#ifndef Board_EXCLUDE_NVS_EXTERNAL_FLASH
+ CC1352R1_LAUNCHXL_NVSSPI25X0,
+#endif
+
+ CC1352R1_LAUNCHXL_NVSCOUNT
+} CC1352R1_LAUNCHXL_NVSName;
+
+/*!
+ * @def CC1352R1_LAUNCHXL_PWM
+ * @brief Enum of PWM outputs
+ */
+typedef enum CC1352R1_LAUNCHXL_PWMName {
+ CC1352R1_LAUNCHXL_PWM0 = 0,
+ CC1352R1_LAUNCHXL_PWM1,
+ CC1352R1_LAUNCHXL_PWM2,
+ CC1352R1_LAUNCHXL_PWM3,
+ CC1352R1_LAUNCHXL_PWM4,
+ CC1352R1_LAUNCHXL_PWM5,
+ CC1352R1_LAUNCHXL_PWM6,
+ CC1352R1_LAUNCHXL_PWM7,
+
+ CC1352R1_LAUNCHXL_PWMCOUNT
+} CC1352R1_LAUNCHXL_PWMName;
+
+/*!
+ * @def CC1352R1_LAUNCHXL_SDName
+ * @brief Enum of SD names
+ */
+typedef enum CC1352R1_LAUNCHXL_SDName {
+ CC1352R1_LAUNCHXL_SDSPI0 = 0,
+
+ CC1352R1_LAUNCHXL_SDCOUNT
+} CC1352R1_LAUNCHXL_SDName;
+
+/*!
+ * @def CC1352R1_LAUNCHXL_SPIName
+ * @brief Enum of SPI names
+ */
+typedef enum CC1352R1_LAUNCHXL_SPIName {
+ CC1352R1_LAUNCHXL_SPI0 = 0,
+ CC1352R1_LAUNCHXL_SPI1,
+
+ CC1352R1_LAUNCHXL_SPICOUNT
+} CC1352R1_LAUNCHXL_SPIName;
+
+/*!
+ * @def CC1352R1_LAUNCHXL_UARTName
+ * @brief Enum of UARTs
+ */
+typedef enum CC1352R1_LAUNCHXL_UARTName {
+ CC1352R1_LAUNCHXL_UART0 = 0,
+ CC1352R1_LAUNCHXL_UART1,
+
+ CC1352R1_LAUNCHXL_UARTCOUNT
+} CC1352R1_LAUNCHXL_UARTName;
+
+/*!
+ * @def CC1352R1_LAUNCHXL_UDMAName
+ * @brief Enum of DMA buffers
+ */
+typedef enum CC1352R1_LAUNCHXL_UDMAName {
+ CC1352R1_LAUNCHXL_UDMA0 = 0,
+
+ CC1352R1_LAUNCHXL_UDMACOUNT
+} CC1352R1_LAUNCHXL_UDMAName;
+
+/*!
+ * @def CC1352R1_LAUNCHXL_WatchdogName
+ * @brief Enum of Watchdogs
+ */
+typedef enum CC1352R1_LAUNCHXL_WatchdogName {
+ CC1352R1_LAUNCHXL_WATCHDOG0 = 0,
+
+ CC1352R1_LAUNCHXL_WATCHDOGCOUNT
+} CC1352R1_LAUNCHXL_WatchdogName;
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CC1352R1_LAUNCHXL_BOARD_H__ */
diff --git a/samples/rfBleConnect/src/CC1352R1_LAUNCHXL_fxns.c b/samples/rfBleConnect/src/CC1352R1_LAUNCHXL_fxns.c
new file mode 100644
index 0000000000..bdf2960ec8
--- /dev/null
+++ b/samples/rfBleConnect/src/CC1352R1_LAUNCHXL_fxns.c
@@ -0,0 +1,157 @@
+/*
+ * Copyright (c) 2018-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.
+ */
+
+/*
+ * ======== CC1352R1_LAUNCHXL_fxns.c ========
+ * This file contains the board-specific initialization functions, and
+ * RF callback function for antenna switching.
+ */
+
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+
+#include <ti/devices/cc13x2_cc26x2/driverlib/ioc.h>
+#include <ti/devices/cc13x2_cc26x2/driverlib/cpu.h>
+#include <ti/drivers/rf/RF.h>
+#include <ti/drivers/pin/PINCC26XX.h>
+
+#include <ti/drivers/Board.h>
+
+/*
+ * ======== CC1352R1_LAUNCHXL_sendExtFlashByte ========
+ */
+void CC1352R1_LAUNCHXL_sendExtFlashByte(PIN_Handle pinHandle, uint8_t byte)
+{
+ uint8_t i;
+
+ /* SPI Flash CS */
+ PIN_setOutputValue(pinHandle, IOID_20, 0);
+
+ for (i = 0; i < 8; i++) {
+ PIN_setOutputValue(pinHandle, IOID_10, 0); /* SPI Flash CLK */
+
+ /* SPI Flash MOSI */
+ PIN_setOutputValue(pinHandle, IOID_9, (byte >> (7 - i)) & 0x01);
+ PIN_setOutputValue(pinHandle, IOID_10, 1); /* SPI Flash CLK */
+
+ /*
+ * Waste a few cycles to keep the CLK high for at
+ * least 45% of the period.
+ * 3 cycles per loop: 8 loops @ 48 Mhz = 0.5 us.
+ */
+ CPUdelay(8);
+ }
+
+ PIN_setOutputValue(pinHandle, IOID_10, 0); /* CLK */
+ PIN_setOutputValue(pinHandle, IOID_20, 1); /* CS */
+
+ /*
+ * Keep CS high at least 40 us
+ * 3 cycles per loop: 700 loops @ 48 Mhz ~= 44 us
+ */
+ CPUdelay(700);
+}
+
+/*
+ * ======== CC1352R1_LAUNCHXL_wakeUpExtFlash ========
+ */
+void CC1352R1_LAUNCHXL_wakeUpExtFlash(void)
+{
+ PIN_Config extFlashPinTable[] = {
+ /* SPI Flash CS */
+ IOID_20 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL |
+ PIN_INPUT_DIS | PIN_DRVSTR_MED,
+ PIN_TERMINATE
+ };
+ PIN_State extFlashPinState;
+ PIN_Handle extFlashPinHandle = PIN_open(&extFlashPinState, extFlashPinTable);
+
+ /*
+ * To wake up we need to toggle the chip select at
+ * least 20 ns and ten wait at least 35 us.
+ */
+
+ /* Toggle chip select for ~20ns to wake ext. flash */
+ PIN_setOutputValue(extFlashPinHandle, IOID_20, 0);
+ /* 3 cycles per loop: 1 loop @ 48 Mhz ~= 62 ns */
+ CPUdelay(1);
+ PIN_setOutputValue(extFlashPinHandle, IOID_20, 1);
+ /* 3 cycles per loop: 560 loops @ 48 Mhz ~= 35 us */
+ CPUdelay(560);
+
+ PIN_close(extFlashPinHandle);
+}
+
+/*
+ * ======== CC1352R1_LAUNCHXL_shutDownExtFlash ========
+ */
+void CC1352R1_LAUNCHXL_shutDownExtFlash(void)
+{
+ /*
+ * To be sure we are putting the flash into sleep and not waking it,
+ * we first have to make a wake up call
+ */
+ CC1352R1_LAUNCHXL_wakeUpExtFlash();
+
+ PIN_Config extFlashPinTable[] = {
+ /* SPI Flash CS*/
+ IOID_20 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL |
+ PIN_INPUT_DIS | PIN_DRVSTR_MED,
+ /* SPI Flash CLK */
+ IOID_10 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL |
+ PIN_INPUT_DIS | PIN_DRVSTR_MED,
+ /* SPI Flash MOSI */
+ IOID_9 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL |
+ PIN_INPUT_DIS | PIN_DRVSTR_MED,
+ /* SPI Flash MISO */
+ IOID_8 | PIN_INPUT_EN | PIN_PULLDOWN,
+ PIN_TERMINATE
+ };
+ PIN_State extFlashPinState;
+ PIN_Handle extFlashPinHandle = PIN_open(&extFlashPinState, extFlashPinTable);
+
+ uint8_t extFlashShutdown = 0xB9;
+
+ CC1352R1_LAUNCHXL_sendExtFlashByte(extFlashPinHandle, extFlashShutdown);
+
+ PIN_close(extFlashPinHandle);
+}
+
+/*
+ * ======== Board_initHook ========
+ * Called by Board_init() to perform board-specific initialization.
+ */
+void Board_initHook()
+{
+ CC1352R1_LAUNCHXL_shutDownExtFlash();
+}
diff --git a/samples/rfBleConnect/src/NoRTOS.h b/samples/rfBleConnect/src/NoRTOS.h
new file mode 100644
index 0000000000..e5ebebbddb
--- /dev/null
+++ b/samples/rfBleConnect/src/NoRTOS.h
@@ -0,0 +1,187 @@
+/*
+ * Copyright (c) 2017, 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.
+ */
+/*!*****************************************************************************
+ * @file NoRTOS.h
+ *
+ * @brief NoRTOS framework module
+ *
+ * The NoRTOS header file should be included in an application as follows:
+ * @code
+ * #include <NoRTOS.h>
+ * @endcode
+ *
+ * # Overview #
+ *
+ * The NoRTOS framework module controls various aspects of the application's
+ * behavior with respect to the TI Driver interfaces that are used by the
+ * application.
+ *
+ * Some TI Drivers make use of an internal Clock module that offers timing
+ * services to the drivers, based on a Clock "tick" which operates at a
+ * frequency based on a configured period. This period can be configured
+ * per application requirements through the NoRTOS module, although the
+ * default setting might be required by certain TI Drivers that assume a
+ * certain Clock tick frequency.
+ *
+ * Some TI Drivers make use of an internal Swi (Software interrupt) module
+ * that offers a scheduling paradigm that lies between an application's
+ * 'main' thread and hardware interrupts. The internal Swi implementation
+ * utilizes a software-triggered-only hardware interrupt for achieving this
+ * mid-level scheduling paradigm. This hardware interrupt can be configured
+ * per application requirements through the NoRTOS module, although the
+ * default setting is likely what should be used.
+ *
+ * Some TI Drivers will "suspend" the application's operation until a certain
+ * event occurs. When an application is running in the NoRTOS framework
+ * there are no other "threads" to run when the 'main' thread becomes
+ * suspended, which in essence implies that the application has entered an
+ * 'idle' mode. An 'idle callback' function is called when this 'idle' mode
+ * has been entered. This callback function can be configured per the
+ * application requirements through the NoRTOS module, although the default
+ * setting is likely what should be used.
+ *
+ * # Usage #
+ *
+ * The NoRTOS module contains the following APIs:
+ * - NoRTOS_getConfig(): Retrieve the current NoRTOS configuration values.
+ * - NoRTOS_setConfig(): Set NoRTOS configuration values.
+ * - NoRTOS_start(): Enable NoRTOS system operation (required).
+ *
+ * ### NoRTOS Framework Configuration #
+ *
+ * The NoRTOS framework utilizes a few settings that the application should
+ * be able to control so as to accommodate the unique needs of the
+ * application or the system upon which the application runs. It is expected
+ * that the default values of these settings will suffice for the majority of
+ * applications using the NoRTOS framework. These default values should be
+ * of no concern to most applications since the aspects they control are
+ * internal to the TI Drivers' operation, but system requirements or other
+ * code that is being integrated with the application could require different
+ * values. The NoRTOS configuration functions offer this capability to the
+ * application. Please refer to the documentation for the NoRTOS_Config
+ * structure for details on each configuration element.
+ *
+ * ### Starting the NoRTOS framework operation #
+ *
+ * Realtime systems often require precise timing when enabling certain
+ * aspects of the system. If some part of the system is enabled too early
+ * then other parts of the system may not operate correctly. Certain system
+ * elements need to be setup and initialized before other elements will
+ * operate correctly.
+ *
+ * The NoRTOS_start() API allows the application to control when the system
+ * as a whole should be "started". NoRTOS_start() *must* be called for
+ * the system to start, and should be called after all TI Driver and
+ * peripheral initialization has been performed.
+ *
+ * ### Example usage #
+ *
+ * @code
+ * #include <NoRTOS.h>
+
+ * int main(int argc, char *argv[])
+ * {
+ * NoRTOS_Config cfg;
+ *
+ * // Get current values of all configuration settings
+ * NoRTOS_getConfig(&cfg);
+ *
+ * // Change config settings we want to change while leaving other
+ * // settings at their default values ...
+ *
+ * // Change system "tick" frequency to 10,000 Hz
+ * cfg.clockTickPeriod = 100;
+ *
+ * // Change interrupt used for Swi scheduling to 11 (SVCall)
+ * cfg.swiIntNum = 11;
+ *
+ * // Affect the changes
+ * NoRTOS_setConfig(&cfg);
+ *
+ * `perform board and driver initialization`;
+ *
+ * // Start NoRTOS
+ * NoRTOS_start();
+ *
+ * // Call mainThread function
+ * mainThread(NULL);
+ * }
+ * @endcode
+ *
+ *******************************************************************************
+ */
+
+/*!
+ * @brief NoRTOS framework global configuration
+ *
+ * The NoRTOS_Config structure contains a set of values utilized by the
+ * NoRTOS framework.
+ *
+ * The NoRTOS_getConfig() API can be used to retrieve the current settings.
+ * When changing one or more of these settings, a NoRTOS_Config structure
+ * should first be populated with the current settings by calling
+ * NoRTOS_getConfig(), after which the particular setting(s) that needs to be
+ * changed should be set and given to the NoRTOS framework by calling
+ * NoRTOS_setConfig().
+ */
+typedef struct _NoRTOS_Config {
+ /*! Function that is called when a TI Driver "suspends" its operation */
+ void (*idleCallback)(void);
+
+ /*! Period of the internal Clock module's periodic "tick" (microsecs) */
+ uint32_t clockTickPeriod;
+
+ /*! Hardware interrupt posted by software to achieve the Swi (Software
+ interrupt) scheduling paradigm */
+ int swiIntNum;
+} NoRTOS_Config;
+
+/*!
+ * @brief Function to retrieve current NoRTOS configuration values
+ *
+ * @param cfg Pointer to a NoRTOS_Config structure in which to store
+ * the current configuration values
+ */
+void NoRTOS_getConfig(NoRTOS_Config *cfg);
+
+/*!
+ * @brief Function to set or modify NoRTOS configuration values
+ *
+ * @param cfg Pointer to a NoRTOS_Config structure from which NoRTOS
+ * configuration values are set
+ */
+void NoRTOS_setConfig(NoRTOS_Config *cfg);
+
+/*
+ * @brief Function to call for enabling NoRTOS system operation
+ */
+void NoRTOS_start();
diff --git a/samples/rfBleConnect/src/RFQueue.c b/samples/rfBleConnect/src/RFQueue.c
new file mode 100644
index 0000000000..52a68ad081
--- /dev/null
+++ b/samples/rfBleConnect/src/RFQueue.c
@@ -0,0 +1,133 @@
+/******************************************************************************
+* Filename: rf_queue.c
+* Revised: $ $
+* Revision: $ $
+*
+* Description: Help functions for handling queues
+*
+* Copyright (C) 2015-2017 Texas Instruments Incorporated - http://www.ti.com/
+*
+*
+* 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.
+*
+******************************************************************************/
+/* Standard C Libraries */
+#include <stdint.h>
+#include <stdlib.h>
+
+/* Application Header files */
+#include "RFQueue.h"
+#include <ti/devices/DeviceFamily.h>
+#include DeviceFamily_constructPath(driverlib/rf_data_entry.h)
+
+/* Receive entry pointer to keep track of read items */
+rfc_dataEntryGeneral_t* readEntry;
+
+//*****************************************************************************
+//
+//! Get the current dataEntry
+//!
+//! \return rfc_dataEntry*
+//
+//*****************************************************************************
+rfc_dataEntryGeneral_t*
+RFQueue_getDataEntry()
+{
+ return (readEntry);
+}
+
+//*****************************************************************************
+//
+//! Move to next dataEntry
+//!
+//! \return None
+//
+//*****************************************************************************
+uint8_t
+RFQueue_nextEntry()
+{
+ /* Set status to pending */
+ readEntry->status = DATA_ENTRY_PENDING;
+
+ /* Move read entry pointer to next entry */
+ readEntry = (rfc_dataEntryGeneral_t*)readEntry->pNextEntry;
+
+ return (readEntry->status);
+}
+
+//*****************************************************************************
+//
+//! Define a queue
+//!
+//! \param dataQueue is a pointer to the queue to use
+//! \param buf is the prealocated byte buffer to use
+//! \param buf_len is the number of preallocated bytes
+//! \param numEntries are the number of dataEntries to split the buffer into
+//! \param length is the length of data in every dataEntry
+//!
+//! \return uint8_t
+//
+//*****************************************************************************
+uint8_t
+RFQueue_defineQueue(dataQueue_t *dataQueue, uint8_t *buf, uint16_t buf_len, uint8_t numEntries, uint16_t length)
+{
+
+ if (buf_len < (numEntries * (length + RF_QUEUE_DATA_ENTRY_HEADER_SIZE + RF_QUEUE_QUEUE_ALIGN_PADDING(length))))
+ {
+ /* queue does not fit into buffer */
+ return (1);
+ }
+
+ /* Padding needed for 4-byte alignment? */
+ uint8_t pad = 4-((length + RF_QUEUE_DATA_ENTRY_HEADER_SIZE)%4);
+
+ /* Set the Data Entries common configuration */
+ uint8_t *first_entry = buf;
+ int i;
+ for (i = 0; i < numEntries; i++)
+ {
+ buf = first_entry + i * (RF_QUEUE_DATA_ENTRY_HEADER_SIZE + length + pad);
+ ((rfc_dataEntry_t*)buf)->status = DATA_ENTRY_PENDING; // Pending - starting state
+ ((rfc_dataEntry_t*)buf)->config.type = DATA_ENTRY_TYPE_GEN; // General Data Entry
+ ((rfc_dataEntry_t*)buf)->config.lenSz = 0; // No length indicator byte in data
+ ((rfc_dataEntry_t*)buf)->length = length; // Total length of data field
+
+ ((rfc_dataEntryGeneral_t*)buf)->pNextEntry = &(((rfc_dataEntryGeneral_t*)buf)->data)+length+pad;
+ }
+ /* Make circular Last.Next -> First */
+ ((rfc_dataEntry_t*)buf)->pNextEntry = first_entry;
+
+ /* Create Data Entry Queue and configure for circular buffer Data Entries */
+ dataQueue->pCurrEntry = first_entry;
+ dataQueue->pLastEntry = NULL;
+
+ /* Set read pointer to first entry */
+ readEntry = (rfc_dataEntryGeneral_t*)first_entry;
+
+ return (0);
+}
diff --git a/samples/rfBleConnect/src/RFQueue.h b/samples/rfBleConnect/src/RFQueue.h
new file mode 100644
index 0000000000..8737c6616d
--- /dev/null
+++ b/samples/rfBleConnect/src/RFQueue.h
@@ -0,0 +1,74 @@
+/******************************************************************************
+* Filename: rf_queue.h
+* Revised: $ $
+* Revision: $ $
+*
+* Description: Help functions for handling queues
+*
+* Copyright (C) 2015-2017 Texas Instruments Incorporated - http://www.ti.com/
+*
+*
+* 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.
+*
+******************************************************************************/
+
+//*****************************************************************************
+//
+//! \addtogroup rfqueue_api
+//! @{
+//
+//*****************************************************************************
+
+#ifndef RF_QUEUE_H
+#define RF_QUEUE_H
+
+#ifndef DeviceFamily_CC13X2
+#define DeviceFamily_CC13X2
+#endif
+#include <ti/devices/DeviceFamily.h>
+#include DeviceFamily_constructPath(driverlib/rf_data_entry.h)
+
+#define RF_QUEUE_DATA_ENTRY_HEADER_SIZE 8 // Contant header size of a Generic Data Entry
+
+#define RF_QUEUE_QUEUE_ALIGN_PADDING(length) (4-((length + RF_QUEUE_DATA_ENTRY_HEADER_SIZE)%4)) // Padding offset
+
+#define RF_QUEUE_DATA_ENTRY_BUFFER_SIZE(numEntries, dataSize, appendedBytes) \
+(numEntries*(RF_QUEUE_DATA_ENTRY_HEADER_SIZE + dataSize + appendedBytes + RF_QUEUE_QUEUE_ALIGN_PADDING(dataSize + appendedBytes)))
+
+extern uint8_t RFQueue_nextEntry();
+extern rfc_dataEntryGeneral_t* RFQueue_getDataEntry();
+extern uint8_t RFQueue_defineQueue(dataQueue_t *queue ,uint8_t *buf, uint16_t buf_len, uint8_t numEntries, uint16_t length);
+
+#endif
+
+//*****************************************************************************
+//
+//! Close the Doxygen group.
+//! @}
+//
+//*****************************************************************************
diff --git a/samples/rfBleConnect/src/ccfg.c b/samples/rfBleConnect/src/ccfg.c
new file mode 100644
index 0000000000..8890e81178
--- /dev/null
+++ b/samples/rfBleConnect/src/ccfg.c
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2015-2017, 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.
+ */
+
+/*
+ * ======== ccfg.c ========
+ * Customer Configuration for CC26xx and CC13xx devices. This file is used to
+ * configure Boot ROM, start-up code, and SW radio behaviour.
+ *
+ * By default, driverlib startup_files/ccfg.c settings are used. However, if
+ * changes are required there are two means to do so:
+ *
+ * 1. Remove this file and copy driverlib's startup_files/ccfg.c file in
+ * its place. Make all changes to the file. Changes made are local to
+ * the project and will not affect other projects.
+ *
+ * 2. Perform changes to driverlib startup_files/ccfg.c file. Changes
+ * made to this file will be applied to all projects. This file must
+ * remain unmodified.
+ */
+
+#include <ti/devices/DeviceFamily.h>
+#include DeviceFamily_constructPath(startup_files/ccfg.c)
diff --git a/samples/rfBleConnect/src/config.c b/samples/rfBleConnect/src/config.c
new file mode 100644
index 0000000000..1b4d95f494
--- /dev/null
+++ b/samples/rfBleConnect/src/config.c
@@ -0,0 +1,113 @@
+/*
+#include <config.h>
+
+ * Copyright (c) 2016-2018, 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 "config.h"
+
+/* Application specific Header files */
+
+/*
+The values have been generated
+with RF studio and are used to overwrite the CMD_FS
+from smartrf_settings.c
+*/
+
+const FrequencyTableEntry config_frequencyTable_ble[] =
+{
+ { "2402 ", 0x0962, 0x0000, 0x65 },
+ { "2404 ", 0x0964, 0x0000, 0x40 },
+ { "2406 ", 0x0966, 0x0000, 0x41 },
+ { "2408 ", 0x0968, 0x0000, 0x42 },
+ { "2410 ", 0x096a, 0x0000, 0x43 },
+ { "2412 ", 0x096c, 0x0000, 0x44 },
+ { "2414 ", 0x096e, 0x0000, 0x45 },
+ { "2416 ", 0x0970, 0x0000, 0x46 },
+ { "2418 ", 0x0972, 0x0000, 0x47 },
+ { "2420 ", 0x0974, 0x0000, 0x48 },
+ { "2422 ", 0x0976, 0x0000, 0x49 },
+ { "2424 ", 0x0978, 0x0000, 0x4a },
+ { "2426 ", 0x097a, 0x0000, 0x66 },
+ { "2428 ", 0x097c, 0x0000, 0x4b },
+ { "2430 ", 0x097e, 0x0000, 0x4c },
+ { "2432 ", 0x0980, 0x0000, 0x4d },
+ { "2434 ", 0x0982, 0x0000, 0x4e },
+ { "2436 ", 0x0984, 0x0000, 0x4f },
+ { "2438 ", 0x0986, 0x0000, 0x50 },
+ { "2440 ", 0x0988, 0x0000, 0x51 },
+ { "2442 ", 0x098a, 0x0000, 0x52 },
+ { "2444 ", 0x098c, 0x0000, 0x53 },
+ { "2446 ", 0x098e, 0x0000, 0x54 },
+ { "2448 ", 0x0990, 0x0000, 0x55 },
+ { "2480 ", 0x0992, 0x0000, 0x56 },
+ { "2452 ", 0x0994, 0x0000, 0x57 },
+ { "2454 ", 0x0996, 0x0000, 0x58 },
+ { "2456 ", 0x0998, 0x0000, 0x59 },
+ { "2458 ", 0x099a, 0x0000, 0x5a },
+ { "2460 ", 0x099c, 0x0000, 0x5b },
+ { "2462 ", 0x099e, 0x0000, 0x5c },
+ { "2464 ", 0x09a0, 0x0000, 0x5d },
+ { "2466 ", 0x09a2, 0x0000, 0x5e },
+ { "2468 ", 0x09a4, 0x0000, 0x5f },
+ { "2470 ", 0x09a6, 0x0000, 0x60 },
+ { "2472 ", 0x09a8, 0x0000, 0x61 },
+ { "2474 ", 0x09aa, 0x0000, 0x62 },
+ { "2476 ", 0x09ac, 0x0000, 0x63 },
+ { "2478 ", 0x09ae, 0x0000, 0x64 },
+ { "2480 ", 0x09b0, 0x0000, 0x67 },
+ { "", 0xFFFF, 0, 0 }, //Freq of 0xFFFF indicates the end of the table
+};
+
+const u32_t config_payloadLengthTable[] =
+{
+ 30,
+};
+
+FrequencyTableEntry* config_frequencyTable_Lut[] =
+{
+ (FrequencyTableEntry *)config_frequencyTable_ble, // RfSetup_Ble
+ (FrequencyTableEntry *)config_frequencyTable_ble // RfSetup_Ble5
+};
+
+const char* const config_testmodeLabels[] =
+{
+ "Scanner", // Rx
+ "Advertiser", // Tx
+};
+
+const char* const config_rfSetupLabels[] =
+{
+ "BLE Mode ",
+ "BLE5 Mode"
+};
diff --git a/samples/rfBleConnect/src/config.h b/samples/rfBleConnect/src/config.h
new file mode 100644
index 0000000000..cf4bed03af
--- /dev/null
+++ b/samples/rfBleConnect/src/config.h
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2016-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.
+ */
+
+#ifndef RF_BLE_CONNECT_CONFIG_H
+#define RF_BLE_CONNECT_CONFIG_H
+
+#include <zephyr/types.h>
+
+#ifndef Board_CC1352R1_LAUNCHXL
+#define Board_CC1352R1_LAUNCHXL
+#endif
+
+#include "Board.h"
+
+/* This file defines data types and variables for the application configuration */
+
+/* PER version */
+#define BLEC_VERSION "Ver 0.1"
+
+/*
+RF basic settings as found in the typical settings section of Smart RF Studio.
+Each one defines a test case in this application.
+*/
+typedef enum
+{
+ RfSetup_Ble = 0, // BLE
+ RfSetup_Ble5, // BLE5
+ NrOfRfSetups
+} RfSetup;
+
+/* Whether the application works as sender or receiver */
+typedef enum
+{
+ TestMode_Rx = 0,
+ TestMode_Tx,
+ NrOfTestModes
+} TestMode;
+
+/* Contains a pre-defined setting for frequency selection */
+typedef struct
+{
+ const char* const label;
+ const u16_t frequency;
+ const u16_t fractFreq;
+ const u8_t whitening; // BLE has freq dependent whitening settings
+} FrequencyTableEntry;
+
+/*
+Holds the application config that is prepared in the menu and
+used in the rx and tx functions.
+*/
+typedef struct
+{
+ RfSetup rfSetup; // Test case index
+ TestMode testMode; // TX/RX mode index
+ u32_t packetCount;
+ u32_t payloadLength; // Desired payload length (bytes)
+ FrequencyTableEntry* frequencyTable; // FrequencyTable for this test case
+ u8_t frequency; // Index in config_frequencyTable
+} ApplicationConfig;
+
+extern FrequencyTableEntry* config_frequencyTable_Lut[]; // Lookup table for freq table
+extern const char* const config_testmodeLabels[]; // Lookup table for operation mode labels
+extern const char* const config_rfSetupLabels[]; // Lookup table for RfSetup labels
+extern const u32_t config_payloadLengthTable[]; // Lookup table for different payload length options
+
+#endif /* RF_BLE_CONNECT_CONFIG_H */
diff --git a/samples/rfBleConnect/src/main_nortos.c b/samples/rfBleConnect/src/main_nortos.c
new file mode 100644
index 0000000000..562962d17c
--- /dev/null
+++ b/samples/rfBleConnect/src/main_nortos.c
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2017, 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.
+ */
+
+/*
+ * ======== main_nortos.c ========
+ */
+#include <stdint.h>
+#include <stddef.h>
+
+#include "NoRTOS.h"
+
+/* Example/Board Header files */
+#include "Board.h"
+
+extern void *mainThread(void *arg0);
+
+/*
+ * ======== main ========
+ */
+int main(void)
+{
+ /* Call driver init functions */
+ //Board_initGeneral();
+
+ /* Start NoRTOS */
+ //NoRTOS_start();
+
+ /* Call mainThread function */
+ mainThread(NULL);
+
+ while (1);
+}
diff --git a/samples/rfBleConnect/src/menu.h b/samples/rfBleConnect/src/menu.h
new file mode 100644
index 0000000000..b7a1ceb595
--- /dev/null
+++ b/samples/rfBleConnect/src/menu.h
@@ -0,0 +1,109 @@
+/*
+
+ * Copyright (c) 2016-2018, 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.
+ */
+#ifndef MENU_H
+#define MENU_H
+
+#include <zephyr/types.h>
+
+#include "Board.h"
+#include "config.h"
+
+/* Contains the outcome of a test case execution */
+typedef enum
+{
+ TestResult_Aborted = 0,
+ TestResult_Finished
+} TestResult;
+
+/* Button identifiers */
+typedef enum
+{
+ Button_Navigate = Board_PIN_BUTTON0,
+ Button_Select = Board_PIN_BUTTON1
+} Button;
+
+/* Rx Operation Metrics */
+typedef struct _rx_metrics_{
+ u32_t packetsReceived; // Number of packets recevied
+ u32_t packetsMissed; // Number of packets missed (missing sequence numbers)
+ u32_t packetsExpected; // Last received packet number during Rx OR
+ // configured packet count after Rx Timeout
+ u32_t nRxTimeouts; // Number of timeout events
+ u16_t nPktsPerTimeout; // Each timeout is a certain number of packet intervals long
+ s8_t rssi; // Last reported RSSI (last packet sync)
+ u16_t crcOK; // CRC status of the received packet
+ u32_t throughput; // Integer throughput calculated
+}rx_metrics;
+
+/* Tx Operation Metrics */
+typedef struct _tx_metrics_{
+ u16_t nTxAdvInd;
+ u8_t nTxScanRsp;
+ u8_t nRxScanReq;
+ u8_t nRxConnectReq;
+ u8_t nTxConnectRsp;
+ u16_t nRxNok;
+ u16_t nRxIgnored;
+ u8_t nRxBufFull;
+ s8_t lastRssi;
+ u32_t timeStamp;
+}tx_metrics;
+
+void menu_clear();
+
+/* Sets up tasks and kernel resources */
+void menu_init();
+
+/* Returns true if a button has been pressed (non-blocking) */
+bool menu_isButtonPressed();
+
+/* Callback for button interrupts */
+void menu_notifyButtonPressed(Button button);
+
+/* Callback for the communication task */
+void menu_updateRxScreen(rx_metrics *metrics);
+
+/* Callback for the communication task */
+void menu_updateTxScreen(u32_t packetsSent);
+
+/* Callback for the communication task to update the transmission metrics */
+void menu_updateTxMetricScreen(tx_metrics *metrics);
+
+/*
+Receive and transmit functions
+The definitions are provided in separate source files.
+*/
+TestResult rx_runRxTest(const ApplicationConfig* config);
+TestResult tx_runTxTest(const ApplicationConfig* config);
+
+#endif
diff --git a/samples/rfBleConnect/src/menu_nortos.c b/samples/rfBleConnect/src/menu_nortos.c
new file mode 100644
index 0000000000..642d8622d5
--- /dev/null
+++ b/samples/rfBleConnect/src/menu_nortos.c
@@ -0,0 +1,427 @@
+/*
+ * Copyright (c) 2016-2018, 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 *****/
+/* Standard C Libraries */
+#include <stddef.h>
+
+#include <sys/printk.h>
+
+#define Display_clear(handle) printk("\x1b[2J\x1b[H")
+#define Display_printf(handle, row, col, fmt, args...) printk( fmt, ##args )
+
+/* TI Drivers */
+//#include <ti/display/Display.h>
+#include <ti/drivers/Power.h>
+//#include <ti/drivers/pin/PINCC26XX.h>
+
+/* Application specific Header files */
+#include "config.h"
+#include "menu.h"
+
+#include "Board.h"
+
+#ifndef DeviceFamily_CC13X2
+#define DeviceFamily_CC13X2
+#endif
+#include "smartrf_settings/smartrf_settings_predefined.h"
+
+/***** Defines *****/
+
+
+/***** Variable declarations *****/
+
+/* Events used in the application */
+typedef enum
+{
+ MenuEvent_Navigate = 2,
+ MenuEvent_Select = 1,
+ MenuEvent_AnyButtonPushed = MenuEvent_Navigate + MenuEvent_Select,
+} MenuEvent;
+
+/* Menu row indices */
+typedef enum
+{
+ TitleRow = 0,
+ TestModeRow,
+ ModulationRow,
+ StartRow,
+ NrOfMainMenuRows,
+} MenuIndex;
+
+/* String constants for different boards */
+ static const char* const button0Text = "BTN-1";
+ static const char* const button1Text = "BTN-2";
+
+/* Convenience macros for printing on a vt100 terminal via UART */
+#define vt100_print0(handle, row, col, text) \
+ Display_printf(handle, 0, 0, "\x1b[%d;%df" text, row+1, col+1)
+
+#define vt100_print1(handle, row, col, formatString, arg1) \
+ Display_printf(handle, 0, 0, "\x1b[%d;%df" formatString, row+1, col+1, arg1)
+
+#define vt100_print2(handle, row, col, formatString, arg1, arg2) \
+ Display_printf(handle, 0, 0, "\x1b[%d;%df" formatString, row+1, col+1, arg1, arg2)
+
+#define vt100_clear(handle) \
+ Display_printf(handle, 0, 0, "\x1b[2J\x1b[H")
+
+void menu_clear(void) {
+ vt100_clear( Hufflepuff! );
+}
+
+#define vt100_setCursorVisible(handle, visible) \
+ Display_printf(handle, 0, 0, "\x1b[?25%c", ((visible) == true) ? 'h' : 'l')
+
+/* Holds the configuration for the current test case */
+static ApplicationConfig config =
+{
+ RfSetup_Ble,
+ TestMode_Tx,
+ 10,
+ 30,
+ NULL,
+ 0,
+};
+
+//static Display_Handle lcdDisplay;
+//static Display_Handle uartDisplay;
+static volatile u8_t eventFlag = 0;
+
+/***** Prototypes *****/
+void menu_runTask();
+
+bool menu_isButtonPressed()
+{
+ return (eventFlag != 0);
+}
+
+/*
+Menu task function.
+
+This task contains the main application logic. It prints the menu on both,
+LCD and UART and starts the RX and TX test cases.
+The setup code is generated from the .cfg file.
+*/
+void menu_init()
+{
+ config.frequencyTable = config_frequencyTable_Lut[config.rfSetup];
+}
+
+void menu_runTask()
+{
+
+ u8_t cursorRow = TestModeRow;
+ u8_t payloadIndex = 0;
+ vt100_clear(uartDisplay);
+ vt100_setCursorVisible(uartDisplay, false);
+
+ /* Splash screen */
+ vt100_print0(uartDisplay, 0, 0, "BLE Connect Test");
+ vt100_print0(uartDisplay, 1, 0, BLEC_VERSION);
+ vt100_print1(uartDisplay, 3, 0, "Select: %s", button0Text);
+ vt100_print1(uartDisplay, 4, 0, "Navigate: %s", button1Text);
+ vt100_print0(uartDisplay, 6, 0, "Push a button");
+ vt100_print0(uartDisplay, 7, 0, "to proceed...");
+
+ bool previousHwiState = IntMasterDisable();
+ // Tricky IntMasterDisable():
+ //true : Interrupts were already disabled when the function was called.
+ //false : Interrupts were enabled and are now disabled.
+ while(!eventFlag){
+ IntMasterEnable();
+ Power_idleFunc();
+ IntMasterDisable();
+
+ }
+ if(!previousHwiState)
+ {
+ IntMasterEnable();
+ }
+ eventFlag = 0;
+ //Display_clear(lcdDisplay);
+ vt100_clear(uartDisplay);
+
+ while(true)
+ {
+ vt100_print0(uartDisplay, 0, 0, "Main Menu");
+ vt100_print1(uartDisplay, TestModeRow, 0, " Test: %s", config_testmodeLabels[config.testMode]);
+ vt100_print1(uartDisplay, ModulationRow, 0, " Mode: %s", config_rfSetupLabels[config.rfSetup]);
+ if(config.testMode == TestMode_Rx)
+ {
+// vt100_print0(uartDisplay, IntervalRow, 0, " Interval: -- ");
+// vt100_print0(uartDisplay, PayloadLengthRow, 0, " Length: -- ");
+ }
+ else
+ {
+// vt100_print1(uartDisplay, IntervalRow, 0, " Interval: %s", config_intervalLabels[config.intervalMode]);
+// vt100_print1(uartDisplay, PayloadLengthRow, 0, " Length: %-3d", config.payloadLength);
+ }
+
+ vt100_print0(uartDisplay, StartRow, 0, " Start...");
+
+ /* Print the selector */
+ vt100_print0(uartDisplay, cursorRow, 0, ">" "\x1b[1A"); // Overlay selector and cursor
+
+ previousHwiState = IntMasterDisable();
+ /* Navigation is done event based. Events are created from button interrupts */
+ while(!eventFlag)
+ {
+ IntMasterEnable();
+ Power_idleFunc();
+ IntMasterDisable();
+ }
+ if(!previousHwiState)
+ {
+ IntMasterEnable();
+ }
+ if (eventFlag & MenuEvent_Navigate)
+ {
+ eventFlag &= !MenuEvent_Navigate;
+ cursorRow++;
+ if (cursorRow >= NrOfMainMenuRows)
+ {
+ cursorRow = TestModeRow;
+ }
+ }
+ if (eventFlag & MenuEvent_Select)
+ {
+ eventFlag &= !MenuEvent_Select;
+ switch(cursorRow)
+ {
+ case TestModeRow:
+ config.testMode = (TestMode)((config.testMode + 1) % NrOfTestModes);
+ break;
+
+ case ModulationRow:
+ config.rfSetup = (RfSetup)((config.rfSetup + 1) % NrOfRfSetups);
+ config.frequencyTable = config_frequencyTable_Lut[config.rfSetup];
+ config.frequency = 0;
+ if ( config.rfSetup == RfSetup_Ble || config.rfSetup == RfSetup_Ble5 )
+ {
+ // Fixed payload length of 30
+ payloadIndex = 0;
+ config.payloadLength = config_payloadLengthTable[payloadIndex];
+ }
+ break;
+
+ case StartRow:
+
+ if (config.testMode == TestMode_Rx)
+ {
+ /* Prepare RX display */
+ vt100_clear(uartDisplay);
+ vt100_print0(uartDisplay, 0, 0, "Receiving...");
+ vt100_print2(uartDisplay, 1, 0, "%s %s",
+ config_rfSetupLabels[config.rfSetup],
+ config.frequencyTable[config.frequency].label);
+ vt100_print1(uartDisplay, 2, 0, "Pkts ok : %-5d", 0);
+ vt100_print0(uartDisplay, 3, 0, "RSSI [dBm]: n/a");
+ vt100_print0(uartDisplay, 4, 0, "TP[bps]: n/a");
+ vt100_print0(uartDisplay, 5, 0, "PER [%%] : n/a");
+ vt100_print0(uartDisplay, 7, 0, "Push a button");
+ vt100_print0(uartDisplay, 8, 0, "to abort.");
+
+ /* Run the test. */
+ IntMasterEnable();
+ TestResult result = rx_runRxTest(&config);
+ if (result == TestResult_Finished)
+ {
+ //Display_printf(lcdDisplay, 7, 0, "...finished. ");
+ vt100_print0(uartDisplay, 13, 0, "...finished. ");
+
+ //Display_printf(lcdDisplay, 8, 0, "Push a button...");
+ vt100_print0(uartDisplay, 14, 0, "Push a button...");
+ previousHwiState = IntMasterDisable();
+ while(!eventFlag)
+ {
+ IntMasterEnable();
+ Power_idleFunc();
+ IntMasterDisable();
+ }
+ if(!previousHwiState)
+ {
+ IntMasterEnable();
+ }
+ }
+ eventFlag = 0;
+ }
+ else
+ {
+
+ /* Prepare TX display */
+ vt100_clear(uartDisplay);
+ vt100_print0(uartDisplay, 0, 0, "Sending...");
+ vt100_print2(uartDisplay, 1, 0, "%s %s",
+ config_rfSetupLabels[config.rfSetup],
+ config.frequencyTable[config.frequency].label);
+ vt100_print1(uartDisplay, 3, 0, "Pkts sent: %-5d", 0);
+
+ /* Run the test. */
+ IntMasterEnable();
+ TestResult result = tx_runTxTest(&config);
+ if (result == TestResult_Aborted)
+ {
+ //Display_printf(lcdDisplay, 8, 0, "...aborted.");
+ vt100_print0(uartDisplay, 13, 0, "...aborted.");
+ eventFlag = 0;
+ }
+ else if (result == TestResult_Finished)
+ {
+ //Display_printf(lcdDisplay, 8, 0, "...finished.");
+ vt100_print0(uartDisplay, 13, 0, "...finished.");
+ }
+ //Display_printf(lcdDisplay, 9, 0, "Push a button...");
+ vt100_print0(uartDisplay, 14, 0, "Push a button...");
+
+ previousHwiState = IntMasterDisable();
+ while(!eventFlag)
+ {
+ IntMasterEnable();
+ Power_idleFunc();
+ IntMasterDisable();
+ }
+ if(!previousHwiState)
+ {
+ IntMasterEnable();
+ }
+ eventFlag = 0;
+ }
+ //Display_clear(lcdDisplay);
+ vt100_clear(uartDisplay);
+ break;
+ }
+ }
+ }
+}
+
+/*
+Callback for button interrupts.
+
+This function is supposed to be called asynchronously from within an interrupt
+handler and signals a button press event to the application logic.
+*/
+void menu_notifyButtonPressed(Button button)
+{
+ if (button == Button_Navigate)
+ {
+ eventFlag |= MenuEvent_Navigate;
+ }
+ else
+ {
+ eventFlag |= MenuEvent_Select;
+ }
+}
+
+/*
+Updates the screen content during an ongoing receive.
+
+Call this function from any other task to refresh the menu with
+updated parameters.
+*/
+void menu_updateRxScreen(rx_metrics *metrics)
+{
+#if 0
+ vt100_print1(uartDisplay, 2, 0, "Pkts ok : %-5d", metrics->packetsReceived);
+ vt100_print1(uartDisplay, 3, 0, "RSSI [dBm]: %-5i", metrics->rssi);
+ vt100_print1(uartDisplay, 4, 0, "TP[bps]: %-7d", metrics->throughput);
+ vt100_print0(uartDisplay, 5, 0, "PER [%%] :");
+
+
+ /* Convert float to string buffer */
+ if ((metrics->packetsReceived <= config.packetCount) &&
+ (metrics->packetsReceived <= metrics->packetsExpected))
+ {
+ /* Avoid a 0.0/0.0 (NaN) or a x/0.0 (+Inf) condition */
+ float per = 0.0f;
+ if(metrics->packetsExpected > 0)
+ {
+ per = ((float)(metrics->packetsMissed)/(float)(metrics->packetsExpected))*100.0f;
+ }
+ int characteristic = (int)per;
+ int mantissa = (int)((per - characteristic)*100);
+
+ //Display_printf(lcdDisplay, 5, 10, "%3d", characteristic);
+ vt100_print1(uartDisplay, 5, 10, "%3d", characteristic);
+
+ //Display_printf(lcdDisplay, 5, 13, "%c", '.');
+ vt100_print1(uartDisplay, 5, 13, "%c", '.');
+
+ //Display_printf(lcdDisplay, 5, 14, "%-2d", mantissa);
+ vt100_print1(uartDisplay, 5, 14, "%-2d", mantissa);
+ }
+ else
+ {
+ char buffer[6] = "n/a ";
+ //Display_printf(lcdDisplay, 5, 11, "%s", (char *)&buffer);
+ vt100_print1(uartDisplay, 5, 0, "PER [%%] : %s", (char *)&buffer);
+ }
+#endif
+}
+
+/*
+Updates the screen content during an ongoing transmission.
+
+Call this function from any other task to refresh the menu with
+updated parameters.
+ */
+void menu_updateTxScreen(u32_t packetsSent)
+{
+ //vt100_print1(uartDisplay, 3, 11, "%-5d", packetsSent);
+}
+
+/*
+Updates the screen content during an ongoing transmission. This includes
+TX metrics like Transmission Power (dBm), Data Rate (bps) and Packet Interval
+(ms)
+
+Call this function from any other task to refresh the menu with
+updated parameters.
+ */
+void menu_updateTxMetricScreen(tx_metrics *metrics)
+{
+ extern RF_EventMask ble_adv_event_mask;
+ rfc_bleAdvOutput_t *x = (rfc_bleAdvOutput_t *) metrics;
+
+ vt100_print1(uartDisplay, 0, 0, "EventMask: %08x\x1b[K", (unsigned)ble_adv_event_mask );
+ vt100_print1(uartDisplay, 1, 0, "nTxAdvInd: %u\x1b[K", x->nTxAdvInd );
+ vt100_print1(uartDisplay, 2, 0, "nTxScanRsp: %u\x1b[K", x->nTxScanRsp );
+ vt100_print1(uartDisplay, 3, 0, "nRxScanReq: %u\x1b[K", x->nRxScanReq );
+ vt100_print1(uartDisplay, 4, 0, "nRxConnectReq: %u\x1b[K", x->nRxConnectReq );
+ vt100_print1(uartDisplay, 5, 0, "nTxConnectRsp: %u\x1b[K", x->nTxConnectRsp );
+ vt100_print1(uartDisplay, 6, 0, "nRxNok: %u\x1b[K", x->nRxNok );
+ vt100_print1(uartDisplay, 7, 0, "nRxIgnored: %u\x1b[K", x->nRxIgnored );
+ vt100_print1(uartDisplay, 8, 0, "nRxBufFull: %u\x1b[K", x->nRxBufFull );
+ vt100_print1(uartDisplay, 9, 0, "lastRssi: %d\x1b[K", x->lastRssi );
+ vt100_print1(uartDisplay, 10, 0, "timeStamp: %u\x1b[K", x->timeStamp );
+}
diff --git a/samples/rfBleConnect/src/power.c b/samples/rfBleConnect/src/power.c
new file mode 100644
index 0000000000..d20817505b
--- /dev/null
+++ b/samples/rfBleConnect/src/power.c
@@ -0,0 +1,16 @@
+#include <stdbool.h>
+#include <stddef.h>
+#include <ti/drivers/Power.h>
+
+#ifdef CONFIG_HAS_CC13X2_CC26X2_SDK
+#include <ti/drivers/power/PowerCC26X2.h>
+
+const PowerCC26X2_Config PowerCC26X2_config = {
+ .policyInitFxn = NULL,
+ .policyFxn = NULL,
+ .calibrateFxn = &PowerCC26XX_calibrate,
+ .enablePolicy = false,
+ .calibrateRCOSC_LF = true,
+ .calibrateRCOSC_HF = true,
+};
+#endif /* CONFIG_HAS_CC13X2_CC26X2_SDK */
diff --git a/samples/rfBleConnect/src/rfBleConnect_nortos.c b/samples/rfBleConnect/src/rfBleConnect_nortos.c
new file mode 100644
index 0000000000..e1d0c69f9f
--- /dev/null
+++ b/samples/rfBleConnect/src/rfBleConnect_nortos.c
@@ -0,0 +1,200 @@
+/*
+ * Copyright (c) 2016-2018, 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.
+ */
+
+#ifndef DeviceFamily_CC13X2
+#define DeviceFamily_CC13X2
+#endif
+
+#include <zephyr.h>
+#include <device.h>
+#include <drivers/gpio.h>
+
+/***** Includes *****/
+/* Standard C Libraries */
+#include <stdlib.h>
+
+/* TI Drivers */
+//#include <ti/display/Display.h>
+//#include <ti/drivers/PIN.h>
+#include <ti/drivers/SPI.h>
+#include <ti/drivers/UART.h>
+#include <ti/drivers/rf/RF.h>
+//#include <ti/drivers/PIN.h>
+
+/* Board Header files */
+#include "Board.h"
+
+/* Application specific Header files */
+#include "menu.h"
+
+#include <ti/devices/DeviceFamily.h>
+#include DeviceFamily_constructPath(driverlib/cpu.h)
+
+/***** Variable declarations *****/
+
+/* Pin driver objects and handles */
+//PIN_Handle buttonPinHandle;
+//static PIN_State buttonPinState;
+
+extern void menu_runTask();
+
+/*
+Application button pin configuration table.
+Buttons interrupts are configured to trigger on falling edge.
+*/
+
+/* change this to use another GPIO port */
+#ifndef DT_ALIAS_SW0_GPIOS_CONTROLLER
+#ifdef SW0_GPIO_NAME
+#define DT_ALIAS_SW0_GPIOS_CONTROLLER SW0_GPIO_NAME
+#else
+#error SW0_GPIO_NAME or DT_ALIAS_SW0_GPIOS_CONTROLLER needs to be set in board.h
+#endif
+#endif
+#define PORT DT_ALIAS_SW0_GPIOS_CONTROLLER
+
+/* change this to use another GPIO pin */
+#ifdef DT_ALIAS_SW0_GPIOS_PIN
+#define PIN1 DT_ALIAS_SW0_GPIOS_PIN
+#else
+#error DT_ALIAS_SW0_GPIOS_PIN needs to be set in board.h
+#endif
+
+/* change this to use another GPIO pin */
+#ifdef DT_ALIAS_SW1_GPIOS_PIN
+#define PIN2 DT_ALIAS_SW1_GPIOS_PIN
+#else
+#error DT_ALIAS_SW1_GPIOS_PIN needs to be set in board.h
+#endif
+
+/* change to use another GPIO pin interrupt config */
+#ifdef DT_ALIAS_SW0_GPIOS_FLAGS
+#define EDGE1 (DT_ALIAS_SW0_GPIOS_FLAGS | GPIO_INT_EDGE)
+#else
+/*
+ * If DT_ALIAS_SW0_GPIOS_FLAGS not defined used default EDGE value.
+ * Change this to use a different interrupt trigger
+ */
+#define EDGE1 (GPIO_INT_EDGE | GPIO_INT_ACTIVE_LOW)
+#endif
+
+/* change to use another GPIO pin interrupt config */
+#ifdef DT_ALIAS_SW1_GPIOS_FLAGS
+#define EDGE2 (DT_ALIAS_SW1_GPIOS_FLAGS | GPIO_INT_EDGE)
+#else
+/*
+ * If DT_ALIAS_SW0_GPIOS_FLAGS not defined used default EDGE value.
+ * Change this to use a different interrupt trigger
+ */
+#define EDGE2 (GPIO_INT_EDGE | GPIO_INT_ACTIVE_LOW)
+#endif
+
+/* change this to enable pull-up/pull-down */
+#ifndef DT_ALIAS_SW0_GPIOS_FLAGS
+#ifdef DT_ALIAS_SW0_GPIOS_PIN_PUD
+#define DT_ALIAS_SW0_GPIOS_FLAGS DT_ALIAS_SW0_GPIOS_PIN_PUD
+#else
+#define DT_ALIAS_SW0_GPIOS_FLAGS 0
+#endif
+#endif
+#define PULL_UP1 DT_ALIAS_SW0_GPIOS_FLAGS
+
+/* change this to enable pull-up/pull-down */
+#ifndef DT_ALIAS_SW1_GPIOS_FLAGS
+#ifdef DT_ALIAS_SW1_GPIOS_PIN_PUD
+#define DT_ALIAS_SW1_GPIOS_FLAGS DT_ALIAS_SW1_GPIOS_PIN_PUD
+#else
+#define DT_ALIAS_SW1_GPIOS_FLAGS 0
+#endif
+#endif
+#define PULL_UP2 DT_ALIAS_SW1_GPIOS_FLAGS
+
+
+/*
+Interrupt handler for the button pints.
+*/
+static struct gpio_callback gpio_cb1;
+static struct gpio_callback gpio_cb2;
+
+void button_pressed(struct device *gpiob, struct gpio_callback *cb,
+ u32_t pins)
+{
+ //printk("Button pressed at %" PRIu32 "\n", k_cycle_get_32());
+
+ if (pins == BIT(DT_ALIAS_SW0_GPIOS_PIN)) {
+ menu_notifyButtonPressed(Button_Select);
+ } else if (pins == BIT(DT_ALIAS_SW1_GPIOS_PIN)) {
+ menu_notifyButtonPressed(Button_Navigate);
+ }
+}
+
+void mainThread(void *arg0)
+{
+ /* Initialize the radio */
+ RF_Params rfParams;
+ RF_Params_init(&rfParams);
+
+ /* Initialize the UART and SPI for the display driver. */
+// Display_init();
+// UART_init();
+// SPI_init();
+
+
+ struct device *gpiob;
+
+ gpiob = device_get_binding(PORT);
+ if (!gpiob) {
+ printk("%s(): %d: error\n", __func__, __LINE__);
+ return;
+ }
+
+ gpio_pin_configure(gpiob, PIN1,
+ GPIO_DIR_IN | GPIO_INT | PULL_UP1 | EDGE1);
+
+ gpio_init_callback(&gpio_cb1, button_pressed, BIT(PIN1));
+
+ gpio_add_callback(gpiob, &gpio_cb1);
+ gpio_pin_enable_callback(gpiob, PIN1);
+
+ gpio_pin_configure(gpiob, PIN2,
+ GPIO_DIR_IN | GPIO_INT | PULL_UP2 | EDGE2);
+
+ gpio_init_callback(&gpio_cb2, button_pressed, BIT(PIN2));
+ gpio_add_callback(gpiob, &gpio_cb2);
+ gpio_pin_enable_callback(gpiob, PIN2);
+
+ menu_init();
+
+ /* Start task execution */
+
+ menu_runTask();
+}
diff --git a/samples/rfBleConnect/src/rx.c b/samples/rfBleConnect/src/rx.c
new file mode 100644
index 0000000000..91ea6d5be8
--- /dev/null
+++ b/samples/rfBleConnect/src/rx.c
@@ -0,0 +1,736 @@
+/*
+ * Copyright (c) 2016-2018, 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 *****/
+/* TI-RTOS Header files */
+#define Board_CC1352R1_LAUNCHXL
+#ifndef DeviceFamily_CC13X2
+#define DeviceFamily_CC13X2
+#endif
+#include <ti/drivers/rf/RF.h>
+//#include <ti/drivers/PIN.h>
+/* Board Header files */
+//#include "Board.h"
+
+/* Application specific Header files */
+#include "config.h"
+#include "menu.h"
+#include "RFQueue.h"
+
+#include "smartrf_settings/smartrf_settings.h"
+#include "smartrf_settings/smartrf_settings_predefined.h"
+#include "smartrf_settings/smartrf_settings_ble.h"
+
+
+/***** Defines *****/
+#define RX_DEBUG_COLLECT_METRICS 0 // Set to 1 to collect rx metrics (debugging mode)
+#define DATA_ENTRY_HEADER_SIZE 8 // Constant header size of a Generic Data Entry
+#define MAX_LENGTH 254 // Max length byte the radio will accept (Even due to HS requirement)
+#define NUM_DATA_ENTRIES 2 // NOTE: Only two data entries supported at the moment
+#define NUM_APPENDED_BYTES 6 // -- For the HS command (6 bytes total),
+ // packet length (2 bytes) + Timestamp (4 bytes)
+ // -- For other Sub-1 GHz commands (6 bytes total),
+ // packet length (1 bytes) + Timestamp (4 bytes) + status (1 byte)
+ // -- For 200 Kbps IEEE 802.15.4g commands (5 bytes total),
+ // Timestamp (4 bytes) + status (1 byte)
+ // -- For BLE (9 bytes total), but max payload is well under
+ // the max length supported by the sub-1 phys
+ // Timestamp (4 bytes) + status (1 byte) + RSSI (1 byte) + CRC (3 bytes)
+#define NUM_LEN_BITS 0x8 // For header of 200 Kbps IEEE 802.15.4g commands
+#define NFRACBITS 9 // 32 - ceil(log2(4000000)) - 1
+#define RX_TIMEOUT_NPKTS 5 // Specifies how many packet intervals constitute a RAT Timer
+ // timeout interval
+#define PKT_INTERVAL_TOL 2 // Specifies the tolerance, in percentage, of the permissible
+ // drift in packet interval
+#define ADV_NONCONN_IND 2 //Packet type for BLE4
+#define AUX_ADV_IND 7 //Packet type for BLE5
+
+#define ABORT_GRACEFUL 1 // Option for the RF cancel command
+#define ABORT_ABRUPT 0 // Option for the RF cancel command
+
+#define LOG2_100MILLION 27 // ceil(log2(10^8)=26.575424759098897) = 27
+
+/*
+ * PROPRIETARY RX FRAME (2-GFSK, LRM, SLR, OOK)
+ *
+ * +-------------------------------------------------------------+
+ * |_LEN_|_____________PAYLOAD(sz)__________|_TIMESTAMP_|_STATUS_|
+ * | |_SERIAL_|__________DATA___________| | |
+ * |1B |2B | Upto 252B | 4B | 1B |
+ * +-------------------------------------------------------------+
+ */
+#define RX_FRAME_PROP_OFFSET_LEN 0
+#define RX_FRAME_PROP_OFFSET_SERIAL 1
+#define RX_FRAME_PROP_OFFSET_DATA 3
+#define RX_FRAME_PROP_OFFSET_TIMESTAMP(sz) (RX_FRAME_PROP_OFFSET_SERIAL + sz)
+
+/*
+ * PROPRIETARY RX FRAME (2-GFSK IEEE 802.15.4g)
+ *
+ * +-------------------------------------------------------------+
+ * |_HDR___|_____________PAYLOAD(sz)________|_TIMESTAMP_|_STATUS_|
+ * |LEN|FLG|_SERIAL_|__________DATA_________| | |
+ * |1B |1B |2B | Upto 252B | 4B | 1B |
+ * +-------------------------------------------------------------+
+ */
+#define RX_FRAME_PROP_2GFSK200K_OFFSET_LEN 0
+#define RX_FRAME_PROP_2GFSK200K_OFFSET_SERIAL 2
+#define RX_FRAME_PROP_2GFSK200K_OFFSET_DATA 4
+#define RX_FRAME_PROP_2GFSK200K_OFFSET_TIMESTAMP(sz) (RX_FRAME_PROP_2GFSK200K_OFFSET_LEN + sz)
+
+/*
+ * HIGHSPEED RX FRAME (HSM)
+ *
+ * +-------------------------------------------------------------+
+ * |_LEN_|_____________PAYLOAD(sz)__________|_TIMESTAMP_|_STATUS_|
+ * | |_SERIAL_|__________DATA___________| | |
+ * |2B |2B | Upto 252B | 4B | 1B |
+ * +-------------------------------------------------------------+
+ *
+ * Note that HSM mode can transfer up to 4KB of payload but are hard-coded for
+ * a maximum of 254B in this example
+ */
+#define RX_FRAME_HSM_OFFSET_LEN 0
+#define RX_FRAME_HSM_OFFSET_SERIAL 2
+#define RX_FRAME_HSM_OFFSET_DATA 4
+#define RX_FRAME_HSM_OFFSET_TIMESTAMP(sz) (RX_FRAME_HSM_OFFSET_SERIAL + sz)
+
+/*
+ * BLE4 (ADV_NONCONN_IND Packet) RX FRAME
+ *
+ * +-------------------------------------------------------------------------------------------+
+ * |____PDU____|_______________PAYLOAD(sz)___________________|_CRC_|_RSSI_|_STATUS_|_TIMESTAMP_|
+ * |_ADV_|_LEN_|_ADV_ADDR_|_SERIAL_|__________DATA___________| | | | |
+ * |1B |1B |6B |2B |Upto 22B |3B |1B |1B/2B |4B |
+ * +-------------------------------------------------------------------------------------------+
+ *
+ * Note that BLE4 frames can transfer up to 37B of payload but are hard-coded
+ * for 30B in this example. Also if BLE4 Rx is run on an 13X2 device then it
+ * is actually the BLE5 Rx command that is run
+ */
+#define RX_FRAME_BLE4_OFFSET_ADV_TYPE 0
+#define RX_FRAME_BLE4_OFFSET_LEN 1
+#define RX_FRAME_BLE4_OFFSET_ADV_ADDR 2
+#define RX_FRAME_BLE4_OFFSET_SERIAL 8
+#define RX_FRAME_BLE4_OFFSET_DATA 10
+#define RX_FRAME_BLE4_OFFSET_CRC(sz) (RX_FRAME_BLE4_OFFSET_ADV_ADDR + sz)
+#define RX_FRAME_BLE4_OFFSET_RSSI(sz) (RX_FRAME_BLE4_OFFSET_CRC(sz) + 3)
+#define RX_FRAME_BLE4_OFFSET_STATUS(sz) (RX_FRAME_BLE4_OFFSET_RSSI(sz) + 1)
+#if (defined Board_CC2640R2_LAUNCHXL) || (defined Board_CC1352R1_LAUNCHXL) || \
+ (defined Board_CC1352P1_LAUNCHXL) || (defined Board_CC1352P_2_LAUNCHXL) || \
+ (defined Board_CC1352P_4_LAUNCHXL) || (defined Board_CC26X2R1_LAUNCHXL)
+#define RX_FRAME_BLE4_OFFSET_TIMESTAMP(sz) (RX_FRAME_BLE4_OFFSET_STATUS(sz) + 2)
+#else
+#define RX_FRAME_BLE4_OFFSET_TIMESTAMP(sz) (RX_FRAME_BLE4_OFFSET_STATUS(sz) + 1)
+#endif
+
+/*
+ * BLE5 (AUX_ADV_IND Packet) RX FRAME
+ *
+ * +-------------------------------------------------------------------------------------------+
+ * |____PDU____|_______________PAYLOAD(sz)___________________|_CRC_|_RSSI_|_STATUS_|_TIMESTAMP_|
+ * |_ADV_|_LEN_|_ADV_ADDR_|_SERIAL_|__________DATA___________| | | | |
+ * |1B |1B |10B |2B |Upto 18B |3B |1B |1B/2B |4B |
+ * +-------------------------------------------------------------------------------------------+
+ *
+ * Note that BLE4 frames can transfer up to 37B of payload but are hard-coded
+ * for 30B in this example
+ */
+#define RX_FRAME_BLE5_OFFSET_ADV_TYPE 0
+#define RX_FRAME_BLE5_OFFSET_LEN 1
+#define RX_FRAME_BLE5_OFFSET_ADV_ADDR 2
+#define RX_FRAME_BLE5_OFFSET_SERIAL 12
+#define RX_FRAME_BLE5_OFFSET_DATA 14
+#define RX_FRAME_BLE5_OFFSET_CRC(sz) (RX_FRAME_BLE5_OFFSET_ADV_ADDR + sz)
+#define RX_FRAME_BLE5_OFFSET_RSSI(sz) (RX_FRAME_BLE5_OFFSET_CRC(sz) + 3)
+#define RX_FRAME_BLE5_OFFSET_STATUS(sz) (RX_FRAME_BLE5_OFFSET_RSSI(sz) + 1)
+#if (defined Board_CC2640R2_LAUNCHXL) || (defined Board_CC1352R1_LAUNCHXL) || \
+ (defined Board_CC1352P1_LAUNCHXL) || (defined Board_CC1352P_2_LAUNCHXL) || \
+ (defined Board_CC1352P_4_LAUNCHXL) || (defined Board_CC26X2R1_LAUNCHXL)
+#define RX_FRAME_BLE5_OFFSET_TIMESTAMP(sz) (RX_FRAME_BLE5_OFFSET_STATUS(sz) + 2)
+#else
+#define RX_FRAME_BLE5_OFFSET_TIMESTAMP(sz) (RX_FRAME_BLE5_OFFSET_STATUS(sz) + 1)
+#endif
+
+/***** Prototypes *****/
+/* Radio Receive operation callback */
+static void rx_callback(RF_Handle h, RF_CmdHandle ch, RF_EventMask e);
+/* RAT Timer timeout callback function */
+static void rx_timeoutCb(RF_Handle h, RF_RatHandle rh, RF_EventMask e, u32_t compareCaptureTime);
+
+/***** Variable declarations *****/
+static u8_t packetReceived = false;
+static u16_t* crcOk;
+static int8_t* rssi;
+
+static RF_Object rfObject;
+static RF_Handle rfHandle;
+static RF_CmdHandle rxCmdHndl = 0; // Handle needed to abort the RX command
+static volatile RF_RatConfigCompare ratCompareConfig;
+static volatile RF_RatHandle ratHandle = RF_ALLOC_ERROR;
+static volatile RF_Stat ratStatus;
+
+static ApplicationConfig localConfig;
+
+static volatile bool bFirstPacket = true, bSecondPacket = true;
+static volatile bool bPacketsLost = false;
+static volatile u16_t nRxPkts = 0, nMissPkts = 0, nExpPkts = 0;
+static volatile u32_t throughputI = 0, throughputQ = 0;
+static u16_t timestampOffset = 0;
+static u16_t nRxTimeouts = 0;
+static ratmr_t startTime = 0, endTime = 0;
+static ratmr_t currTimerVal = 0, rxTimeoutVal = 0;
+static u32_t deltaTimeUs = 0;
+static u32_t deltaTimePacket = 0;
+static u32_t deltaTimePacketUs = 0;
+static u32_t pktIntervalEstUs = 0;
+static u32_t nBits = 0;
+
+#if RX_DEBUG_COLLECT_METRICS == 1
+u32_t deltaTimeRxPacketUsMin = 0xFFFFFFFF;
+u32_t deltaTimeRxPacketUsMax = 0;
+u32_t throughputMin = 0xFFFFFFFF;
+u32_t nBitsAtTpMin = 0, nBitsAtTpMax = 0;
+u32_t deltaTimeUsAtTpMin = 0, deltaTimeUsAtTpMax = 0;
+u32_t throughputMax = 0;
+#endif
+
+static rx_metrics rxMetrics = {
+ .packetsReceived = 0,
+ .packetsMissed = 0,
+ .packetsExpected = 0,
+ .nRxTimeouts = 0,
+ .nPktsPerTimeout = RX_TIMEOUT_NPKTS,
+ .rssi = 0,
+ .crcOK = 0,
+ .throughput = 0
+};
+
+/*
+Buffer which contains all Data Entries for receiving data.
+Pragmas are needed to make sure this buffer is 4 byte aligned (requirement from the RF Core)
+*/
+#if defined(__TI_COMPILER_VERSION__)
+#pragma DATA_ALIGN (rxDataEntryBuffer, 4);
+#elif defined(__IAR_SYSTEMS_ICC__)
+#pragma data_alignment = 4
+#elif defined(__GNUC__)
+__attribute__ ((aligned (4)))
+#else
+#error This compiler is not supported.
+#endif
+static u8_t rxDataEntryBuffer[RF_QUEUE_DATA_ENTRY_BUFFER_SIZE(NUM_DATA_ENTRIES,
+ MAX_LENGTH,
+ NUM_APPENDED_BYTES)];
+
+/* Receive queue for the RF Code to fill in data */
+static dataQueue_t dataQueue;
+
+/* General data entry structure (type = 0) */
+rfc_dataEntryGeneral_t* currentDataEntry;
+
+#if !(defined Board_CC2650DK_7ID) && !(defined Board_CC2650_LAUNCHXL) && \
+ !(defined Board_CC2640R2_LAUNCHXL) && !(defined Board_CC1350_LAUNCHXL_433) && \
+ !(defined Board_CC1352R1_LAUNCHXL) && !(defined Board_CC26X2R1_LAUNCHXL) && \
+ !(defined Board_CC1312R1_LAUNCHXL) && !(defined Board_CC1352P1_LAUNCHXL) && \
+ !(defined Board_CC1352P_2_LAUNCHXL) && !(defined Board_CC1352P_4_LAUNCHXL)
+rfc_hsRxOutput_t rxStatistics_hs; // Output structure for CMD_HS_RX
+#endif
+
+#if (defined Board_CC2650DK_7ID) || (defined Board_CC2650_LAUNCHXL) || \
+ (defined Board_CC2640R2_LAUNCHXL) || (defined Board_CC1350_LAUNCHXL) || \
+ (defined Board_CC1350_LAUNCHXL_433) || (defined Board_CC1350STK) || \
+ (defined Board_CC26X2R1_LAUNCHXL) || (defined Board_CC1352R1_LAUNCHXL) || \
+ (defined Board_CC1352P1_LAUNCHXL) || (defined Board_CC1352P_2_LAUNCHXL) || \
+ (defined Board_CC1352P_4_LAUNCHXL)
+rfc_bleGenericRxOutput_t rxStatistics_ble; // Output structure for RF_ble_cmdBleGenericRx
+#endif
+
+rfc_propRxOutput_t rxStatistics_prop; // Output structure for CMD_PROP_RX
+
+/* Reset all the volatile variables */
+static void rx_resetVariables(void)
+{
+ packetReceived = false;
+ bFirstPacket = bSecondPacket = true;
+ bPacketsLost = false;
+ nBits = nRxPkts = nMissPkts = nExpPkts = 0;
+ nRxTimeouts = 0;
+ startTime = endTime = 0;
+ deltaTimeUs = deltaTimePacket = deltaTimePacketUs = 0;
+ pktIntervalEstUs = 0;
+ throughputI = throughputQ = 0;
+}
+
+/* Runs the receiving part of the test application and returns a result */
+TestResult rx_runRxTest(const ApplicationConfig* config)
+{
+ TestResult testResult;
+
+ if (config == NULL)
+ {
+ while(1);
+ }
+ memcpy((void *)&localConfig, config, sizeof(ApplicationConfig));
+
+ RF_Params rfParams;
+ RF_Params_init(&rfParams);
+
+ if( RFQueue_defineQueue(&dataQueue,
+ rxDataEntryBuffer,
+ sizeof(rxDataEntryBuffer),
+ NUM_DATA_ENTRIES,
+ MAX_LENGTH + NUM_APPENDED_BYTES))
+ {
+ /* Failed to allocate space for all data entries */
+ while(true);
+ }
+
+ RF_RatConfigCompare_init((RF_RatConfigCompare *)&ratCompareConfig);
+ ratCompareConfig.callback = (RF_RatCallback)&rx_timeoutCb;
+ ratCompareConfig.channel = RF_RatChannelAny;
+
+ RF_ble_cmdBleGenericRx.pOutput = &rxStatistics_ble;
+ RF_ble_cmdBleGenericRx.pParams->pRxQ = &dataQueue;
+ RF_ble_cmdBleGenericRx.pParams->bRepeat = 1;
+ RF_ble_cmdBleGenericRx.pParams->rxConfig.bAutoFlushCrcErr = 1;
+ RF_ble_cmdBleGenericRx.pParams->rxConfig.bAppendTimestamp = 1;
+ RF_ble_cmdBleGenericRx.channel = 0xFF;
+ RF_ble_cmdBleGenericRx.whitening.bOverride = 1;
+ RF_ble_cmdBleGenericRx.whitening.init = config->frequencyTable[config->frequency].whitening;
+
+ /* Request access to the radio based on test case */
+ switch (config->rfSetup)
+ {
+ case RfSetup_Ble:
+ case RfSetup_Ble5:
+ rfHandle = RF_open(&rfObject, &RF_modeBle, (RF_RadioSetup*)&RF_ble_cmdRadioSetup, &rfParams);
+ break;
+
+ default:
+ break;
+ }
+
+ /* Set the frequency */
+ RF_ble_cmdFs.frequency = config->frequencyTable[config->frequency].frequency;
+ RF_ble_cmdFs.fractFreq = config->frequencyTable[config->frequency].fractFreq;
+ RF_runCmd(rfHandle, (RF_Op*)&RF_ble_cmdFs, RF_PriorityNormal, NULL, 0);
+
+ /* Enter RX mode and stay forever in RX */
+ switch (config->rfSetup)
+ {
+ case RfSetup_Ble:
+ case RfSetup_Ble5:
+ default:
+ rxCmdHndl = RF_postCmd(rfHandle, (RF_Op*)&RF_ble_cmdBleGenericRx, RF_PriorityNormal, &rx_callback, RF_EventRxEntryDone);
+ crcOk = &rxStatistics_ble.nRxOk;
+ rssi = &rxStatistics_ble.lastRssi;
+ break;
+ }
+
+ *crcOk = 0;
+ *rssi = 0;
+ while(true)
+ {
+ if(packetReceived || bPacketsLost)
+ {
+ bPacketsLost = false;
+ packetReceived = false;
+
+ rxMetrics.packetsReceived = nRxPkts;
+ rxMetrics.packetsMissed = nMissPkts;
+ rxMetrics.packetsExpected = nExpPkts;
+ rxMetrics.nRxTimeouts = nRxTimeouts;
+ rxMetrics.rssi = *rssi;
+ rxMetrics.crcOK = *crcOk;
+ rxMetrics.throughput = throughputI;
+ menu_updateRxScreen(&rxMetrics);
+ }
+
+ if (menu_isButtonPressed() || (nExpPkts >= localConfig.packetCount))
+ {
+ /* Stop the RAT Compare */
+ (void)RF_ratDisableChannel(rfHandle, ratHandle);
+ ratHandle = RF_ALLOC_ERROR;
+
+ /* Force abort */
+ (void)RF_cancelCmd(rfHandle, rxCmdHndl, ABORT_ABRUPT);
+ (void)RF_pendCmd(rfHandle, rxCmdHndl, 0);
+ RF_close(rfHandle);
+
+ if((nExpPkts >= localConfig.packetCount))
+ {
+ rxMetrics.packetsReceived = nRxPkts;
+ rxMetrics.packetsMissed = nMissPkts;
+ rxMetrics.packetsExpected = nExpPkts;
+ rxMetrics.nRxTimeouts = nRxTimeouts;
+ rxMetrics.rssi = *rssi;
+ rxMetrics.crcOK = *crcOk;
+ rxMetrics.throughput = throughputI;
+ menu_updateRxScreen(&rxMetrics);
+
+ testResult = TestResult_Finished;
+ }
+ else
+ {
+ testResult = TestResult_Aborted;
+ }
+
+ /* Reset all variables */
+ rx_resetVariables();
+
+ return(testResult);
+ }
+ }
+}
+
+void rx_callback(RF_Handle h, RF_CmdHandle ch, RF_EventMask e)
+{
+ u16_t payloadLength = 0;
+ u16_t pktSeqNum = 0;
+ u16_t secondPktSeqNum = 0;
+ u16_t nExpPktsLocal = nExpPkts;
+ u32_t nFracBits = 0;
+ u32_t nBitsDeltaTimeUs = 0;
+ static u16_t firstPktSeqNum = 0;
+ u16_t pduAdvType = 0;
+ if (e & RF_EventRxEntryDone)
+ {
+
+ /* Get current unhandled data entry, point to next entry */
+ currentDataEntry = RFQueue_getDataEntry();
+ RFQueue_nextEntry();
+
+ switch(localConfig.rfSetup)
+ {
+ case RfSetup_Ble:
+ case RfSetup_Ble5:
+ default:
+ if ( RfSetup_Ble == localConfig.rfSetup ) {
+ pduAdvType = *(u8_t*)(&currentDataEntry->data + RX_FRAME_BLE4_OFFSET_ADV_TYPE);
+ payloadLength = *(u8_t*)(&currentDataEntry->data + RX_FRAME_BLE4_OFFSET_LEN);
+ } else {
+ pduAdvType = *(u8_t*)(&currentDataEntry->data + RX_FRAME_BLE5_OFFSET_ADV_TYPE);
+ payloadLength = *(u8_t*)(&currentDataEntry->data + RX_FRAME_BLE5_OFFSET_LEN);
+ }
+ if(pduAdvType == ADV_NONCONN_IND)
+ {
+ // Received a BLE4 (ADV_NONCONN_IND) packet
+ pktSeqNum = (((*(u8_t*)(&currentDataEntry->data + RX_FRAME_BLE4_OFFSET_SERIAL)) << 8) |
+ (*(u8_t*)(&currentDataEntry->data + (RX_FRAME_BLE4_OFFSET_SERIAL + 1))));
+ timestampOffset = RX_FRAME_BLE4_OFFSET_TIMESTAMP(payloadLength);
+ }
+ else // pduAdvType == AUX_ADV_IND
+ { // Received a BLE5 (AUX_ADV_IND) packet
+ pktSeqNum = (((*(u8_t*)(&currentDataEntry->data + RX_FRAME_BLE5_OFFSET_SERIAL)) << 8) |
+ (*(u8_t*)(&currentDataEntry->data + (RX_FRAME_BLE5_OFFSET_SERIAL + 1))));
+ timestampOffset = RX_FRAME_BLE5_OFFSET_TIMESTAMP(payloadLength);
+ }
+ break;
+ }
+
+ if(pktSeqNum > localConfig.packetCount)
+ {
+ /* TX off, Spurious packets received greater than the configured
+ * packet count
+ * _ _ _
+ * V OFF V ON <---- V ON
+ * | | |
+ * TX RX (PC=10) Rogue TX
+ * ^
+ * +---+---+---+---+---+
+ * | 11| 12| 13| 14| 15| <---RX should ignore these
+ * +---+---+---+---+---+ packets
+ */
+ return;
+ }
+ if(pktSeqNum <= (nExpPktsLocal + RX_TIMEOUT_NPKTS))
+ {
+ /* No missing packets (pktSeqNum == nExpPkts)
+ * +---+---+---+---+---+
+ * | 0 | 1 | 2 | 3 | 4 |
+ * +---+---+---+---+---+
+ * ^
+ * |
+ * pktSeqNum = nExpPkts = 2
+ * nExpPkts = pktSeqNum + 1 = 3
+ *
+ * Missing packets
+ * ((pktSeqNum < (nExpPkts + RX_TIMEOUT_NPKTS (5))) &&
+ * (pktSeqNum > nExpPkts))
+ *
+ * +---+---+ +---+---+---+
+ * | 0 | 1 |<---miss #2 to 4 --> | 5 | 6 | 7 |
+ * +---+---+ +---+---+---+
+ * ^
+ * |
+ * pktSeqNum = 5
+ * nExpPkts = 2
+ * pktSeqNum < (nExpPkts + 5)
+ * { nMissPkts += pktSeqNum - nExpPkts
+ * nExpPkts = pktSeqNum + 1 }
+ *
+ * Catch duplicate packets interferer
+ * ((pktSeqNum < (nExpPkts + RX_TIMEOUT_NPKTS (5))) &&
+ * (pktSeqNum < nExpPkts))
+ * +---+---+---+---+---+---+---+---+---+
+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 6 | 8 |
+ * +---+---+---+---+---+---+---+---+---+
+ * ^
+ * |
+ * pktSeqNum = 6
+ * nExpPkts = 7
+ * pktSeqNum < (nExpPkts + 5)
+ * { nMissPkts = nMissPkts + 1
+ * nExpPkts = nExpPkts + 1 }
+ */
+ if(pktSeqNum >= nExpPktsLocal)
+ {
+ nMissPkts += (pktSeqNum - nExpPktsLocal);
+ nExpPktsLocal = pktSeqNum + 1;
+ }
+ else // pktSeqNum < nExpPkts
+ {
+ nMissPkts = nMissPkts + 1;
+ nExpPktsLocal = nExpPktsLocal + 1;
+ }
+ }
+ else if (pktSeqNum > (nExpPktsLocal + RX_TIMEOUT_NPKTS))
+ {
+ /* Catch spurious packets
+ * (pktSeqNum > nExpPkts + RX_TIMEOUT_NPKTS(5))
+ * +---+---+ +----+---+---+
+ * | 0 | 1 | <---miss #2 to 5 --> | 255| 7 | 8 |
+ * +---+---+ +----+---+---+
+ * ^ ^
+ * | |
+ * pktSeqNum = 255
+ * nExpPkts = 2
+ * pktSeqNum > (nExpPkts + RX_TIMEOUT_NPKTS(5))
+ * { nMissPkts++ (1)
+ * nExpPkts++ (3) }
+ * |
+ * |
+ * pktSeqNum = 7
+ * nExpPkts = 3
+ * pktSeqNum < (nExpPkts + RX_TIMEOUT_NPKTS(5))
+ * { nMissPkts += (pktSeqNum - nExpPkts) (5)
+ * nExpPkts = pktSeqNum + 1 (8) }
+ *
+ * In this case a spurious packet #255 replaced packet #6, this
+ * packet was discarded and the number of missing packets
+ * incremented by 1. However, the packets #2 to 5 that were lost to
+ * interference were not counted. When the next legitimate packet
+ * in sequence, #7, arrives the packets missing due to interference
+ * will be accounted for
+ *
+ * Look for Drift in expected Sequence Number
+ * If the total accumulated time (for N-1 packets up to this point)
+ * divided by the packet sequence number (N-1) is less than 1
+ * packet interval (+PKT_INTERVAL_TOL%) then the packet is not
+ * spurious
+ *
+ */
+ if((deltaTimeUs / pktSeqNum) > pktIntervalEstUs)
+ {
+ nExpPktsLocal++;
+ nMissPkts++;
+ bPacketsLost = true;
+
+ /* Set the RAT compare value if all packets have not been
+ * received. Only do this after two packets were received, and
+ * the packet interval is determined; additionally if the RAT
+ * timer were already started it must be disabled before
+ * starting a new compare
+ */
+ if((nExpPktsLocal < localConfig.packetCount) && (bSecondPacket == false))
+ {
+ if(ratHandle >= 0)
+ {
+ (void)RF_ratDisableChannel(rfHandle, ratHandle);
+ ratHandle = RF_ALLOC_ERROR;
+ }
+ currTimerVal = RF_getCurrentTime();
+ ratCompareConfig.timeout = currTimerVal + rxTimeoutVal;
+ ratHandle = RF_ratCompare(rfHandle, (RF_RatConfigCompare *)&ratCompareConfig, NULL);
+ if(ratHandle == RF_ALLOC_ERROR)
+ {
+ // Issue with the RAT compare
+ while(1);
+ }
+ }
+ nExpPkts = nExpPktsLocal;
+ return;
+ }
+ else
+ {
+ nExpPktsLocal = pktSeqNum + 1;
+ }
+ }
+
+ /* Stop the RAT Compare only if a legitimate packet is received */
+ if(ratHandle >= 0)
+ {
+ ratStatus = RF_ratDisableChannel(rfHandle, ratHandle);
+ ratHandle = RF_ALLOC_ERROR;
+ if(ratStatus != RF_StatCmdDoneSuccess)
+ {
+ /* error disabling RAT channel */
+ while(1);
+ }
+ }
+
+ if(bFirstPacket)
+ {
+ firstPktSeqNum = pktSeqNum;
+ startTime = *(u32_t *)((u8_t *)&(currentDataEntry->data) + timestampOffset);
+ /* Lock out this read after the first packet */
+ bFirstPacket = false;
+ }
+ else
+ {
+ endTime = *(u32_t *)((u8_t *)&(currentDataEntry->data) + timestampOffset);
+ /* Calculate the delta between two consecutive packets */
+ deltaTimePacket = endTime - startTime;
+ deltaTimePacketUs = deltaTimePacket/RF_RAT_TICKS_PER_US;
+ /* Set current packet time stamp as the start time for the next
+ * delta calculation
+ */
+ startTime = endTime;
+ deltaTimeUs += deltaTimePacketUs;
+ nFracBits = __builtin_clz(deltaTimeUs);
+ nBitsDeltaTimeUs = 32UL - nFracBits;
+
+ if(nBitsDeltaTimeUs >= LOG2_100MILLION)
+ {
+ // deltaTimeUs is two orders of magnitude larger that 10^6
+ // Throughput_I = (N_bits * 2^nFracBits)/(delT_us/10^6))
+ // = Throughput_I / 2^nFracBits
+ // Shift N_bits up to occupy the MSbs and then divide by
+ // (delT_us/10^6) which is at least 6 bits wide
+ // log2(1e8)-log2(1e6) = 6.643856189774724
+ throughputI = (nBits << nFracBits)/ (deltaTimeUs / 1000000UL);
+ throughputQ = throughputI & ((1 << nFracBits) - 1);
+ throughputI = throughputI >> nFracBits;
+ }
+ else
+ {
+ // deltaTimeUs is smaller or comparable to 10^8
+ // Throughput_I = (N_bits * 2^NFRAC)/(delT_us/10^6)
+ // = (N_bits)* (round(10^6*2^NFRAC)/delT_us)
+ // = (N_bits)* ((10^6*2^NFRAC + delT_us/2)/delT_us)
+ // = Throughput_I / 2^nFracBits
+ throughputI = nBits * (((1000000UL << NFRACBITS) + (deltaTimeUs >> 1))/deltaTimeUs);
+ throughputQ = throughputI & ((1 << NFRACBITS) - 1);
+ throughputI = throughputI >> NFRACBITS;
+ }
+ /* Start the RAT Timer to timeout after NPKTS_TIMEOUT packet
+ * intervals
+ */
+ if(bSecondPacket)
+ {
+ /* the division by (secondPktSeqNum - firstPktSeqNum) ensures
+ * that we get the delta time for one packet, even if we miss
+ * any of the starting packets
+ *
+ * +---+---+---+ +---+---+---+---+ +---+---+---+
+ * | 0 | | 2 | OR | 0 | | | 3 | OR | | 1 | 2 |
+ * +---+---+---+ +---+---+---+---+ +---+---+---+
+ * <--delT-> ^ <--delT-----> ^ <dT> ^
+ * | | |
+ * packet interval = delT/2 | |
+ * packet interval = delT/3 |
+ * packet interval = delT/1
+ */
+ secondPktSeqNum = pktSeqNum;
+ rxTimeoutVal = RX_TIMEOUT_NPKTS * deltaTimePacket/(secondPktSeqNum - firstPktSeqNum);
+ pktIntervalEstUs = (u32_t)((1 + PKT_INTERVAL_TOL/100.0) * (float)deltaTimePacketUs);
+ /* Lock out this calculation after the second packet */
+ bSecondPacket = false;
+ }
+
+ /* Set the RAT compare value if all packets have not been received*/
+ if(nExpPktsLocal < localConfig.packetCount)
+ {
+ currTimerVal = RF_getCurrentTime();
+ ratCompareConfig.timeout = currTimerVal + rxTimeoutVal;
+ ratHandle = RF_ratCompare(rfHandle, (RF_RatConfigCompare *)&ratCompareConfig, NULL);
+ if(ratHandle == RF_ALLOC_ERROR)
+ {
+ // Issue with the RAT compare
+ while(1);
+ }
+ }
+ }
+ nBits += (payloadLength << 3);
+
+ /* Update packet metrics each time a good packet is received */
+ nRxPkts++;
+ nMissPkts = (nExpPktsLocal - nRxPkts);
+ nExpPkts = nExpPktsLocal;
+ packetReceived = true;
+ }
+}
+
+void rx_timeoutCb(RF_Handle h, RF_RatHandle rh, RF_EventMask e, u32_t compareCaptureTime)
+{
+ nExpPkts += RX_TIMEOUT_NPKTS;
+ nMissPkts += RX_TIMEOUT_NPKTS;
+ nRxTimeouts++;
+ bPacketsLost = true;
+
+ /* Update timeout metrics */
+ if(nExpPkts < localConfig.packetCount)
+ {
+ /*
+ * The RAT compare event is one-shot, the channel deallocated prior to
+ * this callback being issued. It is safe to issue the next RAT compare
+ * event
+ */
+ ratCompareConfig.timeout = compareCaptureTime + rxTimeoutVal;
+ ratHandle = RF_ratCompare(rfHandle, (RF_RatConfigCompare *)&ratCompareConfig, NULL);
+ if(ratHandle == RF_ALLOC_ERROR)
+ {
+ // Issue with the RAT compare
+ while(1);
+ }
+ }
+ else // nExpPkts >= localConfig.packetCount
+ {
+ /* There should be no more packets beyond this point, these are
+ * the final metrics
+ */
+ nMissPkts = localConfig.packetCount - nRxPkts;
+ nExpPkts = localConfig.packetCount;
+ }
+}
+
diff --git a/samples/rfBleConnect/src/smartrf_settings/smartrf_settings.c b/samples/rfBleConnect/src/smartrf_settings/smartrf_settings.c
new file mode 100644
index 0000000000..64ff9d528e
--- /dev/null
+++ b/samples/rfBleConnect/src/smartrf_settings/smartrf_settings.c
@@ -0,0 +1,230 @@
+//*********************************************************************************
+// Generated by SmartRF Studio version 2.13.0 (build #164)
+// Tested for SimpleLink SDK version: CC13x2 SDK 2.40.xx.xx
+// Device: CC1352R Rev. 2.1
+//
+//*********************************************************************************
+
+
+//*********************************************************************************
+// Parameter summary
+// Address: 0
+// Address0: 0xAA
+// Address1: 0xBB
+// Frequency: 868.00000 MHz
+// Data Format: Serial mode disable
+// Deviation: 25.000 kHz
+// pktLen: 30
+// 802.15.4g Mode: 0
+// Select bit order to transmit PSDU octets:: 1
+// Packet Length Config: Variable
+// Max Packet Length: 255
+// Packet Length: 30
+// Packet Data: 255
+// RX Filter BW: 98.0 kHz
+// Symbol Rate: 50.00000 kBaud
+// Sync Word Length: 32 Bits
+// TX Power: 14 dBm (requires define CCFG_FORCE_VDDR_HH = 1 in ccfg.c, see CC13xx/CC26xx Technical Reference Manual)
+// Whitening: No whitening
+
+#ifndef DeviceFamily_CC13X2
+#define DeviceFamily_CC13X2
+#endif
+#include <ti/devices/DeviceFamily.h>
+#include DeviceFamily_constructPath(driverlib/rf_mailbox.h)
+#include DeviceFamily_constructPath(driverlib/rf_common_cmd.h)
+#include DeviceFamily_constructPath(driverlib/rf_prop_cmd.h)
+#include <ti/drivers/rf/RF.h>
+//#include DeviceFamily_constructPath(rf_patches/rf_patch_cpe_prop.h)
+#include DeviceFamily_constructPath(rf_patches/rf_patch_cpe_multi_protocol.h)
+#include "smartrf_settings.h"
+
+
+// TI-RTOS RF Mode Object
+RF_Mode RF_prop =
+{
+ .rfMode = RF_MODE_AUTO,
+ .cpePatchFxn = &rf_patch_cpe_multi_protocol, //&rf_patch_cpe_prop,
+ .mcePatchFxn = 0,
+ .rfePatchFxn = 0,
+};
+
+// Overrides for CMD_PROP_RADIO_DIV_SETUP
+uint32_t pOverrides[] =
+{
+ // override_prop_common.xml
+ // DC/DC regulator: In Tx, use DCDCCTL5[3:0]=0x7 (DITHER_EN=0 and IPEAK=7).
+ (uint32_t)0x00F788D3,
+ // override_tc106.xml
+ // Tx: Configure PA ramp time, PACTL2.RC=0x3 (in ADI0, set PACTL2[4:3]=0x3)
+ ADI_2HALFREG_OVERRIDE(0,16,0x8,0x8,17,0x1,0x1),
+ // Rx: Set AGC reference level to 0x1A (default: 0x2E)
+ HW_REG_OVERRIDE(0x609C,0x001A),
+ // Rx: Set RSSI offset to adjust reported RSSI by -1 dB (default: -2), trimmed for external bias and differential configuration
+ (uint32_t)0x000188A3,
+ // Rx: Set anti-aliasing filter bandwidth to 0xD (in ADI0, set IFAMPCTL3[7:4]=0xD)
+ ADI_HALFREG_OVERRIDE(0,61,0xF,0xD),
+ // Tx: Set wait time before turning off ramp to 0x1A (default: 0x1F)
+ HW_REG_OVERRIDE(0x6028,0x001A),
+#if (CCFG_FORCE_VDDR_HH)
+ // TX power override
+ // Tx: Set PA trim to max to maximize its output power (in ADI0, set PACTL0=0xF8)
+ ADI_REG_OVERRIDE(0,12,0xF8),
+#endif
+ (uint32_t)0xFFFFFFFF,
+};
+
+// CMD_PROP_RADIO_DIV_SETUP
+// Proprietary Mode Radio Setup Command for All Frequency Bands
+rfc_CMD_PROP_RADIO_DIV_SETUP_t RF_cmdPropRadioDivSetup =
+{
+ .commandNo = 0x3807,
+ .status = 0x0000,
+ .pNextOp = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
+ .startTime = 0x00000000,
+ .startTrigger.triggerType = 0x0,
+ .startTrigger.bEnaCmd = 0x0,
+ .startTrigger.triggerNo = 0x0,
+ .startTrigger.pastTrig = 0x0,
+ .condition.rule = 0x1,
+ .condition.nSkip = 0x0,
+ .modulation.modType = 0x1,
+ .modulation.deviation = 0x64,
+ .modulation.deviationStepSz = 0x0,
+ .symbolRate.preScale = 0xF,
+ .symbolRate.rateWord = 0x8000,
+ .symbolRate.decimMode = 0x0,
+ .rxBw = 0x52,
+ .preamConf.nPreamBytes = 0x4,
+ .preamConf.preamMode = 0x0,
+ .formatConf.nSwBits = 0x20,
+ .formatConf.bBitReversal = 0x0,
+ .formatConf.bMsbFirst = 0x1,
+ .formatConf.fecMode = 0x0,
+ .formatConf.whitenMode = 0x0,
+ .config.frontEndMode = 0x0,
+ .config.biasMode = 0x1,
+ .config.analogCfgMode = 0x0,
+ .config.bNoFsPowerUp = 0x0,
+ .txPower = 0x013F,
+ .pRegOverride = pOverrides,
+ .centerFreq = 0x0364,
+ .intFreq = 0x8000,
+ .loDivider = 0x05,
+};
+
+// CMD_FS
+// Frequency Synthesizer Programming Command
+rfc_CMD_FS_t RF_cmdFs =
+{
+ .commandNo = 0x0803,
+ .status = 0x0000,
+ .pNextOp = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
+ .startTime = 0x00000000,
+ .startTrigger.triggerType = 0x0,
+ .startTrigger.bEnaCmd = 0x0,
+ .startTrigger.triggerNo = 0x0,
+ .startTrigger.pastTrig = 0x0,
+ .condition.rule = 0x1,
+ .condition.nSkip = 0x0,
+ .frequency = 0x0364,
+ .fractFreq = 0x0000,
+ .synthConf.bTxMode = 0x0,
+ .synthConf.refFreq = 0x0,
+ .__dummy0 = 0x00,
+ .__dummy1 = 0x00,
+ .__dummy2 = 0x00,
+ .__dummy3 = 0x0000,
+};
+
+// CMD_PROP_TX
+// Proprietary Mode Transmit Command
+rfc_CMD_PROP_TX_t RF_cmdPropTx =
+{
+ .commandNo = 0x3801,
+ .status = 0x0000,
+ .pNextOp = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
+ .startTime = 0x00000000,
+ .startTrigger.triggerType = 0x0,
+ .startTrigger.bEnaCmd = 0x0,
+ .startTrigger.triggerNo = 0x0,
+ .startTrigger.pastTrig = 0x0,
+ .condition.rule = 0x1,
+ .condition.nSkip = 0x0,
+ .pktConf.bFsOff = 0x0,
+ .pktConf.bUseCrc = 0x1,
+ .pktConf.bVarLen = 0x1,
+ .pktLen = 0x1E, // SET APPLICATION PAYLOAD LENGTH
+ .syncWord = 0x930B51DE,
+ .pPkt = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
+};
+
+// CMD_PROP_RX
+// Proprietary Mode Receive Command
+rfc_CMD_PROP_RX_t RF_cmdPropRx =
+{
+ .commandNo = 0x3802,
+ .status = 0x0000,
+ .pNextOp = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
+ .startTime = 0x00000000,
+ .startTrigger.triggerType = 0x0,
+ .startTrigger.bEnaCmd = 0x0,
+ .startTrigger.triggerNo = 0x0,
+ .startTrigger.pastTrig = 0x0,
+ .condition.rule = 0x1,
+ .condition.nSkip = 0x0,
+ .pktConf.bFsOff = 0x0,
+ .pktConf.bRepeatOk = 0x0,
+ .pktConf.bRepeatNok = 0x0,
+ .pktConf.bUseCrc = 0x1,
+ .pktConf.bVarLen = 0x1,
+ .pktConf.bChkAddress = 0x0,
+ .pktConf.endType = 0x0,
+ .pktConf.filterOp = 0x0,
+ .rxConf.bAutoFlushIgnored = 0x0,
+ .rxConf.bAutoFlushCrcErr = 0x0,
+ .rxConf.bIncludeHdr = 0x1,
+ .rxConf.bIncludeCrc = 0x0,
+ .rxConf.bAppendRssi = 0x0,
+ .rxConf.bAppendTimestamp = 0x0,
+ .rxConf.bAppendStatus = 0x1,
+ .syncWord = 0x930B51DE,
+ .maxPktLen = 0xFF, // MAKE SURE DATA ENTRY IS LARGE ENOUGH
+ .address0 = 0xAA,
+ .address1 = 0xBB,
+ .endTrigger.triggerType = 0x1,
+ .endTrigger.bEnaCmd = 0x0,
+ .endTrigger.triggerNo = 0x0,
+ .endTrigger.pastTrig = 0x0,
+ .endTime = 0x00000000,
+ .pQueue = 0, // INSERT APPLICABLE POINTER: (dataQueue_t*)&xxx
+ .pOutput = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
+};
+
+// CMD_TX_TEST
+// Transmitter Test Command
+rfc_CMD_TX_TEST_t RF_cmdTxTest =
+{
+ .commandNo = 0x0808,
+ .status = 0x0000,
+ .pNextOp = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
+ .startTime = 0x00000000,
+ .startTrigger.triggerType = 0x0,
+ .startTrigger.bEnaCmd = 0x0,
+ .startTrigger.triggerNo = 0x0,
+ .startTrigger.pastTrig = 0x0,
+ .condition.rule = 0x1,
+ .condition.nSkip = 0x0,
+ .config.bUseCw = 0x0,
+ .config.bFsOff = 0x1,
+ .config.whitenMode = 0x2,
+ .__dummy0 = 0x00,
+ .txWord = 0xAAAA,
+ .__dummy1 = 0x00,
+ .endTrigger.triggerType = 0x1,
+ .endTrigger.bEnaCmd = 0x0,
+ .endTrigger.triggerNo = 0x0,
+ .endTrigger.pastTrig = 0x0,
+ .syncWord = 0x930B51DE,
+ .endTime = 0x00000000,
+};
diff --git a/samples/rfBleConnect/src/smartrf_settings/smartrf_settings.h b/samples/rfBleConnect/src/smartrf_settings/smartrf_settings.h
new file mode 100644
index 0000000000..dff117386e
--- /dev/null
+++ b/samples/rfBleConnect/src/smartrf_settings/smartrf_settings.h
@@ -0,0 +1,31 @@
+#ifndef _SMARTRF_SETTINGS_H_
+#define _SMARTRF_SETTINGS_H_
+
+
+//*********************************************************************************
+// Generated by SmartRF Studio version 2.13.0 (build #164)
+// Tested for SimpleLink SDK version: CC13x2 SDK 2.40.xx.xx
+// Device: CC1352R Rev. 2.1
+//
+//*********************************************************************************
+
+#include <ti/devices/DeviceFamily.h>
+#include DeviceFamily_constructPath(driverlib/rf_mailbox.h)
+#include DeviceFamily_constructPath(driverlib/rf_common_cmd.h)
+#include DeviceFamily_constructPath(driverlib/rf_prop_cmd.h)
+#include <ti/drivers/rf/RF.h>
+
+// TI-RTOS RF Mode Object
+extern RF_Mode RF_prop;
+
+// RF Core API commands
+extern rfc_CMD_PROP_RADIO_DIV_SETUP_t RF_cmdPropRadioDivSetup;
+extern rfc_CMD_FS_t RF_cmdFs;
+extern rfc_CMD_PROP_TX_t RF_cmdPropTx;
+extern rfc_CMD_PROP_RX_t RF_cmdPropRx;
+extern rfc_CMD_TX_TEST_t RF_cmdTxTest;
+
+// RF Core API Overrides
+extern uint32_t pOverrides[];
+
+#endif // _SMARTRF_SETTINGS_H_
diff --git a/samples/rfBleConnect/src/smartrf_settings/smartrf_settings_ble.c b/samples/rfBleConnect/src/smartrf_settings/smartrf_settings_ble.c
new file mode 100644
index 0000000000..5c88dd1b91
--- /dev/null
+++ b/samples/rfBleConnect/src/smartrf_settings/smartrf_settings_ble.c
@@ -0,0 +1,512 @@
+//*********************************************************************************
+// Generated by SmartRF Studio version 2.13.0 (build #164)
+// Tested for SimpleLink SDK version: CC13x2 SDK 2.40.xx.xx
+// Device: CC1352R Rev. 2.1
+//
+//*********************************************************************************
+
+
+//*********************************************************************************
+// Parameter summary
+// Adv. Address: 010203040506
+// Adv. Data: dummy
+// BLE Channel: 17
+// Extended Header: 09 09 010203040506 babe
+// Frequency: 2440 MHz
+// PDU Payload length:: 30
+// TX Power: 5 dBm (requires define CCFG_FORCE_VDDR_HH = 0 in ccfg.c, see CC13xx/CC26xx Technical Reference Manual)
+// Whitening: true
+
+#include <stdint.h>
+
+#ifndef DeviceFamily_CC13X2
+#define DeviceFamily_CC13X2
+#endif
+#include <ti/devices/DeviceFamily.h>
+#include DeviceFamily_constructPath(driverlib/rf_mailbox.h)
+#include DeviceFamily_constructPath(driverlib/rf_common_cmd.h)
+#include DeviceFamily_constructPath(driverlib/rf_ble_cmd.h)
+#include <ti/drivers/rf/RF.h>
+#include DeviceFamily_constructPath(rf_patches/rf_patch_cpe_multi_protocol.h)
+#include "smartrf_settings_ble.h"
+
+#ifndef GAP_ADTYPE_FLAGS
+#define GAP_ADTYPE_FLAGS 0x01
+#endif
+
+#ifndef GAP_ADTYPE_FLAGS_GENERAL
+#define GAP_ADTYPE_FLAGS_GENERAL 0x02
+#endif
+
+#ifndef DEFAULT_DISCOVERABLE_MODE
+#define DEFAULT_DISCOVERABLE_MODE GAP_ADTYPE_FLAGS_GENERAL
+#endif
+
+#ifndef GAP_ADTYPE_FLAGS_BREDR_NOT_SUPPORTED
+#define GAP_ADTYPE_FLAGS_BREDR_NOT_SUPPORTED 0x04
+#endif
+
+#ifndef GAP_ADTYPE_16BIT_MORE
+#define GAP_ADTYPE_16BIT_MORE 0x02
+#endif
+
+#ifndef SIMPLEPROFILE_SERV_UUID
+#define SIMPLEPROFILE_SERV_UUID 0xfff0
+#endif
+
+#ifndef GAP_ADTYPE_LOCAL_NAME_COMPLETE
+#define GAP_ADTYPE_LOCAL_NAME_COMPLETE 0x09
+#endif
+
+#ifndef GAP_ADTYPE_SLAVE_CONN_INTERVAL_RANGE
+#define GAP_ADTYPE_SLAVE_CONN_INTERVAL_RANGE 0x12
+#endif
+
+#ifndef GAP_ADTYPE_POWER_LEVEL
+#define GAP_ADTYPE_POWER_LEVEL 0x0a
+#endif
+
+#ifndef LL_ADV_NONCONN_INTERVAL_MIN
+#define LL_ADV_NONCONN_INTERVAL_MIN 160
+#endif
+
+#ifndef DEFAULT_DESIRED_MIN_CONN_INTERVAL
+#define DEFAULT_DESIRED_MIN_CONN_INTERVAL LL_ADV_NONCONN_INTERVAL_MIN
+#endif
+
+#ifndef LL_ADV_NONCONN_INTERVAL_MAX
+#define LL_ADV_NONCONN_INTERVAL_MAX 16384
+#endif
+
+#ifndef DEFAULT_DESIRED_MAX_CONN_INTERVAL
+#define DEFAULT_DESIRED_MAX_CONN_INTERVAL LL_ADV_NONCONN_INTERVAL_MAX
+#endif
+
+#ifndef LO_UINT16
+#define LO_UINT16(a) ((a) & 0xFF)
+#endif
+
+#ifndef HI_UINT16
+#define HI_UINT16(a) (((a) >> 8) & 0xFF)
+#endif
+
+uint8_t deviceAddr[] = {
+ 0x55,
+ 0x44,
+ 0x33,
+ 0x22,
+ 0x11,
+ 0x00,
+};
+
+#if 0
+// Advertisement data
+static uint8_t advertData[] =
+{
+ 0x02, // length of this data
+ GAP_ADTYPE_FLAGS,
+ //DEFAULT_DISCOVERABLE_MODE | GAP_ADTYPE_FLAGS_BREDR_NOT_SUPPORTED,
+ DEFAULT_DISCOVERABLE_MODE | GAP_ADTYPE_FLAGS_BREDR_NOT_SUPPORTED,
+
+ // service UUID, to notify central devices what services are included
+ // in this peripheral
+ 0x03, // length of this data
+ GAP_ADTYPE_16BIT_MORE, // some of the UUID's, but not all
+ LO_UINT16(SIMPLEPROFILE_SERV_UUID),
+ HI_UINT16(SIMPLEPROFILE_SERV_UUID),
+};
+#endif
+
+
+#if 0
+// Scan Response Data
+static uint8_t scanRspData[] =
+{
+ // complete name
+ 17, // length of this data
+ GAP_ADTYPE_LOCAL_NAME_COMPLETE,
+ 'S',
+ 'i',
+ 'm',
+ 'p',
+ 'l',
+ 'e',
+ 'P',
+ 'e',
+ 'r',
+ 'i',
+ 'p',
+ 'h',
+ 'e',
+ 'r',
+ 'a',
+ 'l',
+
+ // connection interval range
+ 5, // length of this data
+ GAP_ADTYPE_SLAVE_CONN_INTERVAL_RANGE,
+ LO_UINT16(DEFAULT_DESIRED_MIN_CONN_INTERVAL), // 100ms
+ HI_UINT16(DEFAULT_DESIRED_MIN_CONN_INTERVAL),
+ LO_UINT16(DEFAULT_DESIRED_MAX_CONN_INTERVAL), // 1s
+ HI_UINT16(DEFAULT_DESIRED_MAX_CONN_INTERVAL),
+
+ // Tx power level
+ 2, // length of this data
+ GAP_ADTYPE_POWER_LEVEL,
+ 0 // 0dBm
+};
+#endif
+
+// TI-RTOS RF Mode Object
+RF_Mode RF_modeBle =
+{
+ .rfMode = RF_MODE_AUTO,
+ .cpePatchFxn = &rf_patch_cpe_multi_protocol,
+ .mcePatchFxn = 0,
+ .rfePatchFxn = 0,
+};
+
+// TX Power table
+// The RF_TxPowerTable_DEFAULT_PA_ENTRY and RF_TxPowerTable_HIGH_PA_ENTRY macro is defined in RF.h.
+// The following arguments are required:
+// RF_TxPowerTable_DEFAULT_PA_ENTRY(bias, gain, boost coefficient)
+// RF_TxPowerTable_HIGH_PA_ENTRY(bias, ibboost, boost, coefficient, ldoTrim)
+// See the Technical Reference Manual for further details about the "txPower" Command field.
+// The PA settings require the CCFG_FORCE_VDDR_HH = 0 unless stated otherwise.
+RF_TxPowerTable_Entry RF_BLE_txPowerTable[RF_BLE_TX_POWER_TABLE_SIZE] =
+{
+ {-20, RF_TxPowerTable_DEFAULT_PA_ENTRY(6, 3, 0, 2) },
+ {-15, RF_TxPowerTable_DEFAULT_PA_ENTRY(10, 3, 0, 3) },
+ {-10, RF_TxPowerTable_DEFAULT_PA_ENTRY(15, 3, 0, 5) },
+ {-5, RF_TxPowerTable_DEFAULT_PA_ENTRY(22, 3, 0, 9) },
+ {0, RF_TxPowerTable_DEFAULT_PA_ENTRY(19, 1, 0, 20) },
+ {1, RF_TxPowerTable_DEFAULT_PA_ENTRY(22, 1, 0, 20) },
+ {2, RF_TxPowerTable_DEFAULT_PA_ENTRY(25, 1, 0, 25) },
+ {3, RF_TxPowerTable_DEFAULT_PA_ENTRY(29, 1, 0, 28) },
+ {4, RF_TxPowerTable_DEFAULT_PA_ENTRY(35, 1, 0, 39) },
+ {5, RF_TxPowerTable_DEFAULT_PA_ENTRY(23, 0, 0, 57) },
+ RF_TxPowerTable_TERMINATION_ENTRY
+};
+
+// Overrides for CMD_BLE5_RADIO_SETUP
+uint32_t pOverridesCommon[] =
+{
+ // override_ble5_setup_override_common.xml
+ // DC/DC regulator: In Tx, use DCDCCTL5[3:0]=0x3 (DITHER_EN=0 and IPEAK=3).
+ (uint32_t)0x00F388D3,
+ // Bluetooth 5: Set pilot tone length to 20 us Common
+ HW_REG_OVERRIDE(0x6024,0x2E20),
+ // Bluetooth 5: Compensate for reduced pilot tone length
+ (uint32_t)0x01280263,
+ // Bluetooth 5: Default to no CTE.
+ HW_REG_OVERRIDE(0x5328,0x0000),
+ (uint32_t)0xFFFFFFFF
+};
+
+
+// Overrides for CMD_BLE5_RADIO_SETUP
+uint32_t pOverrides1Mbps[] =
+{
+ // override_ble5_setup_override_1mbps.xml
+ // Bluetooth 5: Set pilot tone length to 20 us
+ HW_REG_OVERRIDE(0x5320,0x03C0),
+ // Bluetooth 5: Compensate syncTimeadjust
+ (uint32_t)0x015302A3,
+ (uint32_t)0xFFFFFFFF
+};
+
+
+// Overrides for CMD_BLE5_RADIO_SETUP
+uint32_t pOverrides2Mbps[] =
+{
+ // override_ble5_setup_override_2mbps.xml
+ // Bluetooth 5: Set pilot tone length to 20 us
+ HW_REG_OVERRIDE(0x5320,0x03C0),
+ // Bluetooth 5: Compensate syncTimeAdjust
+ (uint32_t)0x00F102A3,
+ (uint32_t)0xFFFFFFFF
+};
+
+
+// Overrides for CMD_BLE5_RADIO_SETUP
+uint32_t pOverridesCoded[] =
+{
+ // override_ble5_setup_override_coded.xml
+ // Bluetooth 5: Set pilot tone length to 20 us
+ HW_REG_OVERRIDE(0x5320,0x03C0),
+ // Bluetooth 5: Compensate syncTimeadjust
+ (uint32_t)0x07A902A3,
+ // Rx: Set AGC reference level to 0x1B (default: 0x2E)
+ HW_REG_OVERRIDE(0x609C,0x001B),
+ (uint32_t)0xFFFFFFFF
+};
+
+
+// CMD_BLE5_RADIO_SETUP
+// Bluetooth 5 Radio Setup Command for all PHYs
+rfc_CMD_BLE5_RADIO_SETUP_t RF_ble_cmdRadioSetup =
+{
+ .commandNo = 0x1820,
+ .status = 0x0000,
+ .pNextOp = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
+ .startTime = 0x00000000,
+ .startTrigger.triggerType = 0x0,
+ .startTrigger.bEnaCmd = 0x0,
+ .startTrigger.triggerNo = 0x0,
+ .startTrigger.pastTrig = 0x0,
+ .condition.rule = 0x1,
+ .condition.nSkip = 0x0,
+ .defaultPhy.mainMode = 0x0,
+ .defaultPhy.coding = 0x0,
+ .loDivider = 0x00,
+ .config.frontEndMode = 0x0,
+ .config.biasMode = 0x1,
+ .config.analogCfgMode = 0x0,
+ .config.bNoFsPowerUp = 0x0,
+ .txPower = 0x7217,
+ .pRegOverrideCommon = pOverridesCommon,
+ .pRegOverride1Mbps = pOverrides1Mbps,
+ .pRegOverride2Mbps = pOverrides2Mbps,
+ .pRegOverrideCoded = pOverridesCoded,
+};
+
+
+// CMD_FS
+// Frequency Synthesizer Programming Command
+rfc_CMD_FS_t RF_ble_cmdFs =
+{
+ .commandNo = 0x0803,
+ .status = 0x0000,
+ .pNextOp = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
+ .startTime = 0x00000000,
+ .startTrigger.triggerType = 0x0,
+ .startTrigger.bEnaCmd = 0x0,
+ .startTrigger.triggerNo = 0x0,
+ .startTrigger.pastTrig = 0x0,
+ .condition.rule = 0x1,
+ .condition.nSkip = 0x0,
+ .frequency = 0x0988,
+ .fractFreq = 0x0000,
+ .synthConf.bTxMode = 0x0,
+ .synthConf.refFreq = 0x0,
+ .__dummy0 = 0x00,
+ .__dummy1 = 0x00,
+ .__dummy2 = 0x00,
+ .__dummy3 = 0x0000,
+};
+
+
+// Structure for CMD_BLE5_GENERIC_RX.pParams
+rfc_bleGenericRxPar_t bleGenericRxPar =
+{
+ .pRxQ = 0, // INSERT APPLICABLE POINTER: (dataQueue_t*)&xxx
+ .rxConfig.bAutoFlushIgnored = 0x0,
+ .rxConfig.bAutoFlushCrcErr = 0x0,
+ .rxConfig.bAutoFlushEmpty = 0x0,
+ .rxConfig.bIncludeLenByte = 0x1,
+ .rxConfig.bIncludeCrc = 0x1,
+ .rxConfig.bAppendRssi = 0x1,
+ .rxConfig.bAppendStatus = 0x1,
+ .rxConfig.bAppendTimestamp = 0x0,
+ .bRepeat = 0x01,
+ .__dummy0 = 0x0000,
+ .accessAddress = 0x8E89BED6,
+ .crcInit0 = 0x55,
+ .crcInit1 = 0x55,
+ .crcInit2 = 0x55,
+ .endTrigger.triggerType = 0x1,
+ .endTrigger.bEnaCmd = 0x0,
+ .endTrigger.triggerNo = 0x0,
+ .endTrigger.pastTrig = 0x0,
+ .endTime = 0x00000001,
+};
+
+// CMD_BLE5_GENERIC_RX
+// Bluetooth 5 Generic Receiver Command
+rfc_CMD_BLE5_GENERIC_RX_t RF_ble_cmdBleGenericRx =
+{
+ .commandNo = 0x1829,
+ .status = 0x0000,
+ .pNextOp = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
+ .startTime = 0x00000000,
+ .startTrigger.triggerType = 0x0,
+ .startTrigger.bEnaCmd = 0x0,
+ .startTrigger.triggerNo = 0x0,
+ .startTrigger.pastTrig = 0x0,
+ .condition.rule = 0x1,
+ .condition.nSkip = 0x0,
+ .channel = 0x8C,
+ .whitening.init = 0x51,
+ .whitening.bOverride = 0x1,
+ .phyMode.mainMode = 0x0,
+ .phyMode.coding = 0x0,
+ .rangeDelay = 0x00,
+ .txPower = 0x0000,
+ .pParams = &bleGenericRxPar,
+ .pOutput = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
+ .tx20Power = 0x00000000,
+};
+
+
+// Structure for CMD_BLE_ADV_NC.pParams
+rfc_bleAdvPar_t bleAdvNcPar =
+{
+ .pRxQ = 0, // INSERT APPLICABLE POINTER: (dataQueue_t*)&xxx
+ .rxConfig.bAutoFlushIgnored = 0x0,
+ .rxConfig.bAutoFlushCrcErr = 0x0,
+ .rxConfig.bAutoFlushEmpty = 0x0,
+ .rxConfig.bIncludeLenByte = 0x0,
+ .rxConfig.bIncludeCrc = 0x0,
+ .rxConfig.bAppendRssi = 0x0,
+ .rxConfig.bAppendStatus = 0x0,
+ .rxConfig.bAppendTimestamp = 0x0,
+ .advConfig.advFilterPolicy = 0x0,
+ .advConfig.deviceAddrType = 0x0,
+ .advConfig.peerAddrType = 0x0,
+ .advConfig.bStrictLenFilter = 0x0,
+ .advConfig.chSel = 0x0,
+ .advConfig.privIgnMode = 0x0,
+ .advConfig.rpaMode = 0x0,
+ .advLen = 0x18,
+ .scanRspLen = 0x00,
+ .pAdvData = 0x0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
+ .pScanRspData = 0x0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
+ .pDeviceAddress = (uint16_t *)deviceAddr, // INSERT APPLICABLE POINTER: (uint16_t*)&xxx
+ .pWhiteList = 0, // INSERT APPLICABLE POINTER: (uint32_t*)&xxx
+ .behConfig.scanRspEndType = 0x0,
+ .__dummy0 = 0x0000,
+ .endTrigger.triggerType = 0x1,
+ .endTrigger.bEnaCmd = 0x0,
+ .endTrigger.triggerNo = 0x0,
+ .endTrigger.pastTrig = 0x0,
+ .endTime = 0x00000000,
+};
+
+// CMD_BLE_ADV_NC
+// BLE Non-Connectable Advertiser Command
+rfc_CMD_BLE_ADV_NC_t RF_ble_cmdBleAdvNc =
+{
+ .commandNo = 0x1805,
+ .status = 0x0000,
+ .pNextOp = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
+ .startTime = 0x00000000,
+ .startTrigger.triggerType = 0x0,
+ .startTrigger.bEnaCmd = 0x0,
+ .startTrigger.triggerNo = 0x0,
+ .startTrigger.pastTrig = 0x0,
+ .condition.rule = 0x1,
+ .condition.nSkip = 0x0,
+ .channel = 0x8C,
+ .whitening.init = 0x51,
+ .whitening.bOverride = 0x1,
+ .pParams = &bleAdvNcPar,
+ .pOutput = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
+};
+
+// Structure for CMD_BLE_ADV_NC.pParams
+rfc_bleAdvPar_t bleAdvPar =
+{
+ .pRxQ = 0, // INSERT APPLICABLE POINTER: (dataQueue_t*)&xxx
+ .rxConfig.bAutoFlushIgnored = 0x1,
+ .rxConfig.bAutoFlushCrcErr = 0x1,
+ .rxConfig.bAutoFlushEmpty = 0x0,
+ .rxConfig.bIncludeLenByte = 0x0,
+ .rxConfig.bIncludeCrc = 0x0,
+ .rxConfig.bAppendRssi = 0x0,
+ .rxConfig.bAppendStatus = 0x0,
+ .rxConfig.bAppendTimestamp = 0x0,
+ .advConfig.advFilterPolicy = 0x0,
+ .advConfig.deviceAddrType = 0x0,
+ .advConfig.peerAddrType = 0x0,
+ .advConfig.bStrictLenFilter = 0x1,
+ .advConfig.chSel = 0x1,
+ .advConfig.privIgnMode = 0x0,
+ .advConfig.rpaMode = 0x0,
+ .advLen = 0x00,
+ .scanRspLen = 0x00,
+ .pAdvData = 0x0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
+ .pScanRspData = 0x0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
+ .pDeviceAddress = 0x0, // INSERT APPLICABLE POINTER: (uint16_t*)&xxx
+ .pWhiteList = 0, // INSERT APPLICABLE POINTER: (uint32_t*)&xxx
+ .behConfig.scanRspEndType = 0x0,
+ .__dummy0 = 0x0000,
+ .endTrigger.triggerType = TRIG_NEVER,
+ .endTrigger.bEnaCmd = 0x0,
+ .endTrigger.triggerNo = 0x0,
+ .endTrigger.pastTrig = 0x0,
+ .endTime = 0x00000000,
+};
+
+#if 0
+rfc_CMD_BLE_ADV_t RF_ble_cmdBleAdv = {
+ .commandNo = CMD_BLE_ADV,
+ .status = 0x0000,
+ .pNextOp = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
+ .startTime = 0x00000000,
+ .startTrigger.triggerType = 0x0,
+ .startTrigger.bEnaCmd = 0x0,
+ .startTrigger.triggerNo = 0x0,
+ .startTrigger.pastTrig = 0x0,
+ .condition.rule = 0x1,
+ .condition.nSkip = 0x0,
+ .channel = 0x8C,
+ .whitening.init = 0x51,
+ .whitening.bOverride = 0x1,
+ .pParams = 0x0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
+ .pOutput = 0x0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
+};
+#endif
+
+// Structure for CMD_BLE5_ADV_AUX.pParams
+rfc_ble5AdvAuxPar_t ble5AdvAuxPar =
+{
+ .pRxQ = 0, // INSERT APPLICABLE POINTER: (dataQueue_t*)&xxx
+ .rxConfig.bAutoFlushIgnored = 0x0,
+ .rxConfig.bAutoFlushCrcErr = 0x0,
+ .rxConfig.bAutoFlushEmpty = 0x0,
+ .rxConfig.bIncludeLenByte = 0x0,
+ .rxConfig.bIncludeCrc = 0x0,
+ .rxConfig.bAppendRssi = 0x0,
+ .rxConfig.bAppendStatus = 0x0,
+ .rxConfig.bAppendTimestamp = 0x0,
+ .advConfig.advFilterPolicy = 0x0,
+ .advConfig.deviceAddrType = 0x0,
+ .advConfig.targetAddrType = 0x0,
+ .advConfig.bStrictLenFilter = 0x0,
+ .advConfig.bDirected = 0x0,
+ .advConfig.privIgnMode = 0x0,
+ .advConfig.rpaMode = 0x0,
+ .behConfig.scanRspEndType = 0x0,
+ .auxPtrTargetType = 0x00,
+ .auxPtrTargetTime = 0x00000000,
+ .pAdvPkt = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
+ .pRspPkt = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
+ .pDeviceAddress = 0, // deviceAddr, // INSERT APPLICABLE POINTER: (uint16_t*)&xxx
+ .pWhiteList = 0, // INSERT APPLICABLE POINTER: (uint32_t*)&xxx
+};
+
+// CMD_BLE5_ADV_AUX
+// Bluetooth 5 Secondary Channel Advertiser Command
+rfc_CMD_BLE5_ADV_AUX_t RF_ble_cmdBle5AdvAux =
+{
+ .commandNo = 0x1824,
+ .status = 0x0000,
+ .pNextOp = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
+ .startTime = 0x00000000,
+ .startTrigger.triggerType = 0x0,
+ .startTrigger.bEnaCmd = 0x0,
+ .startTrigger.triggerNo = 0x0,
+ .startTrigger.pastTrig = 0x0,
+ .condition.rule = 0x1,
+ .condition.nSkip = 0x0,
+ .channel = 0x8C,
+ .whitening.init = 0x51,
+ .whitening.bOverride = 0x1,
+ .phyMode.mainMode = 0x0,
+ .phyMode.coding = 0x0,
+ .rangeDelay = 0x00,
+ .txPower = 0x0000,
+ .pParams = &ble5AdvAuxPar,
+ .pOutput = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
+ .tx20Power = 0x00000000,
+};
diff --git a/samples/rfBleConnect/src/smartrf_settings/smartrf_settings_ble.h b/samples/rfBleConnect/src/smartrf_settings/smartrf_settings_ble.h
new file mode 100644
index 0000000000..1c8d5c2e51
--- /dev/null
+++ b/samples/rfBleConnect/src/smartrf_settings/smartrf_settings_ble.h
@@ -0,0 +1,42 @@
+#ifndef _SMARTRF_SETTINGS_BLE_H_
+#define _SMARTRF_SETTINGS_BLE_H_
+
+
+//*********************************************************************************
+// Generated by SmartRF Studio version 2.13.0 (build #164)
+// Tested for SimpleLink SDK version: CC13x2 SDK 2.40.xx.xx
+// Device: CC1352R Rev. 2.1
+//
+//*********************************************************************************
+
+#include <ti/devices/DeviceFamily.h>
+#include DeviceFamily_constructPath(driverlib/rf_mailbox.h)
+#include DeviceFamily_constructPath(driverlib/rf_common_cmd.h)
+#include DeviceFamily_constructPath(driverlib/rf_ble_cmd.h)
+#include <ti/drivers/rf/RF.h>
+
+
+// TX Power table size definition
+#define RF_BLE_TX_POWER_TABLE_SIZE 11
+
+// TX Power Table Object
+extern RF_TxPowerTable_Entry RF_BLE_txPowerTable[];
+
+// TI-RTOS RF Mode Object
+extern RF_Mode RF_modeBle;
+
+// RF Core API commands
+extern rfc_CMD_BLE5_RADIO_SETUP_t RF_ble_cmdRadioSetup;
+extern rfc_CMD_FS_t RF_ble_cmdFs;
+extern rfc_bleAdvPar_t bleAdvPar;
+extern rfc_CMD_BLE_ADV_NC_t RF_ble_cmdBleAdvNc;
+extern rfc_CMD_BLE5_ADV_AUX_t RF_ble_cmdBle5AdvAux;
+extern rfc_CMD_BLE5_GENERIC_RX_t RF_ble_cmdBleGenericRx; //For backward compatibility
+
+// RF Core API Overrides
+extern uint32_t pOverridesCommon[];
+extern uint32_t pOverrides1Mbps[];
+extern uint32_t pOverrides2Mbps[];
+extern uint32_t pOverridesCoded[];
+
+#endif // _SMARTRF_SETTINGS_BLE_H_
diff --git a/samples/rfBleConnect/src/smartrf_settings/smartrf_settings_predefined.c b/samples/rfBleConnect/src/smartrf_settings/smartrf_settings_predefined.c
new file mode 100644
index 0000000000..2534cf3fd0
--- /dev/null
+++ b/samples/rfBleConnect/src/smartrf_settings/smartrf_settings_predefined.c
@@ -0,0 +1,374 @@
+//*********************************************************************************
+// Generated by SmartRF Studio version 2.13.0 (build #164)
+// Tested for SimpleLink SDK version: CC13x2 SDK 2.40.xx.xx
+// Device: CC1352R Rev. 2.1
+//
+//*********************************************************************************
+
+#ifndef DeviceFamily_CC13X2
+#define DeviceFamily_CC13X2
+#endif
+#include <ti/devices/DeviceFamily.h>
+#include DeviceFamily_constructPath(driverlib/rf_mailbox.h)
+#include DeviceFamily_constructPath(driverlib/rf_common_cmd.h)
+#include DeviceFamily_constructPath(driverlib/rf_prop_cmd.h)
+//#include DeviceFamily_constructPath(rf_patches/rf_patch_cpe_prop.h)
+#include DeviceFamily_constructPath(rf_patches/rf_patch_cpe_multi_protocol.h)
+#include <ti/drivers/rf/RF.h>
+#include "smartrf_settings_predefined.h"
+
+// TI-RTOS RF Mode Object
+RF_Mode RF_prop_fsk =
+{
+ .rfMode = RF_MODE_AUTO,
+ .cpePatchFxn = &rf_patch_cpe_multi_protocol, //&rf_patch_cpe_prop,
+ .mcePatchFxn = 0,
+ .rfePatchFxn = 0,
+};
+
+RF_Mode RF_prop_sl_lr =
+{
+ .rfMode = RF_MODE_AUTO,
+ .cpePatchFxn = &rf_patch_cpe_multi_protocol, //&rf_patch_cpe_prop,
+ .mcePatchFxn = 0,
+ .rfePatchFxn = 0,
+};
+
+RF_Mode RF_prop_fsk_200kbps =
+{
+ .rfMode = RF_MODE_AUTO,
+ .cpePatchFxn = &rf_patch_cpe_multi_protocol, //&rf_patch_cpe_prop,
+ .mcePatchFxn = 0,
+ .rfePatchFxn = 0,
+};
+
+// TX Power table
+// The RF_TxPowerTable_DEFAULT_PA_ENTRY and RF_TxPowerTable_HIGH_PA_ENTRY macro is defined in RF.h.
+// The following arguments are required:
+// RF_TxPowerTable_DEFAULT_PA_ENTRY(bias, gain, boost coefficient)
+// RF_TxPowerTable_HIGH_PA_ENTRY(bias, ibboost, boost, coefficient, ldoTrim)
+// See the Technical Reference Manual for further details about the "txPower" Command field.
+// The PA settings require the CCFG_FORCE_VDDR_HH = 0 unless stated otherwise.
+RF_TxPowerTable_Entry RF_PROP_txPowerTable[RF_PROP_TX_POWER_TABLE_SIZE] =
+{
+ {-20, RF_TxPowerTable_DEFAULT_PA_ENTRY(0, 3, 0, 2) },
+ {-15, RF_TxPowerTable_DEFAULT_PA_ENTRY(1, 3, 0, 3) },
+ {-10, RF_TxPowerTable_DEFAULT_PA_ENTRY(2, 3, 0, 5) },
+ {-5, RF_TxPowerTable_DEFAULT_PA_ENTRY(4, 3, 0, 5) },
+ {0, RF_TxPowerTable_DEFAULT_PA_ENTRY(8, 3, 0, 8) },
+ {1, RF_TxPowerTable_DEFAULT_PA_ENTRY(9, 3, 0, 9) },
+ {2, RF_TxPowerTable_DEFAULT_PA_ENTRY(10, 3, 0, 9) },
+ {3, RF_TxPowerTable_DEFAULT_PA_ENTRY(11, 3, 0, 10) },
+ {4, RF_TxPowerTable_DEFAULT_PA_ENTRY(13, 3, 0, 11) },
+ {5, RF_TxPowerTable_DEFAULT_PA_ENTRY(14, 3, 0, 14) },
+ {6, RF_TxPowerTable_DEFAULT_PA_ENTRY(17, 3, 0, 16) },
+ {7, RF_TxPowerTable_DEFAULT_PA_ENTRY(20, 3, 0, 19) },
+ {8, RF_TxPowerTable_DEFAULT_PA_ENTRY(24, 3, 0, 22) },
+ {9, RF_TxPowerTable_DEFAULT_PA_ENTRY(28, 3, 0, 31) },
+ {10, RF_TxPowerTable_DEFAULT_PA_ENTRY(18, 2, 0, 31) },
+ {11, RF_TxPowerTable_DEFAULT_PA_ENTRY(26, 2, 0, 51) },
+ {12, RF_TxPowerTable_DEFAULT_PA_ENTRY(16, 0, 0, 82) },
+ // The original PA value (12.5 dBm) has been rounded to an integer value.
+ {13, RF_TxPowerTable_DEFAULT_PA_ENTRY(36, 0, 0, 89) },
+ // This setting requires CCFG_FORCE_VDDR_HH = 1.
+ {14, RF_TxPowerTable_DEFAULT_PA_ENTRY(63, 0, 1, 0) },
+ RF_TxPowerTable_TERMINATION_ENTRY
+};
+
+// Overrides for CMD_PROP_RADIO_DIV_SETUP FSK
+uint32_t pOverrides_fsk[] =
+{
+ // override_prop_common.xml
+ // DC/DC regulator: In Tx, use DCDCCTL5[3:0]=0x7 (DITHER_EN=0 and IPEAK=7).
+ (uint32_t)0x00F788D3,
+ // override_tc106.xml
+ // Tx: Configure PA ramp time, PACTL2.RC=0x3 (in ADI0, set PACTL2[4:3]=0x3)
+ ADI_2HALFREG_OVERRIDE(0,16,0x8,0x8,17,0x1,0x1),
+ // Rx: Set AGC reference level to 0x1A (default: 0x2E)
+ HW_REG_OVERRIDE(0x609C,0x001A),
+ // Rx: Set RSSI offset to adjust reported RSSI by -1 dB (default: -2), trimmed for external bias and differential configuration
+ (uint32_t)0x000188A3,
+ // Rx: Set anti-aliasing filter bandwidth to 0xD (in ADI0, set IFAMPCTL3[7:4]=0xD)
+ ADI_HALFREG_OVERRIDE(0,61,0xF,0xD),
+ // Tx: Set wait time before turning off ramp to 0x1A (default: 0x1F)
+ HW_REG_OVERRIDE(0x6028,0x001A),
+#if (CCFG_FORCE_VDDR_HH)
+ // TX power override
+ // Tx: Set PA trim to max to maximize its output power (in ADI0, set PACTL0=0xF8)
+ ADI_REG_OVERRIDE(0,12,0xF8),
+#endif
+ (uint32_t)0xFFFFFFFF,
+};
+
+// Overrides for CMD_RADIO_DIV_SETUP SIMPLELINK LONGRANGE
+uint32_t pOverrides_sl_lr[] =
+{
+ // override_prop_common.xml
+ // DC/DC regulator: In Tx, use DCDCCTL5[3:0]=0x7 (DITHER_EN=0 and IPEAK=7).
+ (uint32_t)0x00F788D3,
+ // override_phy_simplelink_long_range_dsss2.xml
+ // PHY: Configure DSSS SF=2 for payload data
+ HW_REG_OVERRIDE(0x5068,0x0100), //DSSSx2 5kbps
+ //HW_REG_OVERRIDE(0x5068,0x030C), // DSSSx4 2.5kbps
+ //HW_REG_OVERRIDE(0x5068,0x073C), // DSSSx8 1.25kbps
+ // override_tc480_tc481_tc482.xml
+ // Tx: Configure PA ramp time, PACTL2.RC=0x3 (in ADI0, set PACTL2[4:3]=0x3)
+ ADI_2HALFREG_OVERRIDE(0,16,0x8,0x8,17,0x1,0x1),
+ // Rx: Set AGC reference level to 0x17 (default: 0x2E)
+ HW_REG_OVERRIDE(0x609C,0x0017),
+ // Rx: Set RSSI offset to adjust reported RSSI by -2 dB (default: -2), trimmed for external bias and differential configuration
+ (uint32_t)0x000288A3,
+ // Rx: Set anti-aliasing filter bandwidth to 0xD (in ADI0, set IFAMPCTL3[7:4]=0xD)
+ ADI_HALFREG_OVERRIDE(0,61,0xF,0xD),
+ // Tx: Set wait time before turning off ramp to 0x1A (default: 0x1F)
+ HW_REG_OVERRIDE(0x6028,0x001A),
+#if (CCFG_FORCE_VDDR_HH)
+ // TX power override
+ // Tx: Set PA trim to max to maximize its output power (in ADI0, set PACTL0=0xF8)
+ ADI_REG_OVERRIDE(0,12,0xF8),
+#endif
+ (uint32_t)0xFFFFFFFF,
+};
+
+// Overrides for CMD_PROP_RADIO_DIV_SETUP FSK 200KBPS
+uint32_t pOverrides_fsk_200kbps[] =
+{
+ // override_prop_common.xml
+ // DC/DC regulator: In Tx, use DCDCCTL5[3:0]=0x7 (DITHER_EN=0 and IPEAK=7).
+ (uint32_t)0x00F788D3,
+ // override_tc146.xml
+ // Tx: Configure PA ramp time, PACTL2.RC=0x3 (in ADI0, set PACTL2[4:3]=0x3)
+ ADI_2HALFREG_OVERRIDE(0,16,0x8,0x8,17,0x1,0x1),
+ // Tx: Configure PA ramping, set wait time before turning off (0x1A ticks of 16/24 us = 17.3 us).
+ HW_REG_OVERRIDE(0x6028,0x001A),
+ // Rx: Set AGC reference level to 0x16 (default: 0x2E)
+ HW_REG_OVERRIDE(0x609C,0x0016),
+ // Rx: Set RSSI offset to adjust reported RSSI by -1 dB (default: -2), trimmed for external bias and differential configuration
+ (uint32_t)0x000188A3,
+ // Rx: Set anti-aliasing filter bandwidth to 0x8 (in ADI0, set IFAMPCTL3[7:4]=0x8)
+ ADI_HALFREG_OVERRIDE(0,61,0xF,0x8),
+#if (CCFG_FORCE_VDDR_HH)
+ // TX power override
+ // Tx: Set PA trim to max to maximize its output power (in ADI0, set PACTL0=0xF8)
+ ADI_REG_OVERRIDE(0,12,0xF8),
+#endif
+ (uint32_t)0xFFFFFFFF
+};
+
+// CMD_PROP_RADIO_DIV_SETUP FSK
+rfc_CMD_PROP_RADIO_DIV_SETUP_t RF_cmdPropRadioDivSetup_fsk =
+{
+ .commandNo = 0x3807,
+ .status = 0x0000,
+ .pNextOp = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
+ .startTime = 0x00000000,
+ .startTrigger.triggerType = 0x0,
+ .startTrigger.bEnaCmd = 0x0,
+ .startTrigger.triggerNo = 0x0,
+ .startTrigger.pastTrig = 0x0,
+ .condition.rule = 0x1,
+ .condition.nSkip = 0x0,
+ .modulation.modType = 0x1,
+ .modulation.deviation = 0x64,
+ .modulation.deviationStepSz = 0x0,
+ .symbolRate.preScale = 0xF,
+ .symbolRate.rateWord = 0x8000,
+ .symbolRate.decimMode = 0x0,
+ .rxBw = 0x52,
+ .preamConf.nPreamBytes = 0x4,
+ .preamConf.preamMode = 0x0,
+ .formatConf.nSwBits = 0x20,
+ .formatConf.bBitReversal = 0x0,
+ .formatConf.bMsbFirst = 0x1,
+ .formatConf.fecMode = 0x0,
+ .formatConf.whitenMode = 0x0,
+ .config.frontEndMode = 0x0,
+ .config.biasMode = 0x1,
+ .config.analogCfgMode = 0x0,
+ .config.bNoFsPowerUp = 0x0,
+ .txPower = 0x013F,
+ .pRegOverride = pOverrides_fsk,
+ .centerFreq = 0x0364,
+ .intFreq = 0x8000,
+ .loDivider = 0x05,
+};
+
+// CMD_PROP_RADIO_DIV_SETUP SIMPLELING LONGRANGE
+rfc_CMD_PROP_RADIO_DIV_SETUP_t RF_cmdPropRadioDivSetup_sl_lr =
+{
+ .commandNo = 0x3807,
+ .status = 0x0000,
+ .pNextOp = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
+ .startTime = 0x00000000,
+ .startTrigger.triggerType = 0x0,
+ .startTrigger.bEnaCmd = 0x0,
+ .startTrigger.triggerNo = 0x0,
+ .startTrigger.pastTrig = 0x0,
+ .condition.rule = 0x1,
+ .condition.nSkip = 0x0,
+ .modulation.modType = 0x1,
+ .modulation.deviation = 0x14,
+ .modulation.deviationStepSz = 0x0,
+ .symbolRate.preScale = 0xF,
+ .symbolRate.rateWord = 0x3333,
+ .symbolRate.decimMode = 0x0,
+ .rxBw = 0x4C,
+ .preamConf.nPreamBytes = 0x2,
+ .preamConf.preamMode = 0x0,
+ .formatConf.nSwBits = 0x20,
+ .formatConf.bBitReversal = 0x0,
+ .formatConf.bMsbFirst = 0x0,
+ .formatConf.fecMode = 0x8,
+ .formatConf.whitenMode = 0x1,
+ .config.frontEndMode = 0x0,
+ .config.biasMode = 0x1,
+ .config.analogCfgMode = 0x0,
+ .config.bNoFsPowerUp = 0x0,
+ .txPower = 0x013F,
+ .pRegOverride = pOverrides_sl_lr,
+ .centerFreq = 0x0364,
+ .intFreq = 0x8000,
+ .loDivider = 0x05,
+};
+
+// CMD_PROP_RADIO_DIV_SETUP FSK 200 KBPS
+// Proprietary Mode Radio Setup Command for All Frequency Bands
+rfc_CMD_PROP_RADIO_DIV_SETUP_t RF_cmdPropRadioDivSetup_fsk_200kbps =
+{
+ .commandNo = 0x3807,
+ .status = 0x0000,
+ .pNextOp = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
+ .startTime = 0x00000000,
+ .startTrigger.triggerType = 0x0,
+ .startTrigger.bEnaCmd = 0x0,
+ .startTrigger.triggerNo = 0x0,
+ .startTrigger.pastTrig = 0x0,
+ .condition.rule = 0x1,
+ .condition.nSkip = 0x0,
+ .modulation.modType = 0x1,
+ .modulation.deviation = 0xC8,
+ .modulation.deviationStepSz = 0x0,
+ .symbolRate.preScale = 0xF,
+ .symbolRate.rateWord = 0x20000,
+ .symbolRate.decimMode = 0x0,
+ .rxBw = 0x59,
+ .preamConf.nPreamBytes = 0x7,
+ .preamConf.preamMode = 0x0,
+ .formatConf.nSwBits = 0x18,
+ .formatConf.bBitReversal = 0x0,
+ .formatConf.bMsbFirst = 0x1,
+ .formatConf.fecMode = 0x0,
+ .formatConf.whitenMode = 0x7,
+ .config.frontEndMode = 0x0,
+ .config.biasMode = 0x1,
+ .config.analogCfgMode = 0x0,
+ .config.bNoFsPowerUp = 0x0,
+ .txPower = 0x013F,
+ .pRegOverride = pOverrides_fsk_200kbps,
+ .centerFreq = 0x0364,
+ .intFreq = 0x0999,
+ .loDivider = 0x05
+};
+
+// CMD_FS
+rfc_CMD_FS_t RF_cmdFs_preDef =
+{
+ .commandNo = 0x0803,
+ .status = 0x0000,
+ .pNextOp = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
+ .startTime = 0x00000000,
+ .startTrigger.triggerType = 0x0,
+ .startTrigger.bEnaCmd = 0x0,
+ .startTrigger.triggerNo = 0x0,
+ .startTrigger.pastTrig = 0x0,
+ .condition.rule = 0x1,
+ .condition.nSkip = 0x0,
+ .frequency = 0x0364,
+ .fractFreq = 0x0000,
+ .synthConf.bTxMode = 0x0,
+ .synthConf.refFreq = 0x0,
+ .__dummy0 = 0x00,
+ .__dummy1 = 0x00,
+ .__dummy2 = 0x00,
+ .__dummy3 = 0x0000,
+};
+
+// CMD_PROP_TX_ADV
+rfc_CMD_PROP_TX_ADV_t RF_cmdPropTxAdv_preDef =
+{
+ .commandNo = 0x3803,
+ .status = 0x0000,
+ .pNextOp = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
+ .startTime = 0x00000000,
+ .startTrigger.triggerType = 0x2,
+ .startTrigger.bEnaCmd = 0x0,
+ .startTrigger.triggerNo = 0x0,
+ .startTrigger.pastTrig = 0x1,
+ .condition.rule = 0x1,
+ .condition.nSkip = 0x0,
+ .pktConf.bFsOff = 0x0,
+ .pktConf.bUseCrc = 0x1,
+ .pktConf.bCrcIncSw = 0x0,
+ .pktConf.bCrcIncHdr = 0x0,
+ .numHdrBits = 0x10,
+ .pktLen = 0x0014,
+ .startConf.bExtTxTrig = 0x0,
+ .startConf.inputMode = 0x0,
+ .startConf.source = 0x0,
+ .preTrigger.triggerType = 0x4,
+ .preTrigger.bEnaCmd = 0x0,
+ .preTrigger.triggerNo = 0x0,
+ .preTrigger.pastTrig = 0x1,
+ .preTime = 0x00000000,
+ .syncWord = 0x0055904E,
+ .pPkt = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
+};
+
+// CMD_PROP_RX_ADV
+rfc_CMD_PROP_RX_ADV_t RF_cmdPropRxAdv_preDef =
+{
+ .commandNo = 0x3804,
+ .status = 0x0000,
+ .pNextOp = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
+ .startTime = 0x00000000,
+ .startTrigger.triggerType = 0x0,
+ .startTrigger.bEnaCmd = 0x0,
+ .startTrigger.triggerNo = 0x0,
+ .startTrigger.pastTrig = 0x0,
+ .condition.rule = 0x1,
+ .condition.nSkip = 0x0,
+ .pktConf.bFsOff = 0x0,
+ .pktConf.bRepeatOk = 0x0,
+ .pktConf.bRepeatNok = 0x0,
+ .pktConf.bUseCrc = 0x1,
+ .pktConf.bCrcIncSw = 0x0,
+ .pktConf.bCrcIncHdr = 0x0,
+ .pktConf.endType = 0x0,
+ .pktConf.filterOp = 0x1,
+ .rxConf.bAutoFlushIgnored = 0x0,
+ .rxConf.bAutoFlushCrcErr = 0x0,
+ .rxConf.bIncludeHdr = 0x1,
+ .rxConf.bIncludeCrc = 0x0,
+ .rxConf.bAppendRssi = 0x0,
+ .rxConf.bAppendTimestamp = 0x0,
+ .rxConf.bAppendStatus = 0x0,
+ .syncWord0 = 0x0055904E,
+ .syncWord1 = 0x00000000,
+ .maxPktLen = 0x00FF,
+ .hdrConf.numHdrBits = 0x10,
+ .hdrConf.lenPos = 0x0,
+ .hdrConf.numLenBits = 0x8,
+ .addrConf.addrType = 0x0,
+ .addrConf.addrSize = 0x0,
+ .addrConf.addrPos = 0x0,
+ .addrConf.numAddr = 0x0,
+ .lenOffset = 0xFC,
+ .endTrigger.triggerType = 0x1,
+ .endTrigger.bEnaCmd = 0x0,
+ .endTrigger.triggerNo = 0x0,
+ .endTrigger.pastTrig = 0x0,
+ .endTime = 0x00000000,
+ .pAddr = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
+ .pQueue = 0, // INSERT APPLICABLE POINTER: (dataQueue_t*)&xxx
+ .pOutput = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
+};
diff --git a/samples/rfBleConnect/src/smartrf_settings/smartrf_settings_predefined.h b/samples/rfBleConnect/src/smartrf_settings/smartrf_settings_predefined.h
new file mode 100644
index 0000000000..af2f55d1eb
--- /dev/null
+++ b/samples/rfBleConnect/src/smartrf_settings/smartrf_settings_predefined.h
@@ -0,0 +1,46 @@
+#ifndef _SMARTRF_SETTINGS_PREDEFINED_H_
+#define _SMARTRF_SETTINGS_PREDEFINED_H_
+
+
+//*********************************************************************************
+// Generated by SmartRF Studio version 2.13.0 (build #164)
+// Tested for SimpleLink SDK version: CC13x2 SDK 2.40.xx.xx
+// Device: CC1352R Rev. 2.1
+//
+//*********************************************************************************
+
+
+#include <ti/devices/DeviceFamily.h>
+#include DeviceFamily_constructPath(driverlib/rf_mailbox.h)
+#include DeviceFamily_constructPath(driverlib/rf_common_cmd.h)
+#include DeviceFamily_constructPath(driverlib/rf_prop_cmd.h)
+
+#include <ti/drivers/rf/RF.h>
+
+
+// TX Power table size definition
+#define RF_PROP_TX_POWER_TABLE_SIZE 20
+
+// TX Power Table Object
+extern RF_TxPowerTable_Entry RF_PROP_txPowerTable[];
+
+
+/* RF Core API commands */
+/* RF command pointers for easylink */
+extern RF_Mode RF_prop_fsk;
+extern RF_Mode RF_prop_sl_lr;
+extern RF_Mode RF_prop_fsk_200kbps;
+
+extern rfc_CMD_PROP_RADIO_DIV_SETUP_t RF_cmdPropRadioDivSetup_fsk;
+extern rfc_CMD_PROP_RADIO_DIV_SETUP_t RF_cmdPropRadioDivSetup_sl_lr;
+extern rfc_CMD_PROP_RADIO_DIV_SETUP_t RF_cmdPropRadioDivSetup_fsk_200kbps;
+
+extern rfc_CMD_FS_t RF_cmdFs_preDef;
+extern rfc_CMD_PROP_TX_ADV_t RF_cmdPropTxAdv_preDef;
+extern rfc_CMD_PROP_RX_ADV_t RF_cmdPropRxAdv_preDef;
+
+extern uint32_t pOverrides_fsk[];
+extern uint32_t pOverrides_sl_lr[];
+extern uint32_t pOverrides_fsk_200kbps[];
+
+#endif // _SMARTRF_SETTINGS_PREDEFINED_H_
diff --git a/samples/rfBleConnect/src/ti_drivers_config.h b/samples/rfBleConnect/src/ti_drivers_config.h
new file mode 100644
index 0000000000..907080fb11
--- /dev/null
+++ b/samples/rfBleConnect/src/ti_drivers_config.h
@@ -0,0 +1,208 @@
+/*
+ * ======== ti_drivers_config.h ========
+ * Configured TI-Drivers module declarations
+ *
+ * DO NOT EDIT - This file is generated for the CC1352R1_LAUNCHXL
+ * by the SysConfig tool.
+ */
+#ifndef ti_drivers_config_h
+#define ti_drivers_config_h
+
+#define CONFIG_SYSCONFIG_PREVIEW
+
+#define CONFIG_CC1352R1_LAUNCHXL
+
+#ifndef DeviceFamily_CC13X2
+#define DeviceFamily_CC13X2
+#endif
+
+#include <ti/devices/DeviceFamily.h>
+
+#include <stdint.h>
+
+/* support C++ sources */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*
+ * ======== AESCBC ========
+ */
+
+#define CONFIG_AESCBC_0 0
+
+
+/*
+ * ======== AESCCM ========
+ */
+
+#define CONFIG_AESCCM_0 0
+
+
+/*
+ * ======== AESECB ========
+ */
+
+#define CONFIG_AESECB_0 0
+
+
+/*
+ * ======== ECDH ========
+ */
+
+#define CONFIG_ECDH_0 0
+
+
+/*
+ * ======== ECDSA ========
+ */
+
+#define CONFIG_ECDSA_0 0
+
+
+/*
+ * ======== ECJPAKE ========
+ */
+
+#define CONFIG_ECJPAKE_0 0
+
+
+/*
+ * ======== GPIO ========
+ */
+
+/* DIO6, LaunchPad LED Red */
+#define CONFIG_GPIO_RLED 0
+/* DIO7, LaunchPad LED Green */
+#define CONFIG_GPIO_GLED 1
+/* DIO15, LaunchPad Button BTN-1 (Left) */
+#define CONFIG_GPIO_BTN1 2
+/* DIO14, LaunchPad Button BTN-2 (Right) */
+#define CONFIG_GPIO_BTN2 3
+/* DIO20, SPI Flash Device Chip Select */
+#define CONFIG_GPIO_0 4
+
+/* LEDs are active high */
+#define CONFIG_GPIO_LED_ON (1)
+#define CONFIG_GPIO_LED_OFF (0)
+
+#define CONFIG_LED_ON (CONFIG_GPIO_LED_ON)
+#define CONFIG_LED_OFF (CONFIG_GPIO_LED_OFF)
+
+
+/*
+ * ======== NVS ========
+ */
+
+#define CONFIG_NVSINTERNAL 0
+/*
+ * MOSI: DIO9
+ * MISO: DIO8
+ * SCLK: DIO10
+ * SPI Bus
+ * SS: DIO20, SPI Flash Device Chip Select
+ */
+#define CONFIG_NVSEXTERNAL 1
+
+
+/*
+ * ======== PIN ========
+ */
+
+/* Includes */
+//#include <ti/drivers/PIN.h>
+
+/* Externs */
+//extern const PIN_Config BoardGpioInitTable[];
+
+/* XDS110 UART, Parent Signal: CONFIG_DISPLAY_UART TX, (DIO13) */
+#define CONFIG_PIN_UART_TX 0x0000000d
+/* XDS110 UART, Parent Signal: CONFIG_DISPLAY_UART RX, (DIO12) */
+#define CONFIG_PIN_UART_RX 0x0000000c
+/* LaunchPad LED Red, Parent Signal: CONFIG_GPIO_RLED GPIO Pin, (DIO6) */
+#define CONFIG_PIN_RLED 0x00000006
+/* LaunchPad LED Green, Parent Signal: CONFIG_GPIO_GLED GPIO Pin, (DIO7) */
+#define CONFIG_PIN_GLED 0x00000007
+/* LaunchPad Button BTN-1 (Left), Parent Signal: CONFIG_GPIO_BTN1 GPIO Pin, (DIO15) */
+#define CONFIG_PIN_BTN1 0x0000000f
+/* LaunchPad Button BTN-2 (Right), Parent Signal: CONFIG_GPIO_BTN2 GPIO Pin, (DIO14) */
+#define CONFIG_PIN_BTN2 0x0000000e
+/* SPI Flash Device Chip Select, Parent Signal: CONFIG_GPIO_0 GPIO Pin, (DIO20) */
+#define CONFIG_PIN_0 0x00000014
+/* SPI Bus, Parent Signal: CONFIG_GPIO_SPI_SS SCLK, (DIO10) */
+#define CONFIG_PIN_SPI_SCLK 0x0000000a
+/* SPI Bus, Parent Signal: CONFIG_GPIO_SPI_SS MISO, (DIO8) */
+#define CONFIG_PIN_SPI_MISO 0x00000008
+/* SPI Bus, Parent Signal: CONFIG_GPIO_SPI_SS MOSI, (DIO9) */
+#define CONFIG_PIN_SPI_MOSI 0x00000009
+
+
+
+
+/*
+ * ======== SHA2 ========
+ */
+
+#define CONFIG_SHA2_0 0
+
+
+/*
+ * ======== SPI ========
+ */
+
+/*
+ * MOSI: DIO9
+ * MISO: DIO8
+ * SCLK: DIO10
+ * SPI Bus
+ */
+#define CONFIG_GPIO_SPI_SS 0
+
+
+/*
+ * ======== TRNG ========
+ */
+
+#define CONFIG_TRNG_0 0
+
+
+/*
+ * ======== UART ========
+ */
+
+/*
+ * TX: DIO13
+ * RX: DIO12
+ * XDS110 UART
+ */
+#define CONFIG_DISPLAY_UART 0
+
+
+/*
+ * ======== Board_init ========
+ * Perform all required TI-Drivers initialization
+ *
+ * This function should be called once at a point before any use of
+ * TI-Drivers.
+ */
+extern void Board_init(void);
+
+/*
+ * ======== Board_initGeneral ========
+ * (deprecated)
+ *
+ * Board_initGeneral() is defined purely for backward compatibility.
+ *
+ * All new code should use Board_init() to do any required TI-Drivers
+ * initialization _and_ use <Driver>_init() for only where specific drivers
+ * are explicitly referenced by the application. <Driver>_init() functions
+ * are idempotent.
+ */
+#define Board_initGeneral Board_init
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* include guard */
diff --git a/samples/rfBleConnect/src/ti_radio_config.h b/samples/rfBleConnect/src/ti_radio_config.h
new file mode 100644
index 0000000000..859795b842
--- /dev/null
+++ b/samples/rfBleConnect/src/ti_radio_config.h
@@ -0,0 +1,129 @@
+/*
+ * ======== ti_radio_config.h ========
+ * Configured RadioConfig module definitions
+ *
+ * Radio Config module version : 1.2
+ * SmartRF Studio data version : 2.14.0
+ */
+#ifndef _TI_RADIO_CONFIG_H_
+#define _TI_RADIO_CONFIG_H_
+
+#ifndef DeviceFamily_CC13X2
+#define DeviceFamily_CC13X2
+#endif
+
+#include <ti/devices/DeviceFamily.h>
+#include DeviceFamily_constructPath(driverlib/rf_mailbox.h)
+#include DeviceFamily_constructPath(driverlib/rf_common_cmd.h)
+#include DeviceFamily_constructPath(driverlib/rf_ieee_cmd.h)
+#include DeviceFamily_constructPath(driverlib/rf_prop_cmd.h)
+#include <ti/drivers/rf/RF.h>
+
+
+//*********************************************************************************
+// RF Setting: IEEE 802.15.4 O-QPSK DSSS PHY (250 kbps) at 2450 MHz band
+//
+// PHY: ieee154
+// Setting file: setting_ieee_802_15_4.json
+//*********************************************************************************
+
+// TX Power table size definition
+#define TX_POWER_TABLE_SIZE_ieee154 11
+
+// TX Power Table Object
+extern RF_TxPowerTable_Entry txPowerTable_ieee154[];
+
+// TI-RTOS RF Mode Object
+extern RF_Mode RF_prop_ieee154;
+
+// RF Core API commands
+extern const rfc_CMD_RADIO_SETUP_t RF_cmdRadioSetup_ieee154;
+extern const rfc_CMD_FS_t RF_cmdFs_ieee154;
+extern const rfc_CMD_IEEE_TX_t RF_cmdIeeeTx_ieee154;
+extern const rfc_CMD_IEEE_RX_t RF_cmdIeeeRx_ieee154;
+extern const rfc_CMD_IEEE_CSMA_t RF_cmdIeeeCsma_ieee154;
+extern const rfc_CMD_IEEE_RX_ACK_t RF_cmdIeeeRxAck_ieee154;
+
+// RF Core API Overrides
+extern uint32_t pOverrides_ieee154[];
+
+
+//*********************************************************************************
+// RF Setting: 50 kbps, 2-GFSK, 25 kHz deviation, IEEE 802.15.4g MR-FSK PHY mode
+//
+// PHY: 2gfsk50kbps154g
+// Setting file: setting_tc106_154g.json
+//*********************************************************************************
+
+// TX Power table size definition
+#define TX_POWER_TABLE_SIZE_2gfsk50kbps154g 20
+
+// TX Power Table Object
+extern RF_TxPowerTable_Entry txPowerTable_2gfsk50kbps154g[];
+
+// TI-RTOS RF Mode Object
+extern RF_Mode RF_prop_2gfsk50kbps154g;
+
+// RF Core API commands
+extern const rfc_CMD_PROP_RADIO_DIV_SETUP_t RF_cmdPropRadioDivSetup_2gfsk50kbps154g;
+extern const rfc_CMD_FS_t RF_cmdFs_2gfsk50kbps154g;
+extern const rfc_CMD_PROP_TX_ADV_t RF_cmdPropTxAdv_2gfsk50kbps154g;
+extern const rfc_CMD_PROP_RX_ADV_t RF_cmdPropRxAdv_2gfsk50kbps154g;
+extern const rfc_CMD_PROP_CS_t RF_cmdPropCs_2gfsk50kbps154g;
+
+// RF Core API Overrides
+extern uint32_t pOverrides_2gfsk50kbps154g[];
+
+//*********************************************************************************
+// RF Setting: 200 kbps, 2-GFSK, 50 kHz deviation, IEEE 802.15.4g FSK PHY mode, 915 MHz
+//
+// PHY: 2gfsk200kbps154g
+// Setting file: setting_tc146_154g.json
+//*********************************************************************************
+
+// TX Power table size definition
+#define TX_POWER_TABLE_SIZE_2gfsk200kbps154g 20
+
+// TX Power Table Object
+extern RF_TxPowerTable_Entry txPowerTable_2gfsk200kbps154g[];
+
+// TI-RTOS RF Mode Object
+extern RF_Mode RF_prop_2gfsk200kbps154g;
+
+// RF Core API commands
+extern const rfc_CMD_PROP_RADIO_DIV_SETUP_t RF_cmdPropRadioDivSetup_2gfsk200kbps154g;
+extern const rfc_CMD_FS_t RF_cmdFs_2gfsk200kbps154g;
+extern const rfc_CMD_PROP_TX_ADV_t RF_cmdPropTxAdv_2gfsk200kbps154g;
+extern const rfc_CMD_PROP_RX_ADV_t RF_cmdPropRxAdv_2gfsk200kbps154g;
+extern const rfc_CMD_PROP_CS_t RF_cmdPropCs_2gfsk200kbps154g;
+
+// RF Core API Overrides
+extern uint32_t pOverrides_2gfsk200kbps154g[];
+
+//*********************************************************************************
+// RF Setting: 5 kbps, SimpleLink Long Range (20 kchip/s, 2-GFSK, conv. FEC r=1/2 K=7, DSSS SF=2, Tx dev.: 5 kHz, Rx BW: 34 kHz)
+//
+// PHY: slr5kbps2gfsk
+// Setting file: setting_tc480.json
+//*********************************************************************************
+
+// TX Power table size definition
+#define TX_POWER_TABLE_SIZE_slr5kbps2gfsk 20
+
+// TX Power Table Object
+extern RF_TxPowerTable_Entry txPowerTable_slr5kbps2gfsk[];
+
+// TI-RTOS RF Mode Object
+extern RF_Mode RF_prop_slr5kbps2gfsk;
+
+// RF Core API commands
+extern const rfc_CMD_PROP_RADIO_DIV_SETUP_t RF_cmdPropRadioDivSetup_slr5kbps2gfsk;
+extern const rfc_CMD_FS_t RF_cmdFs_slr5kbps2gfsk;
+extern const rfc_CMD_PROP_TX_ADV_t RF_cmdPropTxAdv_slr5kbps2gfsk;
+extern const rfc_CMD_PROP_RX_ADV_t RF_cmdPropRxAdv_slr5kbps2gfsk;
+extern const rfc_CMD_PROP_CS_t RF_cmdPropCs_slr5kbps2gfsk;
+
+// RF Core API Overrides
+extern uint32_t pOverrides_slr5kbps2gfsk[];
+
+#endif // _SMART_RF_SETTINGS_H_
diff --git a/samples/rfBleConnect/src/tx.c b/samples/rfBleConnect/src/tx.c
new file mode 100644
index 0000000000..bd73c78f3f
--- /dev/null
+++ b/samples/rfBleConnect/src/tx.c
@@ -0,0 +1,590 @@
+/*
+ * Copyright (c) 2016-2018, 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 *****/
+/* Standard C Libraries */
+#include <assert.h>
+#include <stdbool.h>
+#include <stdlib.h>
+
+#include <zephyr.h>
+
+#ifndef CONFIG_NET_BUF_USER_DATA_SIZE
+#define CONFIG_NET_BUF_USER_DATA_SIZE 0
+#endif
+
+#include <bluetooth/gap.h>
+#include <bluetooth/uuid.h>
+#include <bluetooth/bluetooth.h>
+#include "../../../subsys/bluetooth/controller/ll_sw/pdu.h"
+
+#define Board_CC1352R1_LAUNCHXL
+#ifndef DeviceFamily_CC13X2
+#define DeviceFamily_CC13X2
+#endif
+
+/* TI-RTOS Header files */
+#include <ti/drivers/rf/RF.h>
+//#include <ti/drivers/PIN.h>
+#include <driverlib/rf_mailbox.h>
+
+/* Board Header files */
+#include "Board.h"
+
+/* Application specific Header files */
+#include "config.h"
+#include "menu.h"
+#include "RFQueue.h"
+
+#include "smartrf_settings/smartrf_settings.h"
+#include "smartrf_settings/smartrf_settings_predefined.h"
+#include "smartrf_settings/smartrf_settings_ble.h"
+
+/***** Defines *****/
+#define MAX_PAYLOAD_LENGTH 254 // Maximum length of the packet to send (Even due to HS requirement)
+#define DATA_ENTRY_HEADER_SIZE 8 // Constant header size of a Generic Data Entry
+#define MAX_LENGTH MAX_PAYLOAD_LENGTH // Set the length of the data entry
+#define NUM_DATA_ENTRIES 4
+#define NUM_APPENDED_BYTES 0
+
+#define EXTENDED_HEADER_LENGTH 9
+#define BLE_BASE_FREQUENCY 2300 // When programming the channel in the BLE TX command it is the
+ // offset from 2300 MHz
+
+#define MAX_BLE_PWR_LEVEL_DBM 5
+#define MAX_SUB1_PWR_LEVEL_DBM 13
+
+#define ABORT_GRACEFUL 1 // Option for the RF cancel command
+#define ABORT_ABRUPT 0 // Option for the RF cancel command
+
+/* Inter-packet intervals for each phy mode in ms*/
+#define PKT_INTERVAL_MS_BLE 100
+
+#define BLE_SLAVE_CONN_INTERVAL_MIN 0x0150
+#define BLE_SLAVE_CONN_INTERVAL_MAX 0x01F0
+
+/***** Prototypes *****/
+static void tx_callback(RF_Handle h, RF_CmdHandle ch, RF_EventMask e);
+
+/***** Variable declarations *****/
+static RF_Object rfObject;
+static RF_Handle rfHandle;
+
+static ApplicationConfig localConfig;
+static volatile u32_t ble_adv_cmd_start;
+static volatile u32_t ble_adv_cmd_end;
+static volatile RF_EventMask ble_adv_events_notified;
+static volatile RF_CmdHandle current_rf_cmd_handle = -1;
+
+static const u8_t ble_adv_channels[] = { 37, 38, 39 };
+
+typedef enum {
+ BLE_STATE_ADV_STBY,
+ BLE_STATE_ADV_SCAN,
+ BLE_STATE_ADV_SYNC,
+ BLE_STATE_ADV_INIT,
+ BLE_STATE_ADV_CONN,
+ BLE_STATE_ADV_ADVT,
+} BleStateAdv_t;
+
+static BleStateAdv_t ble_adv_state;
+
+/*
+This interval is dependent on data rate and packet length, and might need to be changed
+if any of these parameter changes
+*/
+static u32_t packetInterval;
+
+__attribute__ ((aligned (4)))
+static u8_t rxDataEntryBuffer[RF_QUEUE_DATA_ENTRY_BUFFER_SIZE(NUM_DATA_ENTRIES,
+ MAX_LENGTH,
+ NUM_APPENDED_BYTES)];
+
+/* TX queue or RF Core to read data from */
+static dataQueue_t rxDataQueue;
+rfc_ble5ExtAdvEntry_t ble5ExtAdvPacket;
+
+static u16_t device_address[] = {
+ 0x4455,
+ 0x2233,
+ 0x0011,
+};
+static u8_t adv_data[] = {
+ 2, // length
+ BT_DATA_FLAGS, // key
+ BT_LE_AD_LIMITED | BT_LE_AD_NO_BREDR, // value
+ 3, // length
+ BT_DATA_UUID16_ALL, // key
+ // BT_UUID_HRS, // value
+ 0x18, 0x0d, // value it would be better if this was available as a macro..
+};
+static u8_t scan_rsp_data[] = {
+ 14, // length
+ BT_DATA_NAME_COMPLETE, // key
+ 'L','i','s','b','o','a',' ','(','B','e','t','a',')', // value
+#if 0
+ 5, // length
+ 0x12, // key = slave connect interval range
+ BLE_SLAVE_CONN_INTERVAL_MIN & 0xff,
+ (BLE_SLAVE_CONN_INTERVAL_MIN >> 8) & 0xff,
+ BLE_SLAVE_CONN_INTERVAL_MAX & 0xff,
+ (BLE_SLAVE_CONN_INTERVAL_MAX >> 8) & 0xff
+#endif
+};
+static rfc_bleAdvOutput_t adv_output;
+
+// least amount of time for largest advertisement packet (using 1MHz phy)
+#define BLE_ADV_TIME_MIN_US (LL_HEADER_SIZE(1) + sizeof(struct pdu_adv_adv_ind))
+// least amount of time for largest scan req packet (using 1MHz phy)
+#define BLE_SCAN_REQ_TIME_MIN_US (LL_HEADER_SIZE(1) + sizeof(struct pdu_adv_scan_req))
+// least amount of time for largest scan rsp packet (using 1MHz phy)
+#define BLE_SCAN_RSP_TIME_MIN_US (LL_HEADER_SIZE(1) + sizeof(struct pdu_adv_scan_rsp))
+// least amount of time for largest connect req packet (using 1MHz phy)
+#define BLE_CONNECT_TIME_MIN_US (LL_HEADER_SIZE(1) + sizeof(struct pdu_adv_connect_ind))
+
+// least amount of time for a single slot to transmit an advertisement and receive a response
+#define BLE_ADV_SLOT_TIME_MIN_US \
+ (\
+ 0 \
+ + BLE_ADV_TIME_MIN_US \
+ + EVENT_MAFS_MAX_US \
+ + MIN( \
+ BLE_SCAN_REQ_TIME_MIN_US + EVENT_MAFS_MAX_US + BLE_SCAN_RSP_TIME_MIN_US, \
+ BLE_CONNECT_TIME_MIN_US \
+ ) \
+ )
+#define BLE_ADV_SLOT_TIME_MIN RF_convertUsToRatTicks( BLE_ADV_SLOT_TIME_MIN_US )
+
+// the chosen amount of time to spend advertising on all selected channels
+#define BLE_ADV_INTERVAL_US 4000000
+#define BLE_ADV_INTERVAL RF_convertUsToRatTicks( BLE_ADV_INTERVAL_US )
+
+static u32_t origin;
+static inline void split_sec_usec( u32_t usec, u32_t *sec, u32_t *remainder ) {
+ if ( sec ) {
+ *sec = usec / 1000000;
+ }
+ if ( remainder ) {
+ *remainder = usec % 1000000;
+ }
+}
+#define D(fmt, args...) \
+ do { \
+ u32_t _now_ ## __LINE__, _sec_ ## __LINE__, _usec_ ## __LINE__; \
+ _now_ ## __LINE__ = RF_getCurrentTime(); \
+ _now_ ## __LINE__ -= origin; \
+ _now_ ## __LINE__ = RF_convertRatTicksToUs( _now_ ## __LINE__ ); \
+ split_sec_usec( _now_ ## __LINE__, & _sec_ ## __LINE__, & _usec_ ## __LINE__ ); \
+ printk( "[%3u.%06u]: " fmt "\n", _sec_ ## __LINE__ % 1000, _usec_ ## __LINE__, ##args ); \
+ } while( 0 )
+
+
+static ratmr_t ble_adv_interval_start_time;
+static ratmr_t ble_adv_interval_end_time;
+
+extern const FrequencyTableEntry config_frequencyTable_ble[];
+static const FrequencyTableEntry* chan_to_fte[] = {
+ [ 37 ] = & config_frequencyTable_ble[ 0 ],
+ [ 0 ] = & config_frequencyTable_ble[ 1 ],
+ [ 1 ] = & config_frequencyTable_ble[ 2 ],
+ [ 2 ] = & config_frequencyTable_ble[ 3 ],
+ [ 3 ] = & config_frequencyTable_ble[ 4 ],
+ [ 4 ] = & config_frequencyTable_ble[ 5 ],
+ [ 5 ] = & config_frequencyTable_ble[ 6 ],
+ [ 6 ] = & config_frequencyTable_ble[ 7 ],
+ [ 7 ] = & config_frequencyTable_ble[ 8 ],
+ [ 8 ] = & config_frequencyTable_ble[ 9 ],
+ [ 9 ] = & config_frequencyTable_ble[ 10 ],
+ [ 10 ] = & config_frequencyTable_ble[ 11 ],
+ [ 38 ] = & config_frequencyTable_ble[ 12 ],
+ [ 11 ] = & config_frequencyTable_ble[ 13 ],
+ [ 12 ] = & config_frequencyTable_ble[ 14 ],
+ [ 13 ] = & config_frequencyTable_ble[ 15 ],
+ [ 14 ] = & config_frequencyTable_ble[ 16 ],
+ [ 15 ] = & config_frequencyTable_ble[ 17 ],
+ [ 16 ] = & config_frequencyTable_ble[ 18 ],
+ [ 17 ] = & config_frequencyTable_ble[ 19 ],
+ [ 18 ] = & config_frequencyTable_ble[ 20 ],
+ [ 19 ] = & config_frequencyTable_ble[ 21 ],
+ [ 20 ] = & config_frequencyTable_ble[ 22 ],
+ [ 21 ] = & config_frequencyTable_ble[ 23 ],
+ [ 22 ] = & config_frequencyTable_ble[ 24 ],
+ [ 23 ] = & config_frequencyTable_ble[ 25 ],
+ [ 24 ] = & config_frequencyTable_ble[ 26 ],
+ [ 25 ] = & config_frequencyTable_ble[ 27 ],
+ [ 26 ] = & config_frequencyTable_ble[ 28 ],
+ [ 27 ] = & config_frequencyTable_ble[ 29 ],
+ [ 28 ] = & config_frequencyTable_ble[ 30 ],
+ [ 29 ] = & config_frequencyTable_ble[ 31 ],
+ [ 30 ] = & config_frequencyTable_ble[ 32 ],
+ [ 31 ] = & config_frequencyTable_ble[ 33 ],
+ [ 32 ] = & config_frequencyTable_ble[ 34 ],
+ [ 33 ] = & config_frequencyTable_ble[ 35 ],
+ [ 34 ] = & config_frequencyTable_ble[ 36 ],
+ [ 35 ] = & config_frequencyTable_ble[ 37 ],
+ [ 36 ] = & config_frequencyTable_ble[ 38 ],
+ [ 39 ] = & config_frequencyTable_ble[ 39 ],
+};
+
+enum {
+ //TXMASK = RF_EventLastCmdDone,
+ TXMASK = -1,
+};
+
+static rfc_CMD_BLE_ADV_t RF_ble_cmdBleAdv = {
+ .commandNo = CMD_BLE_ADV,
+ .pParams = & bleAdvPar,
+ .pOutput = & adv_output,
+ .startTrigger = {
+ .triggerType = TRIG_ABSTIME,
+ .pastTrig = true,
+ },
+ .condition = {
+ .rule = COND_NEVER,
+ },
+};
+
+static struct pdu_adv_connect_ind connect_req;
+
+/* Runs the transmitting part of the test application and returns a result. */
+TestResult tx_runTxTest(const ApplicationConfig* config)
+{
+ menu_clear();
+
+ if( ARRAY_SIZE( ble_adv_channels ) * BLE_ADV_SLOT_TIME_MIN >= BLE_ADV_INTERVAL ) {
+ printk(
+ "\x1b[%d;%df"
+ "%u * slot time (%u us) >= advertising interval (%u us)\n",
+ 13, 1,
+ (unsigned)ARRAY_SIZE( ble_adv_channels ),
+ BLE_ADV_SLOT_TIME_MIN_US,
+ BLE_ADV_INTERVAL_US
+ );
+ while(1);
+ }
+
+ if(config == NULL)
+ {
+ while(1);
+ }
+ memcpy((void *)&localConfig, config, sizeof(ApplicationConfig));
+
+ origin = RF_getCurrentTime();
+ D( "Theoretical values for 1MHz phy.." );
+ D( "BLE_ADV_TIME_MIN_US: %u us", BLE_ADV_TIME_MIN_US );
+ D( "BLE_SCAN_REQ_TIME_MIN_US: %u us", BLE_SCAN_REQ_TIME_MIN_US );
+ D( "BLE_SCAN_RSP_TIME_MIN_US: %u us", BLE_SCAN_RSP_TIME_MIN_US );
+ D( "BLE_CONNECT_TIME_MIN_US: %u us", BLE_CONNECT_TIME_MIN_US );
+ D( "BLE_ADV_SLOT_TIME_MIN_US: %u us", BLE_ADV_SLOT_TIME_MIN_US );
+
+ RF_Params rfParams;
+ RF_Params_init(&rfParams);
+
+ if( RFQueue_defineQueue(&rxDataQueue,
+ rxDataEntryBuffer,
+ sizeof(rxDataEntryBuffer),
+ NUM_DATA_ENTRIES,
+ MAX_LENGTH + NUM_APPENDED_BYTES))
+ {
+ /* Failed to allocate space for all data entries */
+ while(true);
+ }
+
+ const FrequencyTableEntry *fte = chan_to_fte[ ble_adv_channels[ 0 ] ];
+
+ RF_ble_cmdBle5AdvAux.pParams->pAdvPkt = (u8_t *)&ble5ExtAdvPacket;
+ ble5ExtAdvPacket.extHdrInfo.length = EXTENDED_HEADER_LENGTH;
+ ble5ExtAdvPacket.advDataLen = sizeof( adv_data );
+ ble5ExtAdvPacket.pAdvData = (u8_t *)adv_data;
+ RF_ble_cmdBle5AdvAux.startTrigger.triggerType = TRIG_NOW;
+ RF_ble_cmdBle5AdvAux.startTrigger.pastTrig = 1;
+ RF_ble_cmdBle5AdvAux.channel = 0xFF;
+ RF_ble_cmdBle5AdvAux.whitening.bOverride = 1;
+ RF_ble_cmdBle5AdvAux.whitening.init = config->frequencyTable[config->frequency].whitening;
+ RF_ble_cmdBle5AdvAux.startTime = 0;
+
+ bleAdvPar.pDeviceAddress = (u16_t *)device_address;
+ bleAdvPar.pRxQ = & rxDataQueue;
+ bleAdvPar.pAdvData = (u8_t *)adv_data;
+ bleAdvPar.advLen = sizeof( adv_data );
+ bleAdvPar.pScanRspData = (u8_t *)scan_rsp_data;
+ bleAdvPar.scanRspLen = sizeof( scan_rsp_data );
+
+ D( "opening RF object" );
+ /* Request access to the radio based on test case*/
+ rfHandle = RF_open(&rfObject, &RF_modeBle, (RF_RadioSetup*)&RF_ble_cmdRadioSetup, &rfParams);
+ packetInterval = (u32_t)(RF_convertMsToRatTicks(PKT_INTERVAL_MS_BLE)); // Set packet interval to 100 ms
+
+ RF_ble_cmdFs.frequency = fte->frequency;
+ RF_ble_cmdFs.fractFreq = fte->fractFreq;
+ D( "Setting frequency" );
+ RF_runCmd(rfHandle, (RF_Op*)&RF_ble_cmdFs, RF_PriorityNormal, NULL, 0);
+
+ /*
+ RF_setTxPower(
+ rfHandle,
+ RF_TxPowerTable_findValue(
+ (RF_TxPowerTable_Entry *)RF_BLE_txPowerTable,
+ RF_TxPowerTable_MAX_DBM
+ )
+ );
+ */
+
+ TestResult r = TestResult_Finished;
+
+ //menu_updateTxMetricScreen( (tx_metrics *) & adv_output );
+
+ bool once = false;
+
+ D( "Entering loop.." );
+ for( ;; ) {
+
+ /* Check, whether a button has been pressed */
+ if (menu_isButtonPressed()) {
+ /* If there is an ongoing Tx command, cancel it */
+ (void)RF_cancelCmd(rfHandle, current_rf_cmd_handle, ABORT_GRACEFUL);
+ RF_pendCmd(rfHandle, current_rf_cmd_handle, (RF_EventCmdCancelled | RF_EventCmdStopped | RF_EventCmdAborted));
+ RF_close(rfHandle);
+
+ r = TestResult_Aborted;
+
+ current_rf_cmd_handle = -1;
+ break;
+ }
+
+ /* Get current time */
+ ratmr_t now = RF_getCurrentTime();
+
+ if ( false ) {
+ } else if ( BLE_STATE_ADV_STBY == ble_adv_state ) {
+
+ ble_adv_state = BLE_STATE_ADV_ADVT;
+
+ } else if ( BLE_STATE_ADV_ADVT == ble_adv_state ) {
+
+ //menu_updateTxMetricScreen( (tx_metrics *) & adv_output );
+
+ if ( now >= ble_adv_interval_end_time ) {
+
+ ble_adv_interval_start_time = now;
+ ble_adv_interval_end_time = now + BLE_ADV_INTERVAL;
+
+ for( u8_t i = 0; i < ARRAY_SIZE( ble_adv_channels ); ++i ) {
+ while( -1 != current_rf_cmd_handle );
+ ble_adv_events_notified = 0;
+ RF_ble_cmdBleAdv.startTime = now;
+ RF_ble_cmdBleAdv.channel = ble_adv_channels[ i ];
+ if ( ! once ) {
+ D( "TX'ing first packet" );
+ once = true;
+ }
+ ble_adv_cmd_start = RF_getCurrentTime();
+ current_rf_cmd_handle = RF_postCmd( rfHandle, (RF_Op*) & RF_ble_cmdBleAdv, RF_PriorityNormal, &tx_callback, TXMASK );
+ }
+ }
+
+ } else if ( BLE_STATE_ADV_CONN == ble_adv_state ) {
+
+ //menu_clear();
+ break;
+ }
+ }
+ while( -1 != current_rf_cmd_handle );
+
+ ble_adv_state = BLE_STATE_ADV_STBY;
+
+ memset( & connect_req, 0, sizeof( connect_req ) );
+ memset( & adv_output, 0, sizeof( adv_output ) );
+
+ RF_close(rfHandle);
+ return r;
+}
+
+static void describe_rf_event( RF_EventMask e, RF_EventMask already, u32_t usec, u8_t chan ) {
+
+ if ( ( e & RF_EventCmdDone ) && ! ( already & RF_EventCmdDone ) ) D( "Ch%u A radio operation command in a chain finished. (%u us)", chan, usec );
+ if ( ( e & RF_EventLastCmdDone ) && ! ( already & RF_EventLastCmdDone ) ) D( "Ch%u The last radio operation command in a chain finished. (%u us)", chan, usec );
+ if ( ( e & RF_EventFGCmdDone ) && ! ( already & RF_EventFGCmdDone ) ) D( "Ch%u A IEEE-mode radio operation command in a chain finished. (%u us)", chan, usec );
+ if ( ( e & RF_EventLastFGCmdDone ) && ! ( already & RF_EventLastFGCmdDone ) ) D( "Ch%u A stand-alone IEEE-mode radio operation command or the last command in a chain finished. (%u us)", chan, usec );
+ if ( ( e & RF_EventTxDone ) && ! ( already & RF_EventTxDone ) ) D( "Ch%u Packet transmitted (%u us)", chan, usec );
+ if ( ( e & RF_EventTXAck ) && ! ( already & RF_EventTXAck ) ) D( "Ch%u ACK packet transmitted (%u us)", chan, usec );
+ if ( ( e & RF_EventTxCtrl ) && ! ( already & RF_EventTxCtrl ) ) D( "Ch%u Control packet transmitted (%u us)", chan, usec );
+ if ( ( e & RF_EventTxCtrlAck ) && ! ( already & RF_EventTxCtrlAck ) ) D( "Ch%u Acknowledgement received on a transmitted control packet (%u us)", chan, usec );
+ if ( ( e & RF_EventTxCtrlAckAck ) && ! ( already & RF_EventTxCtrlAckAck ) ) D( "Ch%u Acknowledgement received on a transmitted control packet, and acknowledgement transmitted for that packet (%u us)", chan, usec );
+ if ( ( e & RF_EventTxRetrans ) && ! ( already & RF_EventTxRetrans ) ) D( "Ch%u Packet retransmitted (%u us)", chan, usec );
+ if ( ( e & RF_EventTxEntryDone ) && ! ( already & RF_EventTxEntryDone ) ) D( "Ch%u Tx queue data entry state changed to Finished (%u us)", chan, usec );
+ if ( ( e & RF_EventTxBufferChange ) && ! ( already & RF_EventTxBufferChange ) ) D( "Ch%u A buffer change is complete (%u us)", chan, usec );
+ if ( ( e & RF_EventPaChanged ) && ! ( already & RF_EventPaChanged ) ) D( "Ch%u The PA was reconfigured on the fly. (%u us)", chan, usec );
+ if ( ( e & RF_EventRxOk ) && ! ( already & RF_EventRxOk ) ) D( "Ch%u Packet received with CRC OK, payload, and not to be ignored (%u us)", chan, usec );
+ if ( ( e & RF_EventRxNOk ) && ! ( already & RF_EventRxNOk ) ) D( "Ch%u Packet received with CRC error (%u us)", chan, usec );
+ if ( ( e & RF_EventRxIgnored ) && ! ( already & RF_EventRxIgnored ) ) D( "Ch%u Packet received with CRC OK, but to be ignored (%u us)", chan, usec );
+ if ( ( e & RF_EventRxEmpty ) && ! ( already & RF_EventRxEmpty ) ) D( "Ch%u Packet received with CRC OK, not to be ignored, no payload (%u us)", chan, usec );
+ if ( ( e & RF_EventRxCtrl ) && ! ( already & RF_EventRxCtrl ) ) D( "Ch%u Control packet received with CRC OK, not to be ignored (%u us)", chan, usec );
+ if ( ( e & RF_EventRxCtrlAck ) && ! ( already & RF_EventRxCtrlAck ) ) D( "Ch%u Control packet received with CRC OK, not to be ignored, then ACK sent (%u us)", chan, usec );
+ if ( ( e & RF_EventRxBufFull ) && ! ( already & RF_EventRxBufFull ) ) D( "Ch%u Packet received that did not fit in the Rx queue (%u us)", chan, usec );
+ if ( ( e & RF_EventRxEntryDone ) && ! ( already & RF_EventRxEntryDone ) ) D( "Ch%u Rx queue data entry changing state to Finished (%u us)", chan, usec );
+ if ( ( e & RF_EventDataWritten ) && ! ( already & RF_EventDataWritten ) ) D( "Ch%u Data written to partial read Rx buffer (%u us)", chan, usec );
+ if ( ( e & RF_EventNDataWritten ) && ! ( already & RF_EventNDataWritten ) ) D( "Ch%u Specified number of bytes written to partial read Rx buffer (%u us)", chan, usec );
+ if ( ( e & RF_EventRxAborted ) && ! ( already & RF_EventRxAborted ) ) D( "Ch%u Packet reception stopped before packet was done (%u us)", chan, usec );
+ if ( ( e & RF_EventRxCollisionDetected ) && ! ( already & RF_EventRxCollisionDetected ) ) D( "Ch%u A collision was indicated during packet reception (%u us)", chan, usec );
+ if ( ( e & RF_EventModulesUnlocked ) && ! ( already & RF_EventModulesUnlocked ) ) D( "Ch%u As part of the boot process, the CM0 has opened access to RF core modules and memories (%u us)", chan, usec );
+ if ( ( e & RF_EventInternalError ) && ! ( already & RF_EventInternalError ) ) D( "Ch%u Internal error observed (%u us)", chan, usec );
+ if ( ( e & RF_EventMdmSoft ) && ! ( already & RF_EventMdmSoft ) ) D( "Ch%u Synchronization word detected (MDMSOFT interrupt flag) (%u us)", chan, usec );
+ if ( ( e & RF_EventCmdCancelled ) && ! ( already & RF_EventCmdCancelled ) ) D( "Ch%u Command canceled before it was started. (%u us)", chan, usec );
+ if ( ( e & RF_EventCmdAborted ) && ! ( already & RF_EventCmdAborted ) ) D( "Ch%u Abrupt command termination caused by RF_cancelCmd() or RF_flushCmd(). (%u us)", chan, usec );
+ if ( ( e & RF_EventCmdStopped ) && ! ( already & RF_EventCmdStopped ) ) D( "Ch%u Graceful command termination caused by RF_cancelCmd() or RF_flushCmd(). (%u us)", chan, usec );
+ if ( ( e & RF_EventRatCh ) && ! ( already & RF_EventRatCh ) ) D( "Ch%u A user-programmable RAT channel triggered an event. (%u us)", chan, usec );
+ //if ( ( e & RF_EventPowerUp ) && ! ( already & RF_EventPowerUp ) ) D( "Ch%u RF power up event. deprecated This event is deprecated. Use RF_ClientEventPowerUpFinished instead. (%u us)", chan, usec );
+ if ( ( e & RF_EventError ) && ! ( already & RF_EventError ) ) D( "Ch%u Event flag used for error callback functions to indicate an error. See RF_Params::pErrCb. (%u us)", chan, usec );
+ if ( ( e & RF_EventCmdPreempted ) && ! ( already & RF_EventCmdPreempted ) ) D( "Ch%u Command preempted by another command with higher priority. Applies only to multi-client applications. (%u us)", chan, usec );
+
+}
+
+// used in menu-driven UI to display Adv stats
+RF_EventMask ble_adv_event_mask;
+
+void tx_callback(RF_Handle h, RF_CmdHandle ch, RF_EventMask e)
+{
+ static u8_t lastNRxScanReq;
+
+ u32_t then;
+ u32_t now;
+ u32_t delta;
+ u32_t sec;
+ u32_t usec;
+
+ // used in menu-driven UI to display Adv stats
+ ble_adv_event_mask = e;
+
+ then = ble_adv_cmd_start;
+ now = RF_getCurrentTime();
+ delta = now - then;
+ delta = RF_convertRatTicksToUs( delta );
+ split_sec_usec( delta, & sec, & usec );
+
+ rfc_bleRadioOp_t *op = (rfc_bleRadioOp_t *) RF_getCmdOp( h, ch );
+
+ describe_rf_event( e, ble_adv_events_notified, usec, op->channel );
+ ble_adv_events_notified |= e;
+
+ if ( e & RF_EventLastCmdDone ) {
+ current_rf_cmd_handle = -1;
+ ble_adv_cmd_end = now;
+ }
+
+ if ( e & RF_EventRxEntryDone ) {
+ for( ;; ) {
+ rfc_dataEntryGeneral_t *it = RFQueue_getDataEntry();
+
+ u8_t packet_length = it->length;
+ // for some reason, the actual data is always preceeded by the same value in it->status
+ u8_t *packet_data = &(& it->data)[ 1 ];
+
+ if ( false ) {
+ } else if ( BLE_STATE_ADV_ADVT == ble_adv_state ) {
+
+ const u8_t invalid_channel_map[ 5 ] = {0};
+
+ if (
+ true
+ && adv_output.nRxConnectReq > 0
+ && packet_length >= sizeof( connect_req )
+ && 0 != memcmp(
+ invalid_channel_map,
+ & packet_data[ offsetof( struct pdu_adv_connect_ind, chan_map ) ],
+ sizeof( invalid_channel_map )
+ )
+ ) {
+
+ memcpy( & connect_req, packet_data, MIN( packet_length, sizeof( connect_req ) ) );
+ ble_adv_state = BLE_STATE_ADV_CONN;
+
+ struct pdu_adv_connect_ind *x = & connect_req;
+ D( "Ch%u received a CONNECT_REQ:\n\t"
+ "init_addr: %02x:%02x:%02x:%02x:%02x:%02x\n\t"
+ "adv_addr: %02x:%02x:%02x:%02x:%02x:%02x\n\t"
+ "access_addr: %02x:%02x:%02x:%02x\n\t"
+ "crc_init: %02x:%02x:%02x\n\t"
+ "win_size: %u\n\t"
+ "win_offset: %u\n\t"
+ "interval: %u\n\t"
+ "latency: %u\n\t"
+ "timeout: %u\n\t"
+ "chan_map: %02x%02x%02x%02x%02x\n\t"
+ "hop: %u\n\t"
+ "sca: %u"
+ ,
+ op->channel,
+ x->init_addr[ 5 ], x->init_addr[ 4 ], x->init_addr[ 3 ], x->init_addr[ 2 ], x->init_addr[ 1 ], x->init_addr[ 0 ],
+ x->adv_addr[ 5 ], x->adv_addr[ 4 ], x->adv_addr[ 3 ], x->adv_addr[ 2 ], x->adv_addr[ 1 ], x->adv_addr[ 0 ],
+ x->access_addr[ 3 ], x->access_addr[ 2 ], x->access_addr[ 1 ], x->access_addr[ 0 ],
+ x->crc_init[ 2 ], x->crc_init[ 1 ], x->crc_init[ 0 ],
+ x->win_size,
+ x->win_offset,
+ x->interval,
+ x->latency,
+ x->timeout,
+ x->chan_map[ 4 ], x->chan_map[ 3 ], x->chan_map[ 2 ], x->chan_map[ 1 ], x->chan_map[ 0 ],
+ x->hop,
+ x->sca
+ );
+
+ break;
+ }
+
+ if ( adv_output.nRxScanReq != lastNRxScanReq ) {
+
+ lastNRxScanReq = adv_output.nRxScanReq;
+
+ struct pdu_adv_scan_req *x = (struct pdu_adv_scan_req *) packet_data;
+
+ D(
+ "Ch%u received a SCAN_REQ: "
+ "scan_addr: %02x:%02x:%02x:%02x:%02x:%02x "
+ "adv_addr: %02x:%02x:%02x:%02x:%02x:%02x"
+ ,
+ op->channel,
+ x->scan_addr[ 5 ], x->scan_addr[ 4 ], x->scan_addr[ 3 ], x->scan_addr[ 2 ], x->scan_addr[ 1 ], x->scan_addr[ 0 ],
+ x->adv_addr[ 5 ], x->adv_addr[ 4 ], x->adv_addr[ 3 ], x->adv_addr[ 2 ], x->adv_addr[ 1 ], x->adv_addr[ 0 ]
+ );
+ }
+
+ }
+
+ u8_t rx_status = RFQueue_nextEntry();
+ if ( DATA_ENTRY_PENDING == rx_status ) {
+ break;
+ }
+ }
+ }
+}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment