| ISF 2.1 Intelligent Sensing Framework for Kinetis with Processor Expert

- Main Page
- Modules
- Data Structures
- Files

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Data Structures | Macros | Typedefs | Enumerations | Functions
I2c_master

## Data Structures
struct | I2CDeviceInfo
| Information necessary to communicate with an I2C slave device. More...
struct | sync_object_t
| Type for an synchronization object. More...
struct | I2CMasterState
| Internal driver state information. More...

## Macros
#define | I2C_PEX_WRITE_EVENT_SUCCESS (1)
#define | I2C_PEX_WRITE_EVENT_ERROR (I2C_PEX_WRITE_EVENT_SUCCESS << 1)
#define | I2C_PEX_READ_EVENT_SUCCESS (I2C_PEX_WRITE_EVENT_ERROR << 1)
#define | I2C_PEX_READ_EVENT_ERROR (I2C_PEX_READ_EVENT_SUCCESS << 1)

## Typedefs
typedef struct I2CDeviceInfo | i2c_device_t
| Information necessary to communicate with an I2C slave device. More...
typedef enum I2CDirection | i2c_direction_t
| Constants for the direction of an I2C transfer. More...
typedef struct I2CMasterState | i2c_master_t
| Internal driver state information. More...

## Enumerations
enum | I2CDirection { kI2CRead = 1, kI2CWrite = 0 }
| Constants for the direction of an I2C transfer. More...
enum | _i2c_transfer_flags { kI2CNoStart = 1 << 1, kI2CNoStop = 1 << 2 }
| Optional flags to control a transfer. More...

## Functions
void | i2c_master_init (uint32_t instance, i2c_master_t *master)
| Initialize the I2C master mode driver. More...
void | i2c_master_shutdown (i2c_master_t *master)
| Shut down the driver. More...
i2c_status_t | i2c_master_configure_bus (i2c_master_t *master, const i2c_device_t *device)
| Configure the I2C bus to access a device. More...
i2c_status_t | i2c_master_transfer (i2c_master_t *master, const i2c_device_t *device, i2c_direction_t direction, bool stopAfterTransfer, uint32_t subaddress, size_t subaddressLength, uint8_t *data, size_t dataLength, size_t *actualLengthTransferred, uint32_t timeout_ms)
| Perform a blocking read or write transaction on the I2C bus. More...

## Detailed Description

## Macro Definition Documentation

#define I2C_PEX_READ_EVENT_ERROR (I2C_PEX_READ_EVENT_SUCCESS << 1)

Definition at line 78 of file fsl_i2c_master_driver.h.

#define I2C_PEX_READ_EVENT_SUCCESS (I2C_PEX_WRITE_EVENT_ERROR << 1)

Definition at line 77 of file fsl_i2c_master_driver.h.

Referenced by I2CBUS1_OnMasterBlockReceived().

#define I2C_PEX_WRITE_EVENT_ERROR (I2C_PEX_WRITE_EVENT_SUCCESS << 1)

Definition at line 76 of file fsl_i2c_master_driver.h.

#define I2C_PEX_WRITE_EVENT_SUCCESS (1)

Definition at line 75 of file fsl_i2c_master_driver.h.

Referenced by I2CBUS1_OnMasterBlockSent().

## Typedef Documentation

typedef struct I2CDeviceInfo i2c_device_t

Information necessary to communicate with an I2C slave device.

typedef enum I2CDirection i2c_direction_t

Constants for the direction of an I2C transfer.

typedef struct I2CMasterState i2c_master_t

Internal driver state information.

Note
  The contents of this structure are internal to the driver and should not be modified by users. Also, contents of the structure are subject to change in future releases.

## Enumeration Type Documentation

enum _i2c_transfer_flags

Optional flags to control a transfer.

Enumerator
kI2CNoStart | Set this flag to prevent sending a START signal.
kI2CNoStop | Set this flag to prevent sending a STOP signal.

Definition at line 45 of file fsl_i2c_master_driver.h.

enum I2CDirection

Constants for the direction of an I2C transfer.

Enumerator
kI2CRead | Read from slave device.
kI2CWrite | Write to slave device.

Definition at line 38 of file fsl_i2c_master_driver.h.

## Function Documentation

i2c_status_t i2c_master_configure_bus | ( | i2c_master_t * | master,
|  | const i2c_device_t * | device
| ) |  |

Configure the I2C bus to access a device.

Parameters

  master | The pointer to the I2C master driver state structure.
  device | The pointer to the I2C device information struct.

Returns
  i2c_master_configure_bus() returns a value of type i2c_status_t indicating whether the operation was successful or unsuccessful.

Definition at line 87 of file fsl_i2c_master_driver.c.

References kStatus_I2C_Success.

Referenced by i2c_master_adapter_configure().

Here is the caller graph for this function:

void i2c_master_init | ( | uint32_t | instance,
|  | i2c_master_t * | master
| ) |  |

Initialize the I2C master mode driver.

Parameters

  instance | The I2C peripheral instance number.
  master | The pointer to the I2C master driver state structure.

Returns
  None.

Definition at line 53 of file fsl_i2c_master_driver.c.

References i2c_instance_PEx::fnI2CLLDInit, gSys_NumI2cBuses, I2CMasterState::i2cEventHandler, I2CMasterState::instance, and I2CMasterState::pDeviceHandle.

Referenced by i2c_master_adapter_init().

Here is the caller graph for this function:

void i2c_master_shutdown | ( | i2c_master_t * | master | ) |

Shut down the driver.

Parameters

  master | The pointer to the I2C master driver state structure.

Returns
  None.

Definition at line 73 of file fsl_i2c_master_driver.c.

References i2c_instance_PEx::fnI2CLLDDeint, gSys_NumI2cBuses, I2CMasterState::instance, and I2CMasterState::pUserData.

i2c_status_t i2c_master_transfer | ( | i2c_master_t * | master,
|  | const i2c_device_t * | device,
|  | i2c_direction_t | direction,
|  | bool | stopAfterTransfer,
|  | uint32_t | subaddress,
|  | size_t | subaddressLength,
|  | uint8_t * | data,
|  | size_t | dataLength,
|  | size_t * | actualLengthTransferred,
|  | uint32_t | timeout_ms
| ) |  |

Perform a blocking read or write transaction on the I2C bus.

Parameters

  master | The pointer to the I2C master driver state structure.
  device | The pointer to the I2C device information struct.
  direction | The direction of an I2C transfer.
  stopAfterTransfer | Send STOP signal after this transfer or not.
  subaddress | The subaddress for a device if it has.
  subaddressLength | The length of the subaddress.
  data | The pointer to the data to be transfered.
  dataLength | The length in bytes of the data to be transfered.
  actualLengthTransferred | The length in bytes of the data thansfered.
  timeout_ms | A timeout for the transfer in microseconds.

Returns
  i2c_master_transfer() returns a value of type i2c_status_t indicating whether the operation was successful or unsuccessful.

Definition at line 102 of file fsl_i2c_master_driver.c.

References I2CDeviceInfo::address, I2CDeviceInfo::addrType, i2c_instance_PEx::fnI2CLLDDeviceSelect, gSys_NumI2cBuses, I2CMasterState::instance, kStatus_I2C_Fail, kStatus_I2C_InvalidArgument, and I2CMasterState::pDeviceHandle.

Referenced by i2c_master_adapter_get_endpoint(), i2c_master_adapter_read(), and i2c_master_adapter_write().

Here is the caller graph for this function:
- © Freescale Semiconductor, Inc. 2015. All Rights Reserved.