TI-RTOS Drivers
tidrivers_cc13xx_cc26xx_2_16_01_13
|
I2C driver implementation for a CC26XX I2C controller.
============================================================================
The I2C header file should be included in an application as follows:
Refer to I2C.h for a complete description of APIs.
The general I2C API is normally used in application code, e.g. I2C_open() is used instead of I2CCC26XX_open(). The board file will define the device specific config, and casting in the general API will ensure that the correct device specific functions are called. This is also reflected in the example code in Use Cases.
Before using the I2C in CC26XX:
The following is true for receive operation:
The following apply for transmit operation:
After I2C operation has ended:
If an error occurs during operation:
The I2CCC26XX driver is setting a power constraint during operation to keep the device out of standby, i.e. device will enter idle mode when no tasks are active. When the operation has finished, the power constraint is released. The following statements are valid:
Generic API Function | API Function | Description |
---|---|---|
I2C_init() | I2CCC26XX_init() | Initialize I2C driver |
I2C_open() | I2CCC26XX_open() | Initialize I2C HW and set system dependencies |
I2C_close() | I2CCC26XX_close() | Disable I2C HW and release system dependencies |
I2C_transfer() | I2CCC26XX_transfer() | Start I2C transfer |
The CC26XX I2C driver currently does not support:
Receive 10 bytes over I2C in I2C_MODE_BLOCKING.
Transmit 16 bytes over I2C in I2C_MODE_CALLBACK.
Transmit 10 bytes and then 32 bytes over I2C in I2C_MODE_CALLBACK.
The I2C driver interface produces log statements if instrumentation is enabled.
Diagnostics Mask | Log details |
---|---|
Diags_USER1 | basic I2C operations performed |
Diags_USER2 | detailed I2C operations performed |
#include <stdint.h>
#include <stdbool.h>
#include <ti/drivers/I2C.h>
#include <ti/drivers/pin/PINCC26XX.h>
#include <ti/drivers/Power.h>
#include <ti/sysbios/family/arm/m3/Hwi.h>
#include <ti/sysbios/knl/Swi.h>
#include <ti/sysbios/knl/Semaphore.h>
Go to the source code of this file.
Data Structures | |
struct | I2CCC26XX_I2CPinCfg |
I2CCC26XX Pin Configuration. More... | |
struct | I2CCC26XX_HWAttrsV1 |
I2CCC26XX Hardware attributes. More... | |
struct | I2CCC26XX_Object |
I2CCC26XX Object. More... | |
Macros | |
#define | ti_sysbios_family_arm_m3_Hwi__nolocalnames |
Typedefs | |
typedef unsigned long | I2CBaseAddrType |
typedef unsigned long | I2CDataType |
typedef struct I2CCC26XX_I2CPinCfg | I2CCC26XX_I2CPinCfg |
I2CCC26XX Pin Configuration. More... | |
typedef enum I2CCC26XX_Mode | I2CCC26XX_Mode |
I2CCC26XX mode. More... | |
typedef struct I2CCC26XX_HWAttrsV1 | I2CCC26XX_HWAttrsV1 |
I2CCC26XX Hardware attributes. More... | |
typedef struct I2CCC26XX_Object | I2CCC26XX_Object |
I2CCC26XX Object. More... | |
Enumerations | |
enum | I2CCC26XX_Mode { I2CCC26XX_IDLE_MODE = 0, I2CCC26XX_WRITE_MODE, I2CCC26XX_READ_MODE, I2CCC26XX_BUSBUSY_MODE, I2CCC26XX_ERROR = 0xFF } |
I2CCC26XX mode. More... | |
Variables | |
const I2C_FxnTable | I2CCC26XX_fxnTable |
#define ti_sysbios_family_arm_m3_Hwi__nolocalnames |
typedef unsigned long I2CBaseAddrType |
I2C Base Address type.
typedef unsigned long I2CDataType |
typedef struct I2CCC26XX_I2CPinCfg I2CCC26XX_I2CPinCfg |
I2CCC26XX Pin Configuration.
Pin configuration that holds non-default pins. The default pin configuration is typically defined in I2CCC26XX_HWAttrsV1 placed in the board file. The pin configuration structure is used by setting the custom void pointer in the I2C_Params to point to this struct. If the custom void pointer is NULL, the I2CCC26XX_HWAttrsV1 pin mapping will be used.
typedef enum I2CCC26XX_Mode I2CCC26XX_Mode |
I2CCC26XX mode.
This enum defines the state of the I2C driver's state-machine. Do not modify.
typedef struct I2CCC26XX_HWAttrsV1 I2CCC26XX_HWAttrsV1 |
I2CCC26XX Hardware attributes.
These fields, with the exception of intPriority, are used by driverlib APIs and therefore must be populated by driverlib macro definitions. For cc26xxware these definitions are found in:
intPriority is the I2C peripheral's interrupt priority, as defined by the underlying OS. It is passed unmodified to the underlying OS's interrupt handler creation code, so you need to refer to the OS documentation for usage. For example, for SYS/BIOS applications, refer to the ti.sysbios.family.arm.m3.Hwi documentation for SYS/BIOS usage of interrupt priorities. If the driver uses the ti.drivers.ports interface instead of making OS calls directly, then the HwiP port handles the interrupt priority in an OS specific way. In the case of the SYS/BIOS port, intPriority is passed unmodified to Hwi_create().
A sample structure is shown below:
typedef struct I2CCC26XX_Object I2CCC26XX_Object |
I2CCC26XX Object.
The application must not access any member variables of this structure!
enum I2CCC26XX_Mode |
const I2C_FxnTable I2CCC26XX_fxnTable |