TI-RTOS Drivers  tidrivers_full_2_20_00_08
Data Structures | Typedefs | Enumerations | Variables
I2CEUSCIB.h File Reference

Detailed Description

I2CEUSCIB driver implementation for an EUSCIB controller.

============================================================================

The I2CEUSCIB header file should be included in an application as follows:

Refer to I2C.h for a complete description of APIs & example of use.

This I2C driver implementation is designed to operate on a EUSCIB controller in I2C mode.

Interrupts

This driver is interrupt driven. For MSP430 devices, it requires the user to statically create a Hwi (in the application .cfg file) for the associated EUSCIB controller, and have it call the I2CEUSCIB's Hwi interrupt function I2CEUSCIB_hwiIntFxn().

The following information is needed to create the Hwi:

  1. Interrupt vector
    The interrupt vector number can be found in the MSP430 device specific header file (e.g. msp430f5529.h).
  2. Hwi function pointer
    Call I2CEUSCIB_hwiIntFxn()
  3. Hwi function argument
    This argument to the Hwi indexes into the I2C_config[] data structure. Ensure you are indexing into the I2C_config[] element that uses a I2CEUSCIB_fxnTable pointer.
// Statically create a I2CEUSCIB Hwi in the .cfg file
var hwi0Params = new Hwi.Params();
hwi0Params.instance.name = "hwi0";
hwi0Params.arg = 0; // I2C_config[0];
Program.global.hwi0 = Hwi.create(45, "&I2CEUSCIB_hwiIntFxn", hwi0Params);

#include <stdint.h>
#include <stdbool.h>
#include <ti/drivers/I2C.h>
#include <ti/sysbios/knl/Semaphore.h>
Include dependency graph for I2CEUSCIB.h:

Go to the source code of this file.

Data Structures

struct  I2CEUSCIB_HWAttrs
 I2CEUSCIB Hardware attributes. More...
 
struct  I2CEUSCIB_Object
 I2CEUSCIB Object. More...
 

Typedefs

typedef enum I2CEUSCIB_Mode I2CEUSCIB_Mode
 I2CEUSCIB mode. More...
 
typedef struct I2CEUSCIB_HWAttrs I2CEUSCIB_HWAttrs
 I2CEUSCIB Hardware attributes. More...
 
typedef struct I2CEUSCIB_Object I2CEUSCIB_Object
 I2CEUSCIB Object. More...
 

Enumerations

enum  I2CEUSCIB_Mode {
  I2CEUSCIB_IDLE_MODE = 0,
  I2CEUSCIB_WRITE_MODE,
  I2CEUSCIB_READ_MODE,
  I2CEUSCIB_ERROR = 0xFF
}
 I2CEUSCIB mode. More...
 

Variables

const I2C_FxnTable I2CEUSCIB_fxnTable
 

Typedef Documentation

I2CEUSCIB mode.

This enum defines the state of the I2C driver's state-machine. Do not modify.

I2CEUSCIB Hardware attributes.

These fields are used by driverlib APIs and therefore must be populated by driverlib macro definitions. For MSP430Ware these definitions are found in:

  • inc/hw_memmap.h
  • eusci_b_i2c.h

A sample structure is shown below:

1 const I2CEUSCIB_HWAttrs i2cUSCIBHWAttrs[] = {
2  {
3  .baseAddr = EUSCI_B0_BASE,
4  .clockSource = EUSCI_B_I2C_CLOCKSOURCE_SMCLK
5  },
6  {
7  .baseAddr = EUSCI_B1_BASE,
8  .clockSource = EUSCI_B_I2C_CLOCKSOURCE_SMCLK
9  },
10 };

I2CEUSCIB Object.

The application must not access any member variables of this structure!

Enumeration Type Documentation

I2CEUSCIB mode.

This enum defines the state of the I2C driver's state-machine. Do not modify.

Enumerator
I2CEUSCIB_IDLE_MODE 
I2CEUSCIB_WRITE_MODE 
I2CEUSCIB_READ_MODE 
I2CEUSCIB_ERROR 

Variable Documentation

const I2C_FxnTable I2CEUSCIB_fxnTable
Copyright 2016, Texas Instruments Incorporated