stm32f411-i2s
All Classes Files Functions Variables Enumerations Pages
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
stm32_i2s::Stm32I2sClass Class Reference

I2S API for STM32. More...

#include <stm32-i2s.h>

Public Member Functions

bool begin (I2SSettingsSTM32 settings, bool transmit, bool receive)
 start I2S w/o DMA: use write and readBytes
 
bool beginWriteDMA (I2SSettingsSTM32 settings, void(*readToTransmit)(uint8_t *buffer, uint16_t byteCount, void *ref)=nullptr)
 Start to transmit I2S data.
 
bool beginReadDMA (I2SSettingsSTM32 settings, void(*writeFromReceive)(uint8_t *buffer, uint16_t byteCount, void *ref)=nullptr)
 Start to receive I2S data.
 
bool beginReadWriteDMA (I2SSettingsSTM32 settings, void(*readToTransmit)(uint8_t *buffer, uint16_t byteCount, void *)=nullptr, void(*writeFromReceive)(uint8_t *buffer, uint16_t byteCount, void *)=nullptr)
 Start to receive and transmit I2S data.
 
void end ()
 
size_t write (const uint8_t *data, size_t bytes)
 Write method which needs to be called when ansync mode is disabled. More...
 
size_t readBytes (uint8_t *data, size_t bytes)
 Read method which needs to be called when ansync mode is disabled. More...
 

Protected Member Functions

int getBytes ()
 
void cb_TxRxComplete (I2S_HandleTypeDef *hi2s)
 Callback for double buffer. More...
 
void cb_TxRxHalfComplete (I2S_HandleTypeDef *hi2s)
 Callback for double buffer. More...
 
void cb_dmaIrqRx ()
 Callback for DMA interrupt request.
 
void cb_dmaIrqTx ()
 Callback for DMA interrupt request.
 
void cb_HAL_I2S_MspInit (I2S_HandleTypeDef *hi2s)
 Callback I2S intitialization.
 
void cb_HAL_I2S_MspDeInit (I2S_HandleTypeDef *hi2s)
 Callback I2S de-intitialization.
 
bool i2s_begin ()
 Starts the i2s processing.
 
virtual void MX_GPIO_Init (void)
 GPIO Initialization Function for I2S pins. More...
 
virtual void MX_DMA_Init (void)
 
virtual void MX_I2S3_Init (void)
 I2S3 Initialization Function. More...
 
virtual void cb_i2s_MspInit (I2S_HandleTypeDef *hi2s)
 I2S MSP Initialization This function configures the hardware resources used in this example. More...
 
void setupDMA (DMA_HandleTypeDef &dma, DMA_Stream_TypeDef *instance, uint32_t channel, uint32_t direction)
 DMA Initialization This function configures and initializes the DMA.
 
virtual void cb_i2s_MspDeInit (I2S_HandleTypeDef *hi2s)
 I2S MSP De-Initialization This function freeze the hardware resources used in this example. More...
 

Protected Attributes

I2SSettingsSTM32 settings
 
I2S_HandleTypeDef hi2s3
 
byte * dma_buffer_tx = nullptr
 
byte * dma_buffer_rx = nullptr
 
void(* readToTransmitCB )(uint8_t *buffer, uint16_t byteCount, void *ref)
 
void(* writeFromReceiveCB )(uint8_t *buffer, uint16_t byteCount, void *ref)
 
DMA_HandleTypeDef hdma_i2s3_ext_rx
 
DMA_HandleTypeDef hdma_i2s3_ext_tx
 
HardwareConfig hw
 
bool use_dma = false
 

Friends

void DMA1_Stream0_IRQHandler (void)
 
void DMA1_Stream5_IRQHandler (void)
 
void HAL_I2S_MspInit (I2S_HandleTypeDef *hi2s)
 
void HAL_I2S_MspDeInit (I2S_HandleTypeDef *hi2s)
 
void HAL_I2S_TxCpltCallback (I2S_HandleTypeDef *hi2s)
 
void HAL_I2S_TxHalfCpltCallback (I2S_HandleTypeDef *hi2s)
 
void HAL_I2S_RxCpltCallback (I2S_HandleTypeDef *hi2s)
 
void HAL_I2S_RxHalfCpltCallback (I2S_HandleTypeDef *hi2s)
 

Detailed Description

I2S API for STM32.

Author
Phil Schatzmann

Member Function Documentation

◆ cb_i2s_MspDeInit()

virtual void stm32_i2s::Stm32I2sClass::cb_i2s_MspDeInit ( I2S_HandleTypeDef *  hi2s)
inlineprotectedvirtual

I2S MSP De-Initialization This function freeze the hardware resources used in this example.

Parameters
hi2sI2S handle pointer
Return values
None

◆ cb_i2s_MspInit()

virtual void stm32_i2s::Stm32I2sClass::cb_i2s_MspInit ( I2S_HandleTypeDef *  hi2s)
inlineprotectedvirtual

I2S MSP Initialization This function configures the hardware resources used in this example.

Parameters
hi2sI2S handle pointer
Return values
None

Initializes the peripherals clock

◆ cb_TxRxComplete()

void stm32_i2s::Stm32I2sClass::cb_TxRxComplete ( I2S_HandleTypeDef *  hi2s)
inlineprotected

Callback for double buffer.

Parameters
hi2s

◆ cb_TxRxHalfComplete()

void stm32_i2s::Stm32I2sClass::cb_TxRxHalfComplete ( I2S_HandleTypeDef *  hi2s)
inlineprotected

Callback for double buffer.

Parameters
hi2s

◆ MX_DMA_Init()

virtual void stm32_i2s::Stm32I2sClass::MX_DMA_Init ( void  )
inlineprotectedvirtual

Enable DMA controller clock

◆ MX_GPIO_Init()

virtual void stm32_i2s::Stm32I2sClass::MX_GPIO_Init ( void  )
inlineprotectedvirtual

GPIO Initialization Function for I2S pins.

Parameters
None
Return values
None

◆ MX_I2S3_Init()

virtual void stm32_i2s::Stm32I2sClass::MX_I2S3_Init ( void  )
inlineprotectedvirtual

I2S3 Initialization Function.

Parameters
None
Return values
None

◆ readBytes()

size_t stm32_i2s::Stm32I2sClass::readBytes ( uint8_t *  data,
size_t  bytes 
)
inline

Read method which needs to be called when ansync mode is disabled.

Parameters
data
bytes
Returns

◆ write()

size_t stm32_i2s::Stm32I2sClass::write ( const uint8_t *  data,
size_t  bytes 
)
inline

Write method which needs to be called when ansync mode is disabled.

Parameters
data
bytes
Returns

The documentation for this class was generated from the following file: