STM32F4xx HAL Documentation
Hardware Abstraction Layer for STM32F4 familiy
Loading...
Searching...
No Matches
IO operation functions

Data transfers functions. More...

Collaboration diagram for IO operation functions:

Functions

HAL_StatusTypeDef HAL_I2S_Transmit (I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size, uint32_t Timeout)
 Transmit an amount of data in blocking mode.
 
HAL_StatusTypeDef HAL_I2S_Receive (I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size, uint32_t Timeout)
 Receive an amount of data in blocking mode.
 
HAL_StatusTypeDef HAL_I2S_Transmit_IT (I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size)
 Transmit an amount of data in non-blocking mode with Interrupt.
 
HAL_StatusTypeDef HAL_I2S_Receive_IT (I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size)
 Receive an amount of data in non-blocking mode with Interrupt.
 
void HAL_I2S_IRQHandler (I2S_HandleTypeDef *hi2s)
 This function handles I2S interrupt request.
 
HAL_StatusTypeDef HAL_I2S_Transmit_DMA (I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size)
 Transmit an amount of data in non-blocking mode with DMA.
 
HAL_StatusTypeDef HAL_I2S_Receive_DMA (I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size)
 Receive an amount of data in non-blocking mode with DMA.
 
HAL_StatusTypeDef HAL_I2S_DMAPause (I2S_HandleTypeDef *hi2s)
 Pauses the audio DMA Stream/Channel playing from the Media.
 
HAL_StatusTypeDef HAL_I2S_DMAResume (I2S_HandleTypeDef *hi2s)
 Resumes the audio DMA Stream/Channel playing from the Media.
 
HAL_StatusTypeDef HAL_I2S_DMAStop (I2S_HandleTypeDef *hi2s)
 Stops the audio DMA Stream/Channel playing from the Media.
 
void HAL_I2S_TxHalfCpltCallback (I2S_HandleTypeDef *hi2s)
 Tx Transfer Half completed callbacks.
 
void HAL_I2S_TxCpltCallback (I2S_HandleTypeDef *hi2s)
 Tx Transfer completed callbacks.
 
void HAL_I2S_RxHalfCpltCallback (I2S_HandleTypeDef *hi2s)
 Rx Transfer half completed callbacks.
 
void HAL_I2S_RxCpltCallback (I2S_HandleTypeDef *hi2s)
 Rx Transfer completed callbacks.
 
void HAL_I2S_ErrorCallback (I2S_HandleTypeDef *hi2s)
 I2S error callbacks.
 

Detailed Description

Data transfers functions.

 ===============================================================================
                      ##### IO operation functions #####
 ===============================================================================
    [..]
    This subsection provides a set of functions allowing to manage the I2S data
    transfers.

    (#) There are two modes of transfer:
       (++) Blocking mode : The communication is performed in the polling mode.
            The status of all data processing is returned by the same function
            after finishing transfer.
       (++) No-Blocking mode : The communication is performed using Interrupts
            or DMA. These functions return the status of the transfer startup.
            The end of the data processing will be indicated through the
            dedicated I2S IRQ when using Interrupt mode or the DMA IRQ when
            using DMA mode.

    (#) Blocking mode functions are :
        (++) HAL_I2S_Transmit()
        (++) HAL_I2S_Receive()

    (#) No-Blocking mode functions with Interrupt are :
        (++) HAL_I2S_Transmit_IT()
        (++) HAL_I2S_Receive_IT()

    (#) No-Blocking mode functions with DMA are :
        (++) HAL_I2S_Transmit_DMA()
        (++) HAL_I2S_Receive_DMA()

    (#) A set of Transfer Complete Callbacks are provided in non Blocking mode:
        (++) HAL_I2S_TxCpltCallback()
        (++) HAL_I2S_RxCpltCallback()
        (++) HAL_I2S_ErrorCallback()

Function Documentation

◆ HAL_I2S_Transmit()

HAL_StatusTypeDef HAL_I2S_Transmit ( I2S_HandleTypeDef * hi2s,
uint16_t * pData,
uint16_t Size,
uint32_t Timeout )

#include <stm32f4xx_hal_i2s.h>

Transmit an amount of data in blocking mode.

Parameters
hi2spointer to a I2S_HandleTypeDef structure that contains the configuration information for I2S module
pDataa 16-bit pointer to data buffer.
Sizenumber of data sample to be sent:
Note
When a 16-bit data frame or a 16-bit data frame extended is selected during the I2S configuration phase, the Size parameter means the number of 16-bit data length in the transaction and when a 24-bit data frame or a 32-bit data frame is selected the Size parameter means the number of 24-bit or 32-bit data length.
Parameters
TimeoutTimeout duration
Note
The I2S is kept enabled at the end of transaction to avoid the clock de-synchronization between Master and Slave(example: audio streaming).
Return values
HALstatus

Definition at line 842 of file stm32f4xx_hal_i2s.c.

References __HAL_I2S_CLEAR_UDRFLAG, __HAL_I2S_ENABLE, __HAL_I2S_GET_FLAG, __HAL_LOCK, __HAL_UNLOCK, __I2S_HandleTypeDef::ErrorCode, HAL_BUSY, HAL_ERROR, HAL_I2S_ERROR_NONE, HAL_I2S_ERROR_TIMEOUT, HAL_I2S_ERROR_UDR, HAL_I2S_STATE_BUSY_TX, HAL_I2S_STATE_READY, HAL_OK, I2S_DATAFORMAT_24B, I2S_DATAFORMAT_32B, I2S_FLAG_BSY, I2S_FLAG_TXE, I2S_FLAG_UDR, I2S_MODE_SLAVE_RX, I2S_MODE_SLAVE_TX, I2S_WaitFlagStateUntilTimeout(), __I2S_HandleTypeDef::Instance, __I2S_HandleTypeDef::pTxBuffPtr, __I2S_HandleTypeDef::State, __I2S_HandleTypeDef::TxXferCount, and __I2S_HandleTypeDef::TxXferSize.

◆ HAL_I2S_Receive()

HAL_StatusTypeDef HAL_I2S_Receive ( I2S_HandleTypeDef * hi2s,
uint16_t * pData,
uint16_t Size,
uint32_t Timeout )

#include <stm32f4xx_hal_i2s.h>

Receive an amount of data in blocking mode.

Parameters
hi2spointer to a I2S_HandleTypeDef structure that contains the configuration information for I2S module
pDataa 16-bit pointer to data buffer.
Sizenumber of data sample to be sent:
Note
When a 16-bit data frame or a 16-bit data frame extended is selected during the I2S configuration phase, the Size parameter means the number of 16-bit data length in the transaction and when a 24-bit data frame or a 32-bit data frame is selected the Size parameter means the number of 24-bit or 32-bit data length.
Parameters
TimeoutTimeout duration
Note
The I2S is kept enabled at the end of transaction to avoid the clock de-synchronization between Master and Slave(example: audio streaming).
In I2S Master Receiver mode, just after enabling the peripheral the clock will be generate in continuous way and as the I2S is not disabled at the end of the I2S transaction.
Return values
HALstatus

Definition at line 960 of file stm32f4xx_hal_i2s.c.

References __HAL_I2S_CLEAR_OVRFLAG, __HAL_I2S_ENABLE, __HAL_I2S_GET_FLAG, __HAL_LOCK, __HAL_UNLOCK, __I2S_HandleTypeDef::ErrorCode, HAL_BUSY, HAL_ERROR, HAL_I2S_ERROR_NONE, HAL_I2S_ERROR_OVR, HAL_I2S_ERROR_TIMEOUT, HAL_I2S_STATE_BUSY_RX, HAL_I2S_STATE_READY, HAL_OK, I2S_DATAFORMAT_24B, I2S_DATAFORMAT_32B, I2S_FLAG_OVR, I2S_FLAG_RXNE, I2S_MODE_MASTER_RX, I2S_WaitFlagStateUntilTimeout(), __I2S_HandleTypeDef::Instance, __I2S_HandleTypeDef::pRxBuffPtr, __I2S_HandleTypeDef::RxXferCount, __I2S_HandleTypeDef::RxXferSize, and __I2S_HandleTypeDef::State.

◆ HAL_I2S_Transmit_IT()

HAL_StatusTypeDef HAL_I2S_Transmit_IT ( I2S_HandleTypeDef * hi2s,
uint16_t * pData,
uint16_t Size )

#include <stm32f4xx_hal_i2s.h>

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

Parameters
hi2spointer to a I2S_HandleTypeDef structure that contains the configuration information for I2S module
pDataa 16-bit pointer to data buffer.
Sizenumber of data sample to be sent:
Note
When a 16-bit data frame or a 16-bit data frame extended is selected during the I2S configuration phase, the Size parameter means the number of 16-bit data length in the transaction and when a 24-bit data frame or a 32-bit data frame is selected the Size parameter means the number of 24-bit or 32-bit data length.
The I2S is kept enabled at the end of transaction to avoid the clock de-synchronization between Master and Slave(example: audio streaming).
Return values
HALstatus

Definition at line 1057 of file stm32f4xx_hal_i2s.c.

References __HAL_I2S_ENABLE, __HAL_I2S_ENABLE_IT, __HAL_LOCK, __HAL_UNLOCK, __I2S_HandleTypeDef::ErrorCode, HAL_BUSY, HAL_ERROR, HAL_I2S_ERROR_NONE, HAL_I2S_STATE_BUSY_TX, HAL_I2S_STATE_READY, HAL_OK, I2S_DATAFORMAT_24B, I2S_DATAFORMAT_32B, I2S_IT_ERR, I2S_IT_TXE, __I2S_HandleTypeDef::Instance, __I2S_HandleTypeDef::pTxBuffPtr, __I2S_HandleTypeDef::State, __I2S_HandleTypeDef::TxXferCount, and __I2S_HandleTypeDef::TxXferSize.

◆ HAL_I2S_Receive_IT()

HAL_StatusTypeDef HAL_I2S_Receive_IT ( I2S_HandleTypeDef * hi2s,
uint16_t * pData,
uint16_t Size )

#include <stm32f4xx_hal_i2s.h>

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

Parameters
hi2spointer to a I2S_HandleTypeDef structure that contains the configuration information for I2S module
pDataa 16-bit pointer to the Receive data buffer.
Sizenumber of data sample to be sent:
Note
When a 16-bit data frame or a 16-bit data frame extended is selected during the I2S configuration phase, the Size parameter means the number of 16-bit data length in the transaction and when a 24-bit data frame or a 32-bit data frame is selected the Size parameter means the number of 24-bit or 32-bit data length.
The I2S is kept enabled at the end of transaction to avoid the clock de-synchronization between Master and Slave(example: audio streaming).
It is recommended to use DMA for the I2S receiver to avoid de-synchronization between Master and Slave otherwise the I2S interrupt should be optimized.
Return values
HALstatus

Definition at line 1123 of file stm32f4xx_hal_i2s.c.

References __HAL_I2S_ENABLE, __HAL_I2S_ENABLE_IT, __HAL_LOCK, __HAL_UNLOCK, __I2S_HandleTypeDef::ErrorCode, HAL_BUSY, HAL_ERROR, HAL_I2S_ERROR_NONE, HAL_I2S_STATE_BUSY_RX, HAL_I2S_STATE_READY, HAL_OK, I2S_DATAFORMAT_24B, I2S_DATAFORMAT_32B, I2S_IT_ERR, I2S_IT_RXNE, __I2S_HandleTypeDef::Instance, __I2S_HandleTypeDef::pRxBuffPtr, __I2S_HandleTypeDef::RxXferCount, __I2S_HandleTypeDef::RxXferSize, and __I2S_HandleTypeDef::State.

◆ HAL_I2S_IRQHandler()

void HAL_I2S_IRQHandler ( I2S_HandleTypeDef * hi2s)

#include <stm32f4xx_hal_i2s.h>

This function handles I2S interrupt request.

Parameters
hi2spointer to a I2S_HandleTypeDef structure that contains the configuration information for I2S module
Return values
None

Definition at line 1659 of file stm32f4xx_hal_i2s.c.

References __I2S_HandleTypeDef::IrqHandlerISR.

◆ HAL_I2S_Transmit_DMA()

HAL_StatusTypeDef HAL_I2S_Transmit_DMA ( I2S_HandleTypeDef * hi2s,
uint16_t * pData,
uint16_t Size )

#include <stm32f4xx_hal_i2s.h>

Transmit an amount of data in non-blocking mode with DMA.

Parameters
hi2spointer to a I2S_HandleTypeDef structure that contains the configuration information for I2S module
pDataa 16-bit pointer to the Transmit data buffer.
Sizenumber of data sample to be sent:
Note
When a 16-bit data frame or a 16-bit data frame extended is selected during the I2S configuration phase, the Size parameter means the number of 16-bit data length in the transaction and when a 24-bit data frame or a 32-bit data frame is selected the Size parameter means the number of 24-bit or 32-bit data length.
The I2S is kept enabled at the end of transaction to avoid the clock de-synchronization between Master and Slave(example: audio streaming).
Return values
HALstatus

Definition at line 1187 of file stm32f4xx_hal_i2s.c.

References __HAL_I2S_ENABLE, __HAL_LOCK, __HAL_UNLOCK, __I2S_HandleTypeDef::ErrorCode, HAL_BUSY, HAL_DMA_Start_IT(), HAL_ERROR, HAL_I2S_ERROR_DMA, HAL_I2S_ERROR_NONE, HAL_I2S_STATE_BUSY_TX, HAL_I2S_STATE_READY, HAL_IS_BIT_CLR, HAL_OK, __I2S_HandleTypeDef::hdmatx, I2S_DATAFORMAT_24B, I2S_DATAFORMAT_32B, I2S_DMAError(), I2S_DMATxCplt(), I2S_DMATxHalfCplt(), __I2S_HandleTypeDef::Instance, __I2S_HandleTypeDef::pTxBuffPtr, __I2S_HandleTypeDef::State, __I2S_HandleTypeDef::TxXferCount, __I2S_HandleTypeDef::TxXferSize, __DMA_HandleTypeDef::XferCpltCallback, __DMA_HandleTypeDef::XferErrorCallback, and __DMA_HandleTypeDef::XferHalfCpltCallback.

◆ HAL_I2S_Receive_DMA()

HAL_StatusTypeDef HAL_I2S_Receive_DMA ( I2S_HandleTypeDef * hi2s,
uint16_t * pData,
uint16_t Size )

#include <stm32f4xx_hal_i2s.h>

Receive an amount of data in non-blocking mode with DMA.

Parameters
hi2spointer to a I2S_HandleTypeDef structure that contains the configuration information for I2S module
pDataa 16-bit pointer to the Receive data buffer.
Sizenumber of data sample to be sent:
Note
When a 16-bit data frame or a 16-bit data frame extended is selected during the I2S configuration phase, the Size parameter means the number of 16-bit data length in the transaction and when a 24-bit data frame or a 32-bit data frame is selected the Size parameter means the number of 24-bit or 32-bit data length.
The I2S is kept enabled at the end of transaction to avoid the clock de-synchronization between Master and Slave(example: audio streaming).
Return values
HALstatus

Definition at line 1278 of file stm32f4xx_hal_i2s.c.

References __HAL_I2S_CLEAR_OVRFLAG, __HAL_I2S_ENABLE, __HAL_LOCK, __HAL_UNLOCK, __I2S_HandleTypeDef::ErrorCode, HAL_BUSY, HAL_DMA_Start_IT(), HAL_ERROR, HAL_I2S_ERROR_DMA, HAL_I2S_ERROR_NONE, HAL_I2S_STATE_BUSY_RX, HAL_I2S_STATE_READY, HAL_IS_BIT_CLR, HAL_OK, __I2S_HandleTypeDef::hdmarx, I2S_DATAFORMAT_24B, I2S_DATAFORMAT_32B, I2S_DMAError(), I2S_DMARxCplt(), I2S_DMARxHalfCplt(), I2S_MODE_MASTER_RX, __I2S_HandleTypeDef::Instance, __I2S_HandleTypeDef::pRxBuffPtr, __I2S_HandleTypeDef::RxXferCount, __I2S_HandleTypeDef::RxXferSize, __I2S_HandleTypeDef::State, __DMA_HandleTypeDef::XferCpltCallback, __DMA_HandleTypeDef::XferErrorCallback, and __DMA_HandleTypeDef::XferHalfCpltCallback.

◆ HAL_I2S_DMAPause()

HAL_StatusTypeDef HAL_I2S_DMAPause ( I2S_HandleTypeDef * hi2s)

#include <stm32f4xx_hal_i2s.h>

Pauses the audio DMA Stream/Channel playing from the Media.

Parameters
hi2spointer to a I2S_HandleTypeDef structure that contains the configuration information for I2S module
Return values
HALstatus

Definition at line 1367 of file stm32f4xx_hal_i2s.c.

References __HAL_LOCK, __HAL_UNLOCK, HAL_I2S_STATE_BUSY_RX, HAL_I2S_STATE_BUSY_TX, HAL_I2S_STATE_BUSY_TX_RX, HAL_OK, __I2S_HandleTypeDef::Instance, and __I2S_HandleTypeDef::State.

◆ HAL_I2S_DMAResume()

HAL_StatusTypeDef HAL_I2S_DMAResume ( I2S_HandleTypeDef * hi2s)

#include <stm32f4xx_hal_i2s.h>

Resumes the audio DMA Stream/Channel playing from the Media.

Parameters
hi2spointer to a I2S_HandleTypeDef structure that contains the configuration information for I2S module
Return values
HALstatus

Definition at line 1407 of file stm32f4xx_hal_i2s.c.

References __HAL_I2S_ENABLE, __HAL_LOCK, __HAL_UNLOCK, HAL_I2S_STATE_BUSY_RX, HAL_I2S_STATE_BUSY_TX, HAL_I2S_STATE_BUSY_TX_RX, HAL_IS_BIT_CLR, HAL_OK, __I2S_HandleTypeDef::Instance, and __I2S_HandleTypeDef::State.

◆ HAL_I2S_DMAStop()

◆ HAL_I2S_TxHalfCpltCallback()

__weak void HAL_I2S_TxHalfCpltCallback ( I2S_HandleTypeDef * hi2s)

#include <stm32f4xx_hal_i2s.h>

Tx Transfer Half completed callbacks.

Parameters
hi2spointer to a I2S_HandleTypeDef structure that contains the configuration information for I2S module
Return values
None

Definition at line 1671 of file stm32f4xx_hal_i2s.c.

References UNUSED.

Referenced by HAL_I2S_Init(), and I2S_DMATxHalfCplt().

◆ HAL_I2S_TxCpltCallback()

__weak void HAL_I2S_TxCpltCallback ( I2S_HandleTypeDef * hi2s)

#include <stm32f4xx_hal_i2s.h>

Tx Transfer completed callbacks.

Parameters
hi2spointer to a I2S_HandleTypeDef structure that contains the configuration information for I2S module
Return values
None

Definition at line 1687 of file stm32f4xx_hal_i2s.c.

References UNUSED.

Referenced by HAL_I2S_Init(), I2S_DMATxCplt(), and I2S_Transmit_IT().

◆ HAL_I2S_RxHalfCpltCallback()

__weak void HAL_I2S_RxHalfCpltCallback ( I2S_HandleTypeDef * hi2s)

#include <stm32f4xx_hal_i2s.h>

Rx Transfer half completed callbacks.

Parameters
hi2spointer to a I2S_HandleTypeDef structure that contains the configuration information for I2S module
Return values
None

Definition at line 1703 of file stm32f4xx_hal_i2s.c.

References UNUSED.

Referenced by HAL_I2S_Init(), and I2S_DMARxHalfCplt().

◆ HAL_I2S_RxCpltCallback()

__weak void HAL_I2S_RxCpltCallback ( I2S_HandleTypeDef * hi2s)

#include <stm32f4xx_hal_i2s.h>

Rx Transfer completed callbacks.

Parameters
hi2spointer to a I2S_HandleTypeDef structure that contains the configuration information for I2S module
Return values
None

Definition at line 1719 of file stm32f4xx_hal_i2s.c.

References UNUSED.

Referenced by HAL_I2S_Init(), I2S_DMARxCplt(), and I2S_Receive_IT().

◆ HAL_I2S_ErrorCallback()

__weak void HAL_I2S_ErrorCallback ( I2S_HandleTypeDef * hi2s)

#include <stm32f4xx_hal_i2s.h>

I2S error callbacks.

Parameters
hi2spointer to a I2S_HandleTypeDef structure that contains the configuration information for I2S module
Return values
None

Definition at line 1735 of file stm32f4xx_hal_i2s.c.

References UNUSED.

Referenced by HAL_I2S_Init(), I2S_DMAError(), and I2S_IRQHandler().