This thread has been locked.

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

[FAQ] LAUNCHXL-CC2640R2: How to merge a driver example in the simple_peripheral project (step by step guide)?

Expert 3225 points
Part Number: LAUNCHXL-CC2640R2

In this FAQ I will import the spimaster driver in the simple_peripheral (SBP) example project.

This guide uses the blestack but could be applied to the ble5stack.

Step 1) Add any relevant includes from spimaster.c to the main.c file of SBP located in Startup. Note, Display.h and Board.h do not have to be moved since they are already included.

Step 2) Add all the macros included in the spimaster.c file to the main.c file of SBP.

Step 3) Add all variables from the spimaster.c file to the main.c of SBP.

Step 4) Copy and paste slaveReadyFxn and masterThread above the main function in main.c.

Step 5) Copy the contents of mainThread() in between SimplePeripheral_createTask() and BIOS_start() function located in main(). Make sure not to copy the “return (NULL)” line from mainThread().

Before:

After:

Step 6) Get rid of the Display_open() section of the code. The code is highlighted in blue.

Before:

After:

Step 7) Enable POSIX in the project’s app_ble.cfg located in the TOOLS file using this line: 

xdc.useModule('ti.posix.tirtos.Settings')

Step 8) Add the POSIX headers to the project.

First, open the project properties by right clicking the project name in the system explorer.

Second, under Build -> Arm Compiler -> Include Options, add the directory that has all the header files. This is located in the SDK directory: <SDK>\source\ti\posix\ccs

Step 9) Build the project and run!