rp2040-i2s
All Classes Files Functions Variables Typedefs Modules Pages
Public Member Functions | List of all members
I2SClass Class Reference

I2S for RP2040 Processors using the PIO: Only 16 bitsPerSample are allowed by the PIO code. Only write, no read. The default pins are: BCLK: GPIO26, LRCLK:GPIO27, DOUT: GPIO28. The LRCLK can not be defined separately and is BCLK+1! More...

#include <I2S.h>

Inheritance diagram for I2SClass:

Public Member Functions

bool setBCLK (pin_size_t pin)
 Defines the BCLK pin.
 
bool setDATA (pin_size_t pin)
 Defines the Data pin.
 
bool begin (long sampleRate)
 Starts the processing by defining the sample rate.
 
void end ()
 
virtual int available () override
 Not supported.
 
virtual int read () override
 Not supported.
 
virtual int peek () override
 Not supported.
 
virtual void flush () override
 
virtual size_t write (uint8_t) override
 
virtual size_t write (const uint8_t *buffer, size_t size) override
 
virtual int availableForWrite () override
 
bool setFrequency (int newFreq)
 Change the sample rate.
 
size_t write (int16_t)
 Write a single L:R sample to the I2S device. Blocking until write succeeds.
 
size_t write (const void *buffer, size_t lrsamples)
 Write up to size samples to the I2S device. Non-blocking, will write from 0...size samples and return that count. Be sure your app handles partial writes (i.e. by yield()ing and then retrying to write the remaining data. More...
 

Detailed Description

I2S for RP2040 Processors using the PIO: Only 16 bitsPerSample are allowed by the PIO code. Only write, no read. The default pins are: BCLK: GPIO26, LRCLK:GPIO27, DOUT: GPIO28. The LRCLK can not be defined separately and is BCLK+1!

Member Function Documentation

◆ write()

size_t I2SClass::write ( const void *  buffer,
size_t  lrsamples 
)

Write up to size samples to the I2S device. Non-blocking, will write from 0...size samples and return that count. Be sure your app handles partial writes (i.e. by yield()ing and then retrying to write the remaining data.

Parameters
buffer
lrsamples
Returns
size_t

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