1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-13 13:01:55 +03:00

Update I2S base frequency and frequency dividers to real ones (#4031)

* Fix I2S base frequency
* Update frequency dividers for I2S
Reference: https://github.com/espressif/ESP8266_MP3_DECODER/blob/master/mp3/driver/i2s_freertos.c
* fixed i2s_set_rate, added i2s_get_real_rate() and i2s_set_dividers
* Minimise float calculations
This commit is contained in:
Kristijan Gjoshev
2018-01-21 00:58:42 +01:00
committed by Earle F. Philhower, III
parent 38fe6fc488
commit 0fe725909e
3 changed files with 35 additions and 5 deletions

View File

@ -43,6 +43,8 @@ extern "C" {
void i2s_begin();
void i2s_end();
void i2s_set_rate(uint32_t rate);//Sample Rate in Hz (ex 44100, 48000)
void i2s_set_dividers(uint8_t div1, uint8_t div2);//Direct control over output rate
float i2s_get_real_rate();//The actual Sample Rate on output
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
@ -54,4 +56,4 @@ int16_t i2s_available();// returns the number of samples than can be written bef
}
#endif
#endif
#endif