Functions
Peripheral State and Errors functions
Peripheral Driver » HAL Driver » I2S » Functions

I2S control functions. More...

Collaboration diagram for Peripheral State and Errors functions:

## Functions
hal_i2s_state_t | hal_i2s_get_state (i2s_handle_t *p_i2s)
| Return the I2S handle state. More...
uint32_t | hal_i2s_get_error (i2s_handle_t *p_i2s)
| Return the I2S error code. More...
hal_status_t | hal_i2s_set_tx_fifo_threshold (i2s_handle_t *p_i2s, uint32_t threshold)
| Set the TX FIFO threshold. More...
hal_status_t | hal_i2s_set_rx_fifo_threshold (i2s_handle_t *p_i2s, uint32_t threshold)
| Set the RX FIFO threshold. More...
uint32_t | hal_i2s_get_tx_fifo_threshold (i2s_handle_t *p_i2s)
| Get the TX FIFO threshold. More...
uint32_t | hal_i2s_get_rx_fifo_threshold (i2s_handle_t *p_i2s)
| Get the RX FIFO threshold. More...
hal_status_t | hal_i2s_suspend_reg (i2s_handle_t *p_i2s)
| Suspend some registers related to I2S configuration before sleep. More...
hal_status_t | hal_i2s_resume_reg (i2s_handle_t *p_i2s)
| Restore some registers related to I2S configuration after sleep. More...

## Detailed Description

I2S control functions.

     ===============================================================================
                          ##### Peripheral State and Errors functions #####
     ===============================================================================
        [..]
        This subsection provides a set of functions allowing to control the I2S.
         (+) hal_i2s_get_state() API can be helpful to check in run-time the state of the I2S peripheral
         (+) hal_i2s_get_error() check in run-time Errors occurring during communication
         (+) hal_i2s_set_timeout() set the timeout during internal process
         (+) hal_i2s_set_tx_fifo_threshold() set the TX FIFO Threshold
         (+) hal_i2s_set_rx_fifo_threshold() set the RX FIFO Threshold
         (+) hal_i2s_get_tx_fifo_threshold() get the TX FIFO Threshold
         (+) hal_i2s_get_rx_fifo_threshold() get the RX FIFO Threshold

## Function Documentation

## ◆ hal_i2s_get_error()

uint32_t hal_i2s_get_error | ( | i2s_handle_t * | p_i2s | ) |

Return the I2S error code.

Parameters

  [in] | p_i2s | Pointer to an I2S handle which contains the configuration information for the specified I2S module.

Returns
  I2S error code in bitmap format

## ◆ hal_i2s_get_rx_fifo_threshold()

uint32_t hal_i2s_get_rx_fifo_threshold | ( | i2s_handle_t * | p_i2s | ) |

Get the RX FIFO threshold.

Parameters

  [in] | p_i2s | Pointer to an I2S handle which contains the configuration information for the specified I2S module.

Returns
  RX FIFO threshold

## ◆ hal_i2s_get_state()

hal_i2s_state_t hal_i2s_get_state | ( | i2s_handle_t * | p_i2s | ) |

Return the I2S handle state.

Parameters

  [in] | p_i2s | Pointer to an I2S handle which contains the configuration information for the specified I2S module.

Return values

  HAL_I2S_STATE_RESET | Peripheral not initialized.
  HAL_I2S_STATE_READY | Peripheral initialized and ready for use.
  HAL_I2S_STATE_BUSY | An internal process is ongoing.
  HAL_I2S_STATE_BUSY_TX | Data Transmii2son process is ongoing.
  HAL_I2S_STATE_BUSY_RX | Data Reception process is ongoing.
  HAL_I2S_STATE_ABORT | Peripheral with abort request ongoing.
  HAL_I2S_STATE_ERROR | Peripheral in error.

## ◆ hal_i2s_get_tx_fifo_threshold()

uint32_t hal_i2s_get_tx_fifo_threshold | ( | i2s_handle_t * | p_i2s | ) |

Get the TX FIFO threshold.

Parameters

  [in] | p_i2s | Pointer to an I2S handle which contains the configuration information for the specified I2S module.

Returns
  TX FIFO threshold

## ◆ hal_i2s_resume_reg()

hal_status_t hal_i2s_resume_reg | ( | i2s_handle_t * | p_i2s | ) |

Restore some registers related to I2S configuration after sleep.

This function must be used in conjunction with the hal_i2s_suspend_reg().

Parameters

  [in] | p_i2s | Pointer to a I2S handle which contains the configuration information for the specified I2S module.

Return values

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

## ◆ hal_i2s_set_rx_fifo_threshold()

hal_status_t hal_i2s_set_rx_fifo_threshold | ( | i2s_handle_t * | p_i2s,
|  | uint32_t | threshold
| ) |  |

Set the RX FIFO threshold.

Parameters

  [in] | p_i2s | Pointer to an I2S handle which contains the configuration information for the specified I2S module.
  [in] | threshold | RX FIFO threshold value ranging bwtween 0x0U ~ 0x7U.

Return values

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

## ◆ hal_i2s_set_tx_fifo_threshold()

hal_status_t hal_i2s_set_tx_fifo_threshold | ( | i2s_handle_t * | p_i2s,
|  | uint32_t | threshold
| ) |  |

Set the TX FIFO threshold.

Parameters

  [in] | p_i2s | Pointer to an I2S handle which contains the configuration information for the specified I2S module.
  [in] | threshold | TX FIFO threshold value ranging bwtween 0x0U ~ 0x7U.

Return values

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

## ◆ hal_i2s_suspend_reg()

hal_status_t hal_i2s_suspend_reg | ( | i2s_handle_t * | p_i2s | ) |

Suspend some registers related to I2S configuration before sleep.

Parameters

  [in] | p_i2s | Pointer to a I2S handle which contains the configuration information for the specified I2S module.

Return values

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