Test environment
Protocol stack version: BLE-STACK V2.1
IAR development environment version: IAR for Arm 7.40
Hardware equipment: Amo-SmartRF v2.0 development board (corresponding to TI's official SmartRF06EB development board)
Add IIC definition
There is no IIC definition in the SDK released by TI. For our later use, let's take a look at how to add the IIC definition:
1. Open the "Board.c" file in the "C:\ti\tirtos_simplelink_2_13_00_06\packages\ti\boards\SRF06EB\CC2650EM_7ID" directory and add the following code at the end of the file:
/*
* ============================= I2C Begin=====================================
*/
/* Place into subsections to allow the TI linker to remove items properly */
#if defined(__TI_COMPILER_VERSION__)
#pragma DATA_SECTION(I2C_config, ".const:I2C_config")
#pragma DATA_SECTION(i2cCC26xxHWAttrs, ".const:i2cCC26xxHWAttrs")
#endif
/* Include drivers */
#include <ti/drivers/i2c/I2CCC26XX.h>
/* I2C objects */
I2CCC26XX_Object i2cCC26xxObjects[CC2650_I2CCOUNT];
/* I2C configuration structure, describing which pins are to be used */
const I2CCC26XX_HWAttrs i2cCC26xxHWAttrs[CC2650_I2CCOUNT] = {
{
.baseAddr = I2C0_BASE,
.powerMngrId = PERIPH_I2C0,
.intNum = INT_I2C,
.sdaPin = Board_I2C0_SDA0,
.sclPin = Board_I2C0_SCL0,
}
};
const I2C_Config I2C_config[] = {
{&I2CCC26XX_fxnTable, &i2cCC26xxObjects[0], &i2cCC26xxHWAttrs[0]},
{NULL, NULL, NULL}
};
/*
* ========================== I2C end =========================================
*/
2. Open the "Board.h" file in the "C:\ti\tirtos_simplelink_2_13_00_06\packages\ti\boards\SRF06EB\CC2650EM_7ID" directory and add the following code at the end of the file:
/* I2C */
#define Board_I2C0_SDA0 IOID_5
#define Board_I2C0_SCL0 IOID_6
#define Board_I2C0_SDA1 IOID_8
#define Board_I2C0_SCL1 IOID_9
In this file, TI defines the IOID_6 pin to the LED light, so the configuration of the LED light needs to be modified.
#define Board_LED4 IOID_6 /* RF1.4 */
to:
#define Board_LED4 IOID_0//IOID_6
Through the above configuration, we have added the IIC configuration in TIRTOS.
|