arduino-audio-tools
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
I2SDriverSTM32 Class Reference

Basic I2S API - for the STM32 Depends on https://github.com/pschatzmann/stm32f411-i2s We provide a direct and a DMA implementation. When using DMA, we just add a write and read buffer and pass some parameters to the STM32 API! Alternatively we can define the input stream or the output. More...

#include <I2SSTM32.h>

Public Member Functions

int available ()
 we assume the data is already available in the buffer
 
int availableForWrite ()
 We limit the write size to the buffer size.
 
bool begin (I2SConfigStd cfg)
 starts the DAC
 
bool begin (RxTxMode mode=TX_MODE)
 starts the DAC with the default config in TX Mode
 
I2SConfigStd config ()
 provides the actual configuration
 
I2SConfigStd defaultConfig (RxTxMode mode=TX_MODE)
 Provides the default configuration.
 
void end ()
 stops the I2C and unistalls the driver
 
bool isWriteTimedOut ()
 Checks if timout has been activated and if so, if it is timed out.
 
size_t readBytes (void *dest, size_t size_bytes)
 
bool setAudioInfo (AudioInfo)
 Potentially updates the sample rate (if supported)
 
void setDMAActive (bool flag)
 activate DMA using a read and write buffer
 
void setDMAInputStream (Stream &in)
 activate DMA and defines the input
 
void setDMAOutput (Print &out)
 activate DMA and defines the output
 
size_t writeBytes (const void *src, size_t size_bytes)
 blocking writes for the data to the I2S interface
 

Static Public Member Functions

static void readToTransmit (uint8_t *buffer, uint16_t byteCount, void *ref)
 Callback function used by https://github.com/pschatzmann/stm32f411-i2s.
 
static void writeFromReceive (uint8_t *buffer, uint16_t byteCount, void *ref)
 Callback function used by https://github.com/pschatzmann/stm32f411-i2s.
 

Protected Member Functions

void deleteBuffers ()
 
uint32_t getMode (I2SConfigStd &cfg)
 
uint32_t getSampleRate (I2SConfigStd &cfg)
 
uint32_t getStandard (I2SConfigStd &cfg)
 
size_t readBytesDMA (void *dest, size_t size_bytes)
 
void setupDefaultI2SParameters ()
 
bool startI2S ()
 
bool startI2SDMA ()
 
uint32_t toDataFormat (int bits_per_sample)
 
size_t writeBytesDMA (const void *src, size_t size_bytes)
 
size_t writeBytesExt (const void *src, size_t size_bytes)
 

Protected Attributes

bool active = false
 
I2SConfigStd cfg
 
stm32_i2s::I2SSettingsSTM32 i2s_stm32
 
uint32_t last_write_ms = 0
 
Streamp_dma_in = nullptr
 
Printp_dma_out = nullptr
 
BaseBuffer< uint8_t > * p_rx_buffer = nullptr
 
BaseBuffer< uint8_t > * p_tx_buffer = nullptr
 
bool result = true
 
bool stm32_write_active = false
 
bool use_dma = true
 

Friends

class I2SStream
 

Detailed Description

Basic I2S API - for the STM32 Depends on https://github.com/pschatzmann/stm32f411-i2s We provide a direct and a DMA implementation. When using DMA, we just add a write and read buffer and pass some parameters to the STM32 API! Alternatively we can define the input stream or the output.

Author
Phil Schatzmann

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