'i2s_chan_handle_t' does not name a type; did you mean 'intr_handle_t'?

lladam
Posts: 44
Joined: Tue Jul 20, 2021 12:14 am

'i2s_chan_handle_t' does not name a type; did you mean 'intr_handle_t'?

Postby lladam » Mon May 01, 2023 7:47 pm

Hi all.
compiling the example from: https://docs.espressif.com/projects/esp ... s/i2s.html
got error of: 'i2s_chan_handle_t' does not name a type; did you mean 'intr_handle_t'?
how to fix please?
Thanks
Adam

Code: Select all

#include "i2s_std.h"
#include "gpio.h"

i2s_chan_handle_t tx_handle;   /// compiling ERROR: 'i2s_chan_handle_t' does not name a type; did you mean 'intr_handle_t'?
  
// Get the default channel configuration by helper macro.
// * This helper macro is defined in 'i2s_common.h' and shared by all the i2s communication mode.
// * It can help to specify the I2S role, and port id 
i2s_chan_config_t chan_cfg = I2S_CHANNEL_DEFAULT_CONFIG(I2S_NUM_AUTO, I2S_ROLE_MASTER);
// Allocate a new tx channel and get the handle of this channel 
i2s_new_channel(&chan_cfg, &tx_handle, NULL);

// Setting the configurations, the slot configuration and clock configuration can be generated by the macros
// * These two helper macros is defined in 'i2s_std.h' which can only be used in STD mode.
// * They can help to specify the slot and clock configurations for initialization or updating 
i2s_std_config_t std_cfg = {
    .clk_cfg = I2S_STD_CLK_DEFAULT_CONFIG(48000),
    .slot_cfg = I2S_STD_MSB_SLOT_DEFAULT_CONFIG(I2S_DATA_BIT_WIDTH_32BIT, I2S_SLOT_MODE_STEREO),
    .gpio_cfg = {
        .mclk = I2S_GPIO_UNUSED,
        .bclk = GPIO_NUM_4,
        .ws = GPIO_NUM_5,
        .dout = GPIO_NUM_18,
        .din = I2S_GPIO_UNUSED,
        .invert_flags = {
            .mclk_inv = false,
            .bclk_inv = false,
            .ws_inv = false,
        },
    },
};
// Initialize the channel 
i2s_channel_init_std_mode(tx_handle, &std_cfg);

// Before write data, start the tx channel first 
i2s_channel_enable(tx_handle);
i2s_channel_write(tx_handle, src_buf, bytes_to_write, bytes_written, ticks_to_wait);

//* If the configurations of slot or clock need to be updated,
// * stop the channel first and then update it 
// i2s_channel_disable(tx_handle);
// std_cfg.slot_cfg.slot_mode = I2S_SLOT_MODE_MONO; // Default is stereo
// i2s_channel_reconfig_std_slot(tx_handle, &std_cfg.slot_cfg);
// std_cfg.clk_cfg.sample_rate_hz = 96000;
// i2s_channel_reconfig_std_clock(tx_handle, &std_cfg.clk_cfg);

//* Have to stop the channel before deleting it 
i2s_channel_disable(tx_handle);
//* If the handle is not needed any more, delete it to release the channel resources 
i2s_del_channel(tx_handle);

Code: Select all

Arduino: 1.8.19 (Windows 10), Board: "ESP32 Dev Module, Disabled, Disabled, Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS), 240MHz (WiFi/BT), QIO, 80MHz, 4MB (32Mb), 921600, Core 1, Core 1, None, Disabled"


In file included from E:\ls\ESP32_I2S_STD_TX_Mode_ls\ESP32_I2S_STD_TX_Mode_ls.ino:16:
C:\Users\xz\Documents\Arduino\libraries\include/i2s_std.h:242:54: error: ISO C++ forbids declaration of 'Default' with no type [-fpermissive]
                                                  *   Default is 256 in the helper macro, it can satisfy most of cases,
                                                      ^~~~~~~
C:\Users\xz\Documents\Arduino\libraries\include/i2s_std.h:242:54: error: expected ';' at end of member declaration
                                                  *   Default is 256 in the helper macro, it can satisfy most of cases,
                                                      ^~~~~~~
                                                             ;
C:\Users\xz\Documents\Arduino\libraries\include/i2s_std.h:242:62: error: 'is' does not name a type
                                                  *   Default is 256 in the helper macro, it can satisfy most of cases,
                                                              ^~
C:\Users\xz\Documents\Arduino\libraries\include/i2s_std.h:290:37: error: 'i2s_chan_handle_t' was not declared in this scope
 esp_err_t i2s_channel_init_std_mode(i2s_chan_handle_t handle, const i2s_std_config_t *std_cfg);
                                     ^~~~~~~~~~~~~~~~~
C:\Users\xz\Documents\Arduino\libraries\include/i2s_std.h:290:37: note: suggested alternative: 'intr_handle_t'
 esp_err_t i2s_channel_init_std_mode(i2s_chan_handle_t handle, const i2s_std_config_t *std_cfg);
                                     ^~~~~~~~~~~~~~~~~
                                     intr_handle_t
C:\Users\xz\Documents\Arduino\libraries\include/i2s_std.h:290:63: error: expected primary-expression before 'const'
 esp_err_t i2s_channel_init_std_mode(i2s_chan_handle_t handle, const i2s_std_config_t *std_cfg);
                                                               ^~~~~
C:\Users\xz\Documents\Arduino\libraries\include/i2s_std.h:290:94: error: expression list treated as compound expression in initializer [-fpermissive]
 esp_err_t i2s_channel_init_std_mode(i2s_chan_handle_t handle, const i2s_std_config_t *std_cfg);
                                                                                              ^
C:\Users\xz\Documents\Arduino\libraries\include/i2s_std.h:305:42: error: 'i2s_chan_handle_t' was not declared in this scope
 esp_err_t i2s_channel_reconfig_std_clock(i2s_chan_handle_t handle, const i2s_std_clk_config_t *clk_cfg);
                                          ^~~~~~~~~~~~~~~~~
C:\Users\xz\Documents\Arduino\libraries\include/i2s_std.h:305:42: note: suggested alternative: 'intr_handle_t'
 esp_err_t i2s_channel_reconfig_std_clock(i2s_chan_handle_t handle, const i2s_std_clk_config_t *clk_cfg);
                                          ^~~~~~~~~~~~~~~~~
                                          intr_handle_t
C:\Users\xz\Documents\Arduino\libraries\include/i2s_std.h:305:68: error: expected primary-expression before 'const'
 esp_err_t i2s_channel_reconfig_std_clock(i2s_chan_handle_t handle, const i2s_std_clk_config_t *clk_cfg);
                                                                    ^~~~~
C:\Users\xz\Documents\Arduino\libraries\include/i2s_std.h:305:103: error: expression list treated as compound expression in initializer [-fpermissive]
 esp_err_t i2s_channel_reconfig_std_clock(i2s_chan_handle_t handle, const i2s_std_clk_config_t *clk_cfg);
                                                                                                       ^
C:\Users\xz\Documents\Arduino\libraries\include/i2s_std.h:322:41: error: 'i2s_chan_handle_t' was not declared in this scope
 esp_err_t i2s_channel_reconfig_std_slot(i2s_chan_handle_t handle, const i2s_std_slot_config_t *slot_cfg);
                                         ^~~~~~~~~~~~~~~~~
C:\Users\xz\Documents\Arduino\libraries\include/i2s_std.h:322:41: note: suggested alternative: 'intr_handle_t'
 esp_err_t i2s_channel_reconfig_std_slot(i2s_chan_handle_t handle, const i2s_std_slot_config_t *slot_cfg);
                                         ^~~~~~~~~~~~~~~~~
                                         intr_handle_t
C:\Users\xz\Documents\Arduino\libraries\include/i2s_std.h:322:67: error: expected primary-expression before 'const'
 esp_err_t i2s_channel_reconfig_std_slot(i2s_chan_handle_t handle, const i2s_std_slot_config_t *slot_cfg);
                                                                   ^~~~~
C:\Users\xz\Documents\Arduino\libraries\include/i2s_std.h:322:104: error: expression list treated as compound expression in initializer [-fpermissive]
 esp_err_t i2s_channel_reconfig_std_slot(i2s_chan_handle_t handle, const i2s_std_slot_config_t *slot_cfg);
                                                                                                        ^
C:\Users\xz\Documents\Arduino\libraries\include/i2s_std.h:337:41: error: 'i2s_chan_handle_t' was not declared in this scope
 esp_err_t i2s_channel_reconfig_std_gpio(i2s_chan_handle_t handle, const i2s_std_gpio_config_t *gpio_cfg);
                                         ^~~~~~~~~~~~~~~~~
C:\Users\xz\Documents\Arduino\libraries\include/i2s_std.h:337:41: note: suggested alternative: 'intr_handle_t'
 esp_err_t i2s_channel_reconfig_std_gpio(i2s_chan_handle_t handle, const i2s_std_gpio_config_t *gpio_cfg);
                                         ^~~~~~~~~~~~~~~~~
                                         intr_handle_t
C:\Users\xz\Documents\Arduino\libraries\include/i2s_std.h:337:67: error: expected primary-expression before 'const'
 esp_err_t i2s_channel_reconfig_std_gpio(i2s_chan_handle_t handle, const i2s_std_gpio_config_t *gpio_cfg);
                                                                   ^~~~~
C:\Users\xz\Documents\Arduino\libraries\include/i2s_std.h:337:104: error: expression list treated as compound expression in initializer [-fpermissive]
 esp_err_t i2s_channel_reconfig_std_gpio(i2s_chan_handle_t handle, const i2s_std_gpio_config_t *gpio_cfg);
                                                                                                        ^
ESP32_I2S_STD_TX_Mode_ls:19:1: error: 'i2s_chan_handle_t' does not name a type; did you mean 'intr_handle_t'?
 i2s_chan_handle_t tx_handle;   /// compiling ERROR: 'i2s_chan_handle_t' does not name a type; did you mean 'intr_handle_t'?
 ^~~~~~~~~~~~~~~~~
 intr_handle_t
ESP32_I2S_STD_TX_Mode_ls:24:1: error: 'i2s_chan_config_t' does not name a type; did you mean 'i2s_std_config_t'?
 i2s_chan_config_t chan_cfg = I2S_CHANNEL_DEFAULT_CONFIG(I2S_NUM_AUTO, I2S_ROLE_MASTER);
 ^~~~~~~~~~~~~~~~~
 i2s_std_config_t
ESP32_I2S_STD_TX_Mode_ls:26:16: error: expected constructor, destructor, or type conversion before '(' token
 i2s_new_channel(&chan_cfg, &tx_handle, NULL);
                ^
In file included from E:\ls\ESP32_I2S_STD_TX_Mode_ls\ESP32_I2S_STD_TX_Mode_ls.ino:16:
C:\Users\xz\Documents\Arduino\libraries\include/i2s_std.h:205:22: error: 'I2S_MCLK_MULTIPLE_256' was not declared in this scope
     .mclk_multiple = I2S_MCLK_MULTIPLE_256, \
                      ^~~~~~~~~~~~~~~~~~~~~
E:\ls\ESP32_I2S_STD_TX_Mode_ls\ESP32_I2S_STD_TX_Mode_ls.ino:32:16: note: in expansion of macro 'I2S_STD_CLK_DEFAULT_CONFIG'
     .clk_cfg = I2S_STD_CLK_DEFAULT_CONFIG(48000),
                ^~~~~~~~~~~~~~~~~~~~~~~~~~
ESP32_I2S_STD_TX_Mode_ls:35:17: error: 'I2S_GPIO_UNUSED' was not declared in this scope
         .mclk = I2S_GPIO_UNUSED,
                 ^~~~~~~~~~~~~~~
ESP32_I2S_STD_TX_Mode_ls:39:16: error: 'I2S_GPIO_UNUSED' was not declared in this scope
         .din = I2S_GPIO_UNUSED,
                ^~~~~~~~~~~~~~~
ESP32_I2S_STD_TX_Mode_ls:46:1: error: 'i2s_std_clk_config_t' has no non-static data member named 'mclk_multiple'
 };
 ^
ESP32_I2S_STD_TX_Mode_ls:48:26: error: expected constructor, destructor, or type conversion before '(' token
 i2s_channel_init_std_mode(tx_handle, &std_cfg);
                          ^
ESP32_I2S_STD_TX_Mode_ls:51:19: error: expected constructor, destructor, or type conversion before '(' token
 i2s_channel_enable(tx_handle);
                   ^
ESP32_I2S_STD_TX_Mode_ls:52:18: error: expected constructor, destructor, or type conversion before '(' token
 i2s_channel_write(tx_handle, src_buf, bytes_to_write, bytes_written, ticks_to_wait);
                  ^
ESP32_I2S_STD_TX_Mode_ls:63:20: error: expected constructor, destructor, or type conversion before '(' token
 i2s_channel_disable(tx_handle);
                    ^
ESP32_I2S_STD_TX_Mode_ls:65:16: error: expected constructor, destructor, or type conversion before '(' token
 i2s_del_channel(tx_handle);
                ^
exit status 1
'i2s_chan_handle_t' does not name a type; did you mean 'intr_handle_t'?


This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

ESP_Sprite
Posts: 9730
Joined: Thu Nov 26, 2015 4:08 am

Re: 'i2s_chan_handle_t' does not name a type; did you mean 'intr_handle_t'?

Postby ESP_Sprite » Tue May 02, 2023 2:28 am

Probably a mismatch between the docs that you are reading (which are from the bleeding-edge ESP-IDF) and the ESP-IDF used in Arduino.

Who is online

Users browsing this forum: No registered users and 117 guests