Подобрал и установил нужные библиотеки, компиляция вроде запустилась, но выдала кучу ошибок в одной функции:
void i2s_parallel_setup(i2s_dev_t *dev, const i2s_parallel_config_t *cfg) {
printf("Setting up parallel I2S bus at I2S%d\n", i2snum(dev));
int sig_data_base, sig_clk;
if (dev == &I2S0) {
sig_data_base = I2S0O_DATA_OUT0_IDX;
sig_clk = I2S0O_WS_OUT_IDX;
}
else { //errors begin
if (cfg->bits == I2S_PARALLEL_BITS_32 ) {
sig_data_base = I2S1O_DATA_OUT0_IDX;
}
else
if (cfg->bits == I2S_PARALLEL_BITS_8 ) {
sig_data_base = I2S1O_DATA_OUT0_IDX;
}
else {
sig_data_base = I2S1O_DATA_OUT8_IDX;
}
sig_clk = I2S1O_WS_OUT_IDX;
}
gpio_setup_out(cfg->gpio_bus[0], sig_data_base+0, false); // D0
gpio_setup_out(cfg->gpio_bus[1], sig_data_base+1, false); // D1
gpio_setup_out(cfg->gpio_bus[2], sig_data_base+2, false); // D2
gpio_setup_out(cfg->gpio_bus[3], sig_data_base+3, false); // D3
gpio_setup_out(cfg->gpio_bus[4], sig_data_base+4, false); // HS
gpio_setup_out(cfg->gpio_bus[5], sig_data_base+5, false); // VS
gpio_setup_out(cfg->gpio_bus[6], sig_data_base+6, false); // FR
gpio_setup_out(cfg->gpio_clk, sig_clk, false);
if (dev == &I2S0) {
periph_module_enable(PERIPH_I2S0_MODULE);
}
else {
periph_module_enable(PERIPH_I2S1_MODULE);
}
dev->conf.rx_reset = 1;
dev->conf.rx_reset = 0;
dev->conf.tx_reset = 1;
dev->conf.tx_reset = 0;
dma_reset(dev);
fifo_reset(dev);
dev->conf2.val = 0;
dev->conf2.lcd_en = 1;
dev->conf2.lcd_tx_wrx2_en = 1;
dev->conf2.lcd_tx_sdx2_en = 0;
dev->sample_rate_conf.val = 0;
dev->sample_rate_conf.rx_bits_mod = cfg->bits;
dev->sample_rate_conf.tx_bits_mod = cfg->bits;
dev->sample_rate_conf.rx_bck_div_num = 4;
dev->sample_rate_conf.tx_bck_div_num = 4;
dev->clkm_conf.val = 0;
dev->clkm_conf.clka_en = 0;
dev->clkm_conf.clkm_div_a = 63;
dev->clkm_conf.clkm_div_b = 63;
dev->clkm_conf.clkm_div_num = 80000000L/cfg->clkspeed_hz;
dev->fifo_conf.val = 0;
dev->fifo_conf.rx_fifo_mod_force_en = 1;
dev->fifo_conf.tx_fifo_mod_force_en = 1;
dev->fifo_conf.tx_fifo_mod = 1;
dev->fifo_conf.tx_fifo_mod = 1;
dev->fifo_conf.rx_data_num = 32;
dev->fifo_conf.tx_data_num = 32;
dev->fifo_conf.dscr_en = 1;
dev->conf1.val = 0;
dev->conf1.tx_stop_en = 0;
dev->conf1.tx_pcm_bypass = 1;
dev->conf_chan.val = 0;
dev->conf_chan.tx_chan_mod = 1; // HN
dev->conf_chan.rx_chan_mod = 1;
dev->conf.tx_right_first = 1;
dev->conf.rx_right_first = 1;
dev->timing.val = 0;
i2s_state[i2snum(dev)] = malloc(sizeof(i2s_parallel_state_t));
i2s_parallel_state_t *st = i2s_state[i2snum(dev)];
st->desccount_a = calc_needed_dma_descs_for(cfg->bufa);
printf("st->descccount_a = %d\r\n", st->desccount_a);
st->desccount_b = calc_needed_dma_descs_for(cfg->bufb);
printf("st->descccount_b = %d\r\n", st->desccount_b);
st->dmadesc_a = heap_caps_malloc(st->desccount_a*sizeof(lldesc_t), MALLOC_CAP_DMA);
st->dmadesc_b = heap_caps_malloc(st->desccount_b*sizeof(lldesc_t), MALLOC_CAP_DMA);
fill_dma_desc(st->dmadesc_a, cfg->bufa);
fill_dma_desc(st->dmadesc_b, cfg->bufb);
//errors fin
dev->lc_conf.in_rst = 1;
dev->lc_conf.out_rst = 1;
dev->lc_conf.ahbm_rst = 1;
dev->lc_conf.ahbm_fifo_rst = 1;
dev->lc_conf.in_rst = 0;
dev->lc_conf.out_rst = 0;
dev->lc_conf.ahbm_rst = 0;
dev->lc_conf.ahbm_fifo_rst = 0;
dev->conf.tx_reset = 1;
dev->conf.tx_fifo_reset = 1;
dev->conf.rx_fifo_reset = 1;
dev->conf.tx_reset = 0;
dev->conf.tx_fifo_reset = 0;
dev->conf.rx_fifo_reset = 0;
dev->lc_conf.val = I2S_OUT_DATA_BURST_EN | I2S_OUTDSCR_BURST_EN | I2S_OUT_DATA_BURST_EN;
dev->out_link.addr = ((uint32_t)(&st->dmadesc_a[0]));
dev->out_link.start = 1;
dev->conf.tx_start = 1;
}
Такой отчет выдаёт Arduino.ide:
/home/naz/Arduino/I2S_ESP32/I2S_ESP32.ino: In function 'void i2s_parallel_setup(i2s_dev_t*, const i2s_parallel_config_t*)':
/home/naz/Arduino/I2S_ESP32/I2S_ESP32.ino:288:18: error: 'const struct i2s_parallel_config_t' has no member named 'bits'
if (cfg->bits == I2S_PARALLEL_BITS_32 ) {
^~~~
/home/naz/Arduino/I2S_ESP32/I2S_ESP32.ino:288:26: error: 'I2S_PARALLEL_BITS_32' was not declared in this scope
if (cfg->bits == I2S_PARALLEL_BITS_32 ) {
^~~~~~~~~~~~~~~~~~~~
/home/naz/Arduino/I2S_ESP32/I2S_ESP32.ino:288:26: note: suggested alternative: 'I2S_PARALLEL_WIDTH_24'
if (cfg->bits == I2S_PARALLEL_BITS_32 ) {
^~~~~~~~~~~~~~~~~~~~
I2S_PARALLEL_WIDTH_24
/home/naz/Arduino/I2S_ESP32/I2S_ESP32.ino:292:18: error: 'const struct i2s_parallel_config_t' has no member named 'bits'
if (cfg->bits == I2S_PARALLEL_BITS_8 ) {
^~~~
/home/naz/Arduino/I2S_ESP32/I2S_ESP32.ino:292:26: error: 'I2S_PARALLEL_BITS_8' was not declared in this scope
if (cfg->bits == I2S_PARALLEL_BITS_8 ) {
^~~~~~~~~~~~~~~~~~~
/home/naz/Arduino/I2S_ESP32/I2S_ESP32.ino:292:26: note: suggested alternative: 'I2S_PARALLEL_WIDTH_8'
if (cfg->bits == I2S_PARALLEL_BITS_8 ) {
^~~~~~~~~~~~~~~~~~~
I2S_PARALLEL_WIDTH_8
/home/naz/Arduino/I2S_ESP32/I2S_ESP32.ino:303:25: error: 'const struct i2s_parallel_config_t' has no member named 'gpio_bus'; did you mean 'gpios_bus'?
gpio_setup_out(cfg->gpio_bus[0], sig_data_base+0, false); // D0
^~~~~~~~
gpios_bus
/home/naz/Arduino/I2S_ESP32/I2S_ESP32.ino:304:25: error: 'const struct i2s_parallel_config_t' has no member named 'gpio_bus'; did you mean 'gpios_bus'?
gpio_setup_out(cfg->gpio_bus[1], sig_data_base+1, false); // D1
^~~~~~~~
gpios_bus
/home/naz/Arduino/I2S_ESP32/I2S_ESP32.ino:305:25: error: 'const struct i2s_parallel_config_t' has no member named 'gpio_bus'; did you mean 'gpios_bus'?
gpio_setup_out(cfg->gpio_bus[2], sig_data_base+2, false); // D2
^~~~~~~~
gpios_bus
/home/naz/Arduino/I2S_ESP32/I2S_ESP32.ino:306:25: error: 'const struct i2s_parallel_config_t' has no member named 'gpio_bus'; did you mean 'gpios_bus'?
gpio_setup_out(cfg->gpio_bus[3], sig_data_base+3, false); // D3
^~~~~~~~
gpios_bus
/home/naz/Arduino/I2S_ESP32/I2S_ESP32.ino:307:25: error: 'const struct i2s_parallel_config_t' has no member named 'gpio_bus'; did you mean 'gpios_bus'?
gpio_setup_out(cfg->gpio_bus[4], sig_data_base+4, false); // HS
^~~~~~~~
gpios_bus
/home/naz/Arduino/I2S_ESP32/I2S_ESP32.ino:308:25: error: 'const struct i2s_parallel_config_t' has no member named 'gpio_bus'; did you mean 'gpios_bus'?
gpio_setup_out(cfg->gpio_bus[5], sig_data_base+5, false); // VS
^~~~~~~~
gpios_bus
/home/naz/Arduino/I2S_ESP32/I2S_ESP32.ino:309:25: error: 'const struct i2s_parallel_config_t' has no member named 'gpio_bus'; did you mean 'gpios_bus'?
gpio_setup_out(cfg->gpio_bus[6], sig_data_base+6, false); // FR
^~~~~~~~
gpios_bus
/home/naz/Arduino/I2S_ESP32/I2S_ESP32.ino:336:46: error: 'const struct i2s_parallel_config_t' has no member named 'bits'
dev->sample_rate_conf.rx_bits_mod = cfg->bits;
^~~~
/home/naz/Arduino/I2S_ESP32/I2S_ESP32.ino:337:46: error: 'const struct i2s_parallel_config_t' has no member named 'bits'
dev->sample_rate_conf.tx_bits_mod = cfg->bits;
^~~~
/home/naz/Arduino/I2S_ESP32/I2S_ESP32.ino:346:50: error: 'const struct i2s_parallel_config_t' has no member named 'clkspeed_hz'
dev->clkm_conf.clkm_div_num = 80000000L/cfg->clkspeed_hz;
^~~~~~~~~~~
/home/naz/Arduino/I2S_ESP32/I2S_ESP32.ino:374:36: error: invalid conversion from 'void*' to 'i2s_parallel_state_t*' [-fpermissive]
i2s_state[i2snum(dev)] = malloc(sizeof(i2s_parallel_state_t));
~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/naz/Arduino/I2S_ESP32/I2S_ESP32.ino:376:54: error: 'const struct i2s_parallel_config_t' has no member named 'bufa'
st->desccount_a = calc_needed_dma_descs_for(cfg->bufa);
^
/home/naz/Arduino/I2S_ESP32/I2S_ESP32.ino:376:58: error: 'calc_needed_dma_descs_for' cannot be used as a function
st->desccount_a = calc_needed_dma_descs_for(cfg->bufa);
^
/home/naz/Arduino/I2S_ESP32/I2S_ESP32.ino:378:54: error: 'const struct i2s_parallel_config_t' has no member named 'bufb'
st->desccount_b = calc_needed_dma_descs_for(cfg->bufb);
^~~~
/home/naz/Arduino/I2S_ESP32/I2S_ESP32.ino:378:58: error: 'calc_needed_dma_descs_for' cannot be used as a function
st->desccount_b = calc_needed_dma_descs_for(cfg->bufb);
^
/home/naz/Arduino/I2S_ESP32/I2S_ESP32.ino:380:37: error: invalid conversion from 'void*' to 'volatile lldesc_t*' {aka 'volatile lldesc_s*'} [-fpermissive]
st->dmadesc_a = heap_caps_malloc(st->desccount_a*sizeof(lldesc_t), MALLOC_CAP_DMA);
~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/naz/Arduino/I2S_ESP32/I2S_ESP32.ino:381:37: error: invalid conversion from 'void*' to 'volatile lldesc_t*' {aka 'volatile lldesc_s*'} [-fpermissive]
st->dmadesc_b = heap_caps_malloc(st->desccount_b*sizeof(lldesc_t), MALLOC_CAP_DMA);
~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/naz/Arduino/I2S_ESP32/I2S_ESP32.ino:384:39: error: 'const struct i2s_parallel_config_t' has no member named 'bufa'
fill_dma_desc(st->dmadesc_a, cfg->bufa);
^~~~
/home/naz/Arduino/I2S_ESP32/I2S_ESP32.ino:385:39: error: 'const struct i2s_parallel_config_t' has no member named 'bufb'
fill_dma_desc(st->dmadesc_b, cfg->bufb);
^~~~
exit status 1
Compilation error: 'i2s_parallel_buffer_desc_t' was not declared in this scope