Functions
Functions
Peripheral Driver » APP DRIVER » IIC

## Functions
uint16_t | app_i2c_init (app_i2c_params_t *p_params, app_i2c_evt_handler_t evt_handler)
| Initialize the APP I2C DRIVER according to the specified parameters in the app_i2c_params_t and app_i2c_evt_handler_t. More...
uint16_t | app_i2c_deinit (app_i2c_id_t id)
| De-initialize the APP I2C DRIVER peripheral. More...
uint16_t | app_i2c_receive_sync (app_i2c_id_t id, uint16_t target_address, uint8_t *p_data, uint16_t size, uint32_t timeout)
| Receive in master or slave mode an amount of data in blocking mode. More...
uint16_t | app_i2c_receive_async (app_i2c_id_t id, uint16_t target_address, uint8_t *p_data, uint16_t size)
| Receive in master or slave mode an amount of data in non-blocking mode with Interrupt/DMA. More...
uint16_t | app_i2c_transmit_sync (app_i2c_id_t id, uint16_t target_address, uint8_t *p_data, uint16_t size, uint32_t timeout)
| Transmits in master or slave mode an amount of data in blocking mode. More...
uint16_t | app_i2c_transmit_async (app_i2c_id_t id, uint16_t target_address, uint8_t *p_data, uint16_t size)
| Transmits in master or slave mode an amount of data in non-blocking mode with Interrupt/DMA. More...
uint16_t | app_i2c_mem_read_sync (app_i2c_id_t id, uint16_t dev_address, uint16_t mem_address, uint16_t mem_addr_size, uint8_t *p_data, uint16_t size, uint32_t timeout)
| Read an amount of data in blocking mode from a specific memory address. More...
uint16_t | app_i2c_mem_read_async (app_i2c_id_t id, uint16_t dev_address, uint16_t mem_address, uint16_t mem_addr_size, uint8_t *p_data, uint16_t size)
| Read an amount of data in non-blocking mode with Interrupt/DMA from a specific memory address. More...
uint16_t | app_i2c_mem_write_sync (app_i2c_id_t id, uint16_t dev_address, uint16_t mem_address, uint16_t mem_addr_size, uint8_t *p_data, uint16_t size, uint32_t timeout)
| Write an amount of data in blocking mode to a specific memory address. More...
uint16_t | app_i2c_mem_write_async (app_i2c_id_t id, uint16_t dev_address, uint16_t mem_address, uint16_t mem_addr_size, uint8_t *p_data, uint16_t size)
| Write an amount of data in non-blocking mode with Interrupt/DMA to a specific memory address. More...
i2c_handle_t * | app_i2c_get_handle (app_i2c_id_t id)
| Return the I2C handle. More...

## Detailed Description

## Function Documentation

## ◆ app_i2c_deinit()

uint16_t app_i2c_deinit | ( | app_i2c_id_t | id | ) |

De-initialize the APP I2C DRIVER peripheral.

Parameters

  [in] | id | De-initialize for a specific ID.

Returns
  Result of De-initialization.

## ◆ app_i2c_get_handle()

i2c_handle_t* app_i2c_get_handle | ( | app_i2c_id_t | id | ) |

Return the I2C handle.

Parameters

  [in] | id | I2C module ID.

Returns
  Pointer to the specified ID's I2C handle.

## ◆ app_i2c_init()

uint16_t app_i2c_init | ( | app_i2c_params_t * | p_params,
|  | app_i2c_evt_handler_t | evt_handler
| ) |  |

Initialize the APP I2C DRIVER according to the specified parameters in the app_i2c_params_t and app_i2c_evt_handler_t.

Note
  If interrupt mode is set, you can use blocking mode. Conversely, if blocking mode is set, you can't use interrupt mode.

Parameters

  [in] | p_params | Pointer to app_i2c_params_t parameter which contains the configuration information for the specified I2C module.
  [in] | evt_handler | I2C user callback function.

Returns
  Result of initialization.

## ◆ app_i2c_mem_read_async()

uint16_t app_i2c_mem_read_async | ( | app_i2c_id_t | id,
|  | uint16_t | dev_address,
|  | uint16_t | mem_address,
|  | uint16_t | mem_addr_size,
|  | uint8_t * | p_data,
|  | uint16_t | size
| ) |  |

Read an amount of data in non-blocking mode with Interrupt/DMA from a specific memory address.

Parameters

  [in] | id | I2C module ID.
  [in] | dev_address | Target device address: The device 7 bits address value in datasheet must be shifted at right before call interface
  [in] | mem_address | Internal memory address
  [in] | mem_addr_size | Size of internal memory address
  [in] | p_data | Pointer to data buffer
  [in] | size | Amount of data to be sent

Returns
  Result of operation.

## ◆ app_i2c_mem_read_sync()

uint16_t app_i2c_mem_read_sync | ( | app_i2c_id_t | id,
|  | uint16_t | dev_address,
|  | uint16_t | mem_address,
|  | uint16_t | mem_addr_size,
|  | uint8_t * | p_data,
|  | uint16_t | size,
|  | uint32_t | timeout
| ) |  |

Read an amount of data in blocking mode from a specific memory address.

Parameters

  [in] | id | I2C module ID.
  [in] | dev_address | Target device address: The device 7 bits address value in datasheet must be shifted at right before call interface
  [in] | mem_address | Internal memory address
  [in] | mem_addr_size | Size of internal memory address
  [in] | p_data | Pointer to data buffer
  [in] | size | Amount of data to be sent
  [in] | timeout | Timeout duration

Returns
  Result of operation.

## ◆ app_i2c_mem_write_async()

uint16_t app_i2c_mem_write_async | ( | app_i2c_id_t | id,
|  | uint16_t | dev_address,
|  | uint16_t | mem_address,
|  | uint16_t | mem_addr_size,
|  | uint8_t * | p_data,
|  | uint16_t | size
| ) |  |

Write an amount of data in non-blocking mode with Interrupt/DMA to a specific memory address.

Parameters

  [in] | id | I2C module ID.
  [in] | dev_address | Target device address: The device 7 bits address value in datasheet must be shifted at right before call interface
  [in] | mem_address | Internal memory address
  [in] | mem_addr_size | Size of internal memory address
  [in] | p_data | Pointer to data buffer
  [in] | size | Amount of data to be sent

Returns
  Result of operation.

## ◆ app_i2c_mem_write_sync()

uint16_t app_i2c_mem_write_sync | ( | app_i2c_id_t | id,
|  | uint16_t | dev_address,
|  | uint16_t | mem_address,
|  | uint16_t | mem_addr_size,
|  | uint8_t * | p_data,
|  | uint16_t | size,
|  | uint32_t | timeout
| ) |  |

Write an amount of data in blocking mode to a specific memory address.

Parameters

  [in] | id | I2C module ID.
  [in] | dev_address | Target device address: The device 7 bits address value in datasheet must be shifted at right before call interface
  [in] | mem_address | Internal memory address
  [in] | mem_addr_size | Size of internal memory address
  [in] | p_data | Pointer to data buffer
  [in] | size | Amount of data to be sent
  [in] | timeout | Timeout duration

Returns
  Result of operation.

## ◆ app_i2c_receive_async()

uint16_t app_i2c_receive_async | ( | app_i2c_id_t | id,
|  | uint16_t | target_address,
|  | uint8_t * | p_data,
|  | uint16_t | size
| ) |  |

Receive in master or slave mode an amount of data in non-blocking mode with Interrupt/DMA.

Parameters

  [in] | id | which I2C module want to receive.
  [in] | target_address | Target device address: The device 7 bits address value in datasheet must be shifted at right before call interface.
  [in] | p_data | Pointer to data buffer
  [in] | size | Amount of data to be sent

Returns
  Result of operation.

## ◆ app_i2c_receive_sync()

uint16_t app_i2c_receive_sync | ( | app_i2c_id_t | id,
|  | uint16_t | target_address,
|  | uint8_t * | p_data,
|  | uint16_t | size,
|  | uint32_t | timeout
| ) |  |

Receive in master or slave mode an amount of data in blocking mode.

Parameters

  [in] | id | which I2C module want to receive.
  [in] | target_address | Target device address: The device 7 bits address value in datasheet must be shifted at right before call interface.
  [in] | p_data | Pointer to data buffer
  [in] | size | Amount of data to be sent
  [in] | timeout | Timeout duration

Returns
  Result of operation.

## ◆ app_i2c_transmit_async()

uint16_t app_i2c_transmit_async | ( | app_i2c_id_t | id,
|  | uint16_t | target_address,
|  | uint8_t * | p_data,
|  | uint16_t | size
| ) |  |

Transmits in master or slave mode an amount of data in non-blocking mode with Interrupt/DMA.

Parameters

  [in] | id | which I2C module want to transmit.
  [in] | target_address | Target device address: The device 7 bits address value in datasheet must be shifted at right before call interface.
  [in] | p_data | Pointer to data buffer
  [in] | size | Amount of data to be sent

Returns
  Result of operation.

## ◆ app_i2c_transmit_sync()

uint16_t app_i2c_transmit_sync | ( | app_i2c_id_t | id,
|  | uint16_t | target_address,
|  | uint8_t * | p_data,
|  | uint16_t | size,
|  | uint32_t | timeout
| ) |  |

Transmits in master or slave mode an amount of data in blocking mode.

Parameters

  [in] | id | which I2C module want to transmit.
  [in] | target_address | Target device address: The device 7 bits address value in datasheet must be shifted at right before call interface.
  [in] | p_data | Pointer to data buffer
  [in] | size | Amount of data to be sent
  [in] | timeout | Timeout duration

Returns
  Result of operation.