arduino-audio-tools
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
I2SDriverZephyr Class Referenceabstract

Basic I2S API for Zephyr based targets. More...

#include <I2SDriverZephyr.h>

Inheritance diagram for I2SDriverZephyr:
I2SDriverBase

Public Member Functions

int available ()
 
int availableForWrite ()
 
virtual bool begin (I2SConfig cfg)=0
 
bool begin (I2SConfigZephyr cfg)
 starts the DAC with the current config
 
bool begin (RxTxMode mode=TX_MODE)
 starts the DAC with the default config
 
I2SConfigZephyr config ()
 provides the actual configuration
 
I2SConfigZephyr defaultConfig (RxTxMode mode)
 Provides the default configuration.
 
void end ()
 stops the I2S interface
 
virtual void flush ()
 
size_t readBytes (void *dest, size_t size_bytes)
 
bool setAudioInfo (AudioInfo info)
 Potentially updates the sample rate (if supported)
 
size_t writeBytes (const void *src, size_t size_bytes)
 writes the data to the I2S interface
 

Protected Member Functions

i2s_config buildI2SConfig (const I2SConfigZephyr &cfg, k_mem_slab *mem_slab)
 
void enableMclkRuntime (void)
 
bool initSlabs (const I2SConfigZephyr &cfg)
 
bool resolveDevice ()
 
bool startConfiguredStreams ()
 

Protected Attributes

I2SConfigZephyr cfg = defaultConfig(RXTX_MODE)
 
const device * i2s_dev = nullptr
 
bool is_started = false
 
i2s_config rx_cfg {}
 
k_mem_slab rx_slab
 
Vector< uint8_t > rx_slab_buffer {0}
 
bool slabs_initialized = false
 
i2s_config tx_cfg {}
 
k_mem_slab tx_slab
 
Vector< uint8_t > tx_slab_buffer {0}
 

Friends

class I2SStream
 

Detailed Description

Basic I2S API for Zephyr based targets.

Author
Phil Schatzmann

Member Function Documentation

◆ available()

int available ( )
inlinevirtual

Implements I2SDriverBase.

◆ availableForWrite()

int availableForWrite ( )
inlinevirtual

Implements I2SDriverBase.

◆ begin() [1/3]

virtual bool begin ( I2SConfig  cfg)
pure virtualinherited

Implemented in I2SDriverESP32.

◆ begin() [2/3]

bool begin ( I2SConfigZephyr  cfg)
inline

starts the DAC with the current config

◆ begin() [3/3]

bool begin ( RxTxMode  mode = TX_MODE)
inline

starts the DAC with the default config

◆ buildI2SConfig()

i2s_config buildI2SConfig ( const I2SConfigZephyr cfg,
k_mem_slab *  mem_slab 
)
inlineprotected

◆ config()

I2SConfigZephyr config ( )
inlinevirtual

provides the actual configuration

Implements I2SDriverBase.

◆ defaultConfig()

I2SConfigZephyr defaultConfig ( RxTxMode  mode)
inlinevirtual

Provides the default configuration.

Implements I2SDriverBase.

◆ enableMclkRuntime()

void enableMclkRuntime ( void  )
inlineprotected

ESP32 specific function to enable MCLK output at runtime, since Zephyr's I2S driver doesn't do this automatically.

◆ end()

void end ( )
inlinevirtual

stops the I2S interface

Implements I2SDriverBase.

◆ flush()

virtual void flush ( )
inlinevirtualinherited

Discards any audio already queued in the driver's own output buffer (e.g. the I2S DMA buffer) but not yet physically played - useful when switching to unrelated audio content (e.g. AudioPlayer moving to the next track) to stop stale samples from continuing to play out during the switch. Default no-op, since not every backend can support this; override where the underlying driver allows it.

Reimplemented in I2SDriverESP32, and I2SDriverESP32V1.

◆ initSlabs()

bool initSlabs ( const I2SConfigZephyr cfg)
inlineprotected

◆ readBytes()

size_t readBytes ( void *  dest,
size_t  size_bytes 
)
inlinevirtual

Implements I2SDriverBase.

◆ resolveDevice()

bool resolveDevice ( )
inlineprotected

◆ setAudioInfo()

bool setAudioInfo ( AudioInfo  info)
inlinevirtual

Potentially updates the sample rate (if supported)

Implements I2SDriverBase.

◆ startConfiguredStreams()

bool startConfiguredStreams ( )
inlineprotected

◆ writeBytes()

size_t writeBytes ( const void *  src,
size_t  size_bytes 
)
inlinevirtual

writes the data to the I2S interface

Implements I2SDriverBase.

Friends And Related Symbol Documentation

◆ I2SStream

friend class I2SStream
friend

Member Data Documentation

◆ cfg

◆ i2s_dev

const device* i2s_dev = nullptr
protected

◆ is_started

bool is_started = false
protected

◆ rx_cfg

i2s_config rx_cfg {}
protected

◆ rx_slab

k_mem_slab rx_slab
protected

◆ rx_slab_buffer

Vector<uint8_t> rx_slab_buffer {0}
protected

◆ slabs_initialized

bool slabs_initialized = false
protected

◆ tx_cfg

i2s_config tx_cfg {}
protected

◆ tx_slab

k_mem_slab tx_slab
protected

◆ tx_slab_buffer

Vector<uint8_t> tx_slab_buffer {0}
protected

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