Functions
Functions
Peripheral Driver » APP DRIVER » I2S

## Functions
uint16_t | app_i2s_init (app_i2s_params_t *p_params, app_i2s_evt_handler_t evt_handler)
| Initialize the APP I2S DRIVER according to the specified parameters in the app_i2s_params_t and app_i2s_evt_handler_t. More...
uint16_t | app_i2s_deinit (app_i2s_id_t id)
| De-initialize the APP I2S DRIVER peripheral. More...
uint16_t | app_i2s_receive_sync (app_i2s_id_t id, uint16_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_i2s_receive_async (app_i2s_id_t id, uint16_t *p_data, uint16_t size)
| Receive in master or slave mode an amount of data in non-blocking mode with Interrupt. More...
uint16_t | app_i2s_transmit_sync (app_i2s_id_t id, uint16_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_i2s_transmit_async (app_i2s_id_t id, uint16_t *p_data, uint16_t size)
| Transmits in master or slave mode an amount of data in non-blocking mode with Interrupt. More...
uint16_t | app_i2s_enable (app_i2s_id_t id)
| Enable the I2S moudle. More...
uint16_t | app_i2s_disable (app_i2s_id_t id)
| Disable the I2S moudle. More...
uint16_t | app_i2s_enable_clock (app_i2s_id_t id)
| Enable the master I2S clock. More...
uint16_t | app_i2s_disable_clock (app_i2s_id_t id)
| Disable the master I2S clock. More...
uint16_t | app_i2s_flush_tx_fifo (app_i2s_id_t id)
| Flush the I2S transmitter FIFO. More...
uint16_t | app_i2s_flush_rx_fifo (app_i2s_id_t id)
| Flush the I2S receiver FIFO. More...
i2s_handle_t * | app_i2s_get_handle (app_i2s_id_t id)
| Return the I2S handle. More...
uint16_t | app_i2s_abort (app_i2s_id_t id)
| Abort ongoing transfer (blocking mode). More...
uint16_t | app_i2s_transmit_receive_sync (app_i2s_id_t id, uint16_t *p_tx_data, uint16_t *p_rx_data, uint32_t length, uint32_t timeout)
| Transmit and Receive an amount of data in blocking mode. More...
uint16_t | app_i2s_transmit_receive_async (app_i2s_id_t id, uint16_t *p_tx_data, uint16_t *p_rx_data, uint32_t length)
| Transmit and Receive an amount of data in non-blocking mode with Interrupt. More...
uint16_t | app_i2s_dma_init (app_i2s_params_t *p_params)
| Initialize the APP I2S DRIVER according to the specified parameters in the app_i2s_params_t and app_i2s_evt_handler_t. More...
uint16_t | app_i2s_dma_deinit (app_i2s_id_t id)
| De-initialize the APP I2S DRIVER peripheral. More...
uint16_t | app_i2s_dma_receive_async (app_i2s_id_t id, uint16_t *p_data, uint16_t size)
| Receive in master or slave mode an amount of data in non-blocking mode with Interrupt. More...
uint16_t | app_i2s_dma_transmit_async (app_i2s_id_t id, uint16_t *p_data, uint16_t size)
| Transmits in master or slave mode an amount of data in non-blocking mode with Interrupt. More...
uint16_t | app_i2s_dma_transmit_receive_async (app_i2s_id_t id, uint16_t *p_tx_data, uint16_t *p_rx_data, uint32_t length)
| Transmit and Receive an amount of data in non-blocking mode with Interrupt. More...

## Detailed Description

## Function Documentation

## ◆ app_i2s_abort()

uint16_t app_i2s_abort | ( | app_i2s_id_t | id | ) |

Abort ongoing transfer (blocking mode).

Parameters

  id | I2S ID

Note
  This procedure is executed in blocking mode: When exiting function, Abort is considered as completed.

Return values

  APP_DRV_SUCCESS | Operation is OK.
  HAL_ERROR | Parameter error or operation not supported.
  HAL_BUSY | Driver is busy.
  HAL_TIMEOUT | Timeout occurred.
  APP_DRV_ERR_INVALID_PARAM | Parameter error.

## ◆ app_i2s_deinit()

uint16_t app_i2s_deinit | ( | app_i2s_id_t | id | ) |

De-initialize the APP I2S DRIVER peripheral.

Parameters

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

Returns
  Result of De-initialization.

## ◆ app_i2s_disable()

uint16_t app_i2s_disable | ( | app_i2s_id_t | id | ) |

Disable the I2S moudle.

Parameters

  [in] | id | The I2S module id.

Returns
  Result of operation.

## ◆ app_i2s_disable_clock()

uint16_t app_i2s_disable_clock | ( | app_i2s_id_t | id | ) |

Disable the master I2S clock.

Parameters

  [in] | id | The I2S master module id.

Returns
  Result of operation.

## ◆ app_i2s_dma_deinit()

uint16_t app_i2s_dma_deinit | ( | app_i2s_id_t | id | ) |

De-initialize the APP I2S DRIVER peripheral.

Parameters

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

Returns
  Result of De-initialization.

## ◆ app_i2s_dma_init()

uint16_t app_i2s_dma_init | ( | app_i2s_params_t * | p_params | ) |

Initialize the APP I2S DRIVER according to the specified parameters in the app_i2s_params_t and app_i2s_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_i2s_params_t parameter which contains the configuration information for the specified I2S module.

Returns
  Result of initialization.

## ◆ app_i2s_dma_receive_async()

uint16_t app_i2s_dma_receive_async | ( | app_i2s_id_t | id,
|  | uint16_t * | p_data,
|  | uint16_t | size
| ) |  |

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

Parameters

  [in] | id | which I2S module want to receive.
  [in] | p_data | Pointer to data buffer
  [in] | size | Amount of data to be sent

Returns
  Result of operation.

## ◆ app_i2s_dma_transmit_async()

uint16_t app_i2s_dma_transmit_async | ( | app_i2s_id_t | id,
|  | uint16_t * | p_data,
|  | uint16_t | size
| ) |  |

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

Parameters

  [in] | id | which I2S module want to transmit.
  [in] | p_data | Pointer to data buffer
  [in] | size | Amount of data to be sent

Returns
  Result of operation.

## ◆ app_i2s_dma_transmit_receive_async()

uint16_t app_i2s_dma_transmit_receive_async | ( | app_i2s_id_t | id,
|  | uint16_t * | p_tx_data,
|  | uint16_t * | p_rx_data,
|  | uint32_t | length
| ) |  |

Transmit and Receive an amount of data in non-blocking mode with Interrupt.

Parameters

  [in] | id | I2S ID
  [in] | p_tx_data | Pointer to transmission data buffer
  [out] | p_rx_data | Pointer to reception data buffer
  [in] | length | Amount of data to be sent and received in bytes

Return values

  APP_DRV_SUCCESS | Operation is OK.
  HAL_ERROR | Parameter error or operation not supported.
  HAL_BUSY | Driver is busy.
  HAL_TIMEOUT | Timeout occurred.
  APP_DRV_ERR_INVALID_PARAM | Parameter error.
  APP_DRV_ERR_BUSY | Driver is busy.

## ◆ app_i2s_enable()

uint16_t app_i2s_enable | ( | app_i2s_id_t | id | ) |

Enable the I2S moudle.

Parameters

  [in] | id | The I2S module id.

Returns
  Result of operation.

## ◆ app_i2s_enable_clock()

uint16_t app_i2s_enable_clock | ( | app_i2s_id_t | id | ) |

Enable the master I2S clock.

Parameters

  [in] | id | The I2S master module id.

Returns
  Result of operation.

## ◆ app_i2s_flush_rx_fifo()

uint16_t app_i2s_flush_rx_fifo | ( | app_i2s_id_t | id | ) |

Flush the I2S receiver FIFO.

Parameters

  [in] | id | which I2S module want to flush.

Returns
  Result of operation.

## ◆ app_i2s_flush_tx_fifo()

uint16_t app_i2s_flush_tx_fifo | ( | app_i2s_id_t | id | ) |

Flush the I2S transmitter FIFO.

Parameters

  [in] | id | which I2S module want to flush.

Returns
  Result of operation.

## ◆ app_i2s_get_handle()

i2s_handle_t* app_i2s_get_handle | ( | app_i2s_id_t | id | ) |

Return the I2S handle.

Parameters

  [in] | id | I2S Channel ID.

Returns
  Pointer to the specified ID's I2S handle.

## ◆ app_i2s_init()

uint16_t app_i2s_init | ( | app_i2s_params_t * | p_params,
|  | app_i2s_evt_handler_t | evt_handler
| ) |  |

Initialize the APP I2S DRIVER according to the specified parameters in the app_i2s_params_t and app_i2s_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_i2s_params_t parameter which contains the configuration information for the specified I2S module.
  [in] | evt_handler | I2S user callback function.

Returns
  Result of initialization.

## ◆ app_i2s_receive_async()

uint16_t app_i2s_receive_async | ( | app_i2s_id_t | id,
|  | uint16_t * | p_data,
|  | uint16_t | size
| ) |  |

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

Parameters

  [in] | id | which I2S module want to receive.
  [in] | p_data | Pointer to data buffer
  [in] | size | Amount of data to be sent

Returns
  Result of operation.

## ◆ app_i2s_receive_sync()

uint16_t app_i2s_receive_sync | ( | app_i2s_id_t | id,
|  | uint16_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 I2S module want to receive.
  [in] | p_data | Pointer to data buffer
  [in] | size | Amount of data to be sent
  [in] | timeout | Timeout duration

Returns
  Result of operation.

## ◆ app_i2s_transmit_async()

uint16_t app_i2s_transmit_async | ( | app_i2s_id_t | id,
|  | uint16_t * | p_data,
|  | uint16_t | size
| ) |  |

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

Parameters

  [in] | id | which I2S module want to transmit.
  [in] | p_data | Pointer to data buffer
  [in] | size | Amount of data to be sent

Returns
  Result of operation.

## ◆ app_i2s_transmit_receive_async()

uint16_t app_i2s_transmit_receive_async | ( | app_i2s_id_t | id,
|  | uint16_t * | p_tx_data,
|  | uint16_t * | p_rx_data,
|  | uint32_t | length
| ) |  |

Transmit and Receive an amount of data in non-blocking mode with Interrupt.

Parameters

  [in] | id | I2S ID
  [in] | p_tx_data | Pointer to transmission data buffer
  [out] | p_rx_data | Pointer to reception data buffer
  [in] | length | Amount of data to be sent and received in bytes

Return values

  APP_DRV_SUCCESS | Operation is OK.
  HAL_ERROR | Parameter error or operation not supported.
  HAL_BUSY | Driver is busy.
  HAL_TIMEOUT | Timeout occurred.
  APP_DRV_ERR_INVALID_PARAM | Parameter error.
  APP_DRV_ERR_BUSY | Driver is busy.

## ◆ app_i2s_transmit_receive_sync()

uint16_t app_i2s_transmit_receive_sync | ( | app_i2s_id_t | id,
|  | uint16_t * | p_tx_data,
|  | uint16_t * | p_rx_data,
|  | uint32_t | length,
|  | uint32_t | timeout
| ) |  |

Transmit and Receive an amount of data in blocking mode.

Parameters

  | id | I2S ID
  | p_tx_data | Pointer to transmission data buffer
  [out] | p_rx_data | Pointer to reception data buffer
  [in] | length | Amount of data to be sent and received in bytes
  [in] | timeout | Timeout duration

Return values

  APP_DRV_SUCCESS | Operation is OK.
  HAL_ERROR | Parameter error or operation not supported.
  HAL_BUSY | Driver is busy.
  HAL_TIMEOUT | Timeout occurred.
  APP_DRV_ERR_INVALID_PARAM | Parameter error.
  APP_DRV_ERR_BUSY | Driver is busy.

## ◆ app_i2s_transmit_sync()

uint16_t app_i2s_transmit_sync | ( | app_i2s_id_t | id,
|  | uint16_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 I2S module want to transmit.
  [in] | p_data | Pointer to data buffer
  [in] | size | Amount of data to be sent
  [in] | timeout | Timeout duration

Returns
  Result of operation.