1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-19 23:22:16 +03:00

added int16_t i2s_available(); it returns the number of samples than can be (#3988)

written before blocking
This commit is contained in:
aguaviva 2017-12-18 01:34:38 +01:00 committed by Develo
parent 26980b39e3
commit 08cdf153d4
2 changed files with 5 additions and 0 deletions

View File

@ -65,6 +65,10 @@ bool ICACHE_FLASH_ATTR i2s_is_empty(){
return (i2s_slc_queue_len >= SLC_BUF_CNT-1); return (i2s_slc_queue_len >= SLC_BUF_CNT-1);
} }
int16_t ICACHE_FLASH_ATTR i2s_available(){
return (SLC_BUF_CNT - i2s_slc_queue_len) * SLC_BUF_LEN;
}
uint32_t ICACHE_FLASH_ATTR i2s_slc_queue_next_item(){ //pop the top off the queue uint32_t ICACHE_FLASH_ATTR i2s_slc_queue_next_item(){ //pop the top off the queue
uint8_t i; uint8_t i;
uint32_t item = i2s_slc_queue[0]; uint32_t item = i2s_slc_queue[0];

View File

@ -48,6 +48,7 @@ bool i2s_write_sample_nb(uint32_t sample);//same as above but does not block whe
bool i2s_write_lr(int16_t left, int16_t right);//combines both channels and calls i2s_write_sample with the result 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_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) bool i2s_is_empty();//returns true if DMA is empty (underflow)
int16_t i2s_available();// returns the number of samples than can be written before blocking
#ifdef __cplusplus #ifdef __cplusplus
} }