1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-30 16:24:09 +03:00

I2S optimizations

zero buffers so they are mute in case of underflow
add non-blocking write (returns false if DMA was full)
add checks for full and empty DMA
add some comments to the header
This commit is contained in:
Me No Dev
2015-10-29 10:51:51 +02:00
parent 45a1860447
commit bd5b5d35f0
2 changed files with 31 additions and 6 deletions

View File

@ -42,9 +42,12 @@ extern "C" {
void i2s_begin();
void i2s_end();
void i2s_set_rate(uint32_t rate);
bool i2s_write_sample(uint32_t sample);
bool i2s_write_lr(int16_t left, int16_t right);
void i2s_set_rate(uint32_t rate);//Sample Rate in Hz (ex 44100, 48000)
bool i2s_write_sample(uint32_t sample);//32bit sample with channels being upper and lower 16 bits (blocking when DMA is full)
bool i2s_write_sample_nb(uint32_t sample);//same as above but does not block when DMA is full and returns false instead
bool i2s_write_lr(int16_t left, int16_t right);//combines both channels and calls i2s_write_sample with the result
bool i2s_is_full();//returns true if DMA is full and can not take more bytes (overflow)
bool i2s_is_empty();//returns true if DMA is empty (underflow)
#ifdef __cplusplus
}