Skip to content

Commit

Permalink
Merge branch 'feature/support_c++_compilation' into 'master'
Browse files Browse the repository at this point in the history
feature: Support C++

See merge request adf/esp-adf-internal!1349
  • Loading branch information
jason-mao committed Nov 1, 2024
2 parents f39e2dd + d1f7d4a commit ff7f39d
Show file tree
Hide file tree
Showing 25 changed files with 88 additions and 73 deletions.
2 changes: 1 addition & 1 deletion components/audio_board/esp32_korvo_du1906/board_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
* @brief Audio Codec Chip Function Definition
*/
#define FUNC_AUDIO_CODEC_EN (1)
#define CODEC_ADC_I2S_PORT (0)
#define CODEC_ADC_I2S_PORT ((i2s_port_t)0)
#define ES7243_MCLK_GPIO GPIO_NUM_0
#define PA_ENABLE_GPIO GPIO_NUM_12
#define BOARD_PA_GAIN (10) /* Power amplifier gain defined by board (dB) */
Expand Down
4 changes: 2 additions & 2 deletions components/audio_board/esp32_p4_function_ev_board/board_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@
#define ES8311_MCLK_SOURCE (1) /* 0 From MCLK of esp32 1 From BCLK */
#define HEADPHONE_DETECT (-1)
#define PA_ENABLE_GPIO GPIO_NUM_53
#define CODEC_ADC_I2S_PORT (0)
#define CODEC_ADC_BITS_PER_SAMPLE (16) /* 16bit */
#define CODEC_ADC_I2S_PORT ((i2s_port_t)0)
#define CODEC_ADC_BITS_PER_SAMPLE ((i2s_data_bit_width_t)16) /* 16bit */
#define CODEC_ADC_SAMPLE_RATE (48000)
#define RECORD_HARDWARE_AEC (true)
#define BOARD_PA_GAIN (6) /* Power amplifier gain defined by board (dB) */
Expand Down
4 changes: 2 additions & 2 deletions components/audio_board/esp32_s2_kaluga_1_v1_2/board_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@
#define FUNC_AUDIO_CODEC_EN (1)
#define PA_ENABLE_GPIO (10)
#define ES8311_MCLK_SOURCE (1) /* 0 From MCLK, 1 From BCLK */
#define CODEC_ADC_I2S_PORT (0)
#define CODEC_ADC_BITS_PER_SAMPLE (16) /* 16bit */
#define CODEC_ADC_I2S_PORT ((i2s_port_t)0)
#define CODEC_ADC_BITS_PER_SAMPLE ((i2s_data_bit_width_t)16) /* 16bit */
#define CODEC_ADC_SAMPLE_RATE (48000)
#define RECORD_HARDWARE_AEC (false)
#define BOARD_PA_GAIN (0) /* Power amplifier gain defined by board (dB) */
Expand Down
4 changes: 2 additions & 2 deletions components/audio_board/esp32_s3_box/board_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@
* @brief Audio Codec Chip Function Definition
*/
#define FUNC_AUDIO_CODEC_EN (1)
#define CODEC_ADC_I2S_PORT (0)
#define CODEC_ADC_BITS_PER_SAMPLE (32) /* 32bit */
#define CODEC_ADC_I2S_PORT ((i2s_port_t)0)
#define CODEC_ADC_BITS_PER_SAMPLE ((i2s_data_bit_width_t)32) /* 32bit */
#define CODEC_ADC_SAMPLE_RATE (48000)
#define RECORD_HARDWARE_AEC (true)
#define BOARD_PA_GAIN (0) /* Power amplifier gain defined by board (dB) */
Expand Down
4 changes: 2 additions & 2 deletions components/audio_board/esp32_s3_box_3/board_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@
* @brief Audio Codec Chip Function Definition
*/
#define FUNC_AUDIO_CODEC_EN (1)
#define CODEC_ADC_I2S_PORT (0)
#define CODEC_ADC_BITS_PER_SAMPLE (32) /* 32bit */
#define CODEC_ADC_I2S_PORT ((i2s_port_t)0)
#define CODEC_ADC_BITS_PER_SAMPLE ((i2s_data_bit_width_t)32) /* 32bit */
#define CODEC_ADC_SAMPLE_RATE (48000)
#define RECORD_HARDWARE_AEC (true)
#define BOARD_PA_GAIN (0) /* Power amplifier gain defined by board (dB) */
Expand Down
4 changes: 2 additions & 2 deletions components/audio_board/esp32_s3_box_lite/board_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@
#define FUNC_AUDIO_CODEC_EN (1)
#define HEADPHONE_DETECT -1
#define PA_ENABLE_GPIO GPIO_NUM_46
#define CODEC_ADC_I2S_PORT (0)
#define CODEC_ADC_BITS_PER_SAMPLE I2S_BITS_PER_SAMPLE_32BIT
#define CODEC_ADC_I2S_PORT ((i2s_port_t)0)
#define CODEC_ADC_BITS_PER_SAMPLE ((i2s_data_bit_width_t)I2S_BITS_PER_SAMPLE_32BIT)
#define CODEC_ADC_SAMPLE_RATE (48000)
#define RECORD_HARDWARE_AEC (false)
#define BOARD_PA_GAIN (0) /* Power amplifier gain defined by board (dB) */
Expand Down
4 changes: 2 additions & 2 deletions components/audio_board/esp32_s3_korvo2_v3/board_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@
* @brief Audio Codec Chip Function Definition
*/
#define FUNC_AUDIO_CODEC_EN (1)
#define CODEC_ADC_I2S_PORT (0)
#define CODEC_ADC_BITS_PER_SAMPLE (32) /* 32bit */
#define CODEC_ADC_I2S_PORT ((i2s_port_t)0)
#define CODEC_ADC_BITS_PER_SAMPLE ((i2s_data_bit_width_t)32) /* 32bit */
#define CODEC_ADC_SAMPLE_RATE (48000)
#define RECORD_HARDWARE_AEC (true)
#define BOARD_PA_GAIN (6) /* Power amplifier gain defined by board (dB) */
Expand Down
4 changes: 2 additions & 2 deletions components/audio_board/esp32_s3_korvo2l_v1/board_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@
#define ES8311_MCLK_SOURCE (1) /* 0 From MCLK of esp32 1 From BCLK */
#define HEADPHONE_DETECT (-1)
#define PA_ENABLE_GPIO GPIO_NUM_46
#define CODEC_ADC_I2S_PORT (0)
#define CODEC_ADC_BITS_PER_SAMPLE (16) /* 16bit */
#define CODEC_ADC_I2S_PORT ((i2s_port_t)0)
#define CODEC_ADC_BITS_PER_SAMPLE ((i2s_data_bit_width_t)16) /* 16bit */
#define CODEC_ADC_SAMPLE_RATE (48000)
#define RECORD_HARDWARE_AEC (true)
#define BOARD_PA_GAIN (6) /* Power amplifier gain defined by board (dB) */
Expand Down
4 changes: 2 additions & 2 deletions components/audio_board/lyrat_mini_v1_1/board_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
#define HEADPHONE_DETECT GPIO_NUM_19
#define PA_ENABLE_GPIO GPIO_NUM_21
#define ES8311_MCLK_SOURCE 1 /* 0 From MCLK of esp32 1 From BCLK */
#define CODEC_ADC_I2S_PORT (1)
#define CODEC_ADC_BITS_PER_SAMPLE (16) /* 16bit */
#define CODEC_ADC_I2S_PORT ((i2s_port_t)1)
#define CODEC_ADC_BITS_PER_SAMPLE ((i2s_data_bit_width_t)16) /* 16bit */
#define CODEC_ADC_SAMPLE_RATE (16000)
#define RECORD_HARDWARE_AEC (true)
#define BOARD_PA_GAIN (20) /* Power amplifier gain defined by board (dB) */
Expand Down
4 changes: 2 additions & 2 deletions components/audio_board/lyrat_v4_2/board_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@
#define FUNC_AUDIO_CODEC_EN (1)
#define AUXIN_DETECT_GPIO GPIO_NUM_12
#define PA_ENABLE_GPIO GPIO_NUM_21
#define CODEC_ADC_I2S_PORT (0)
#define CODEC_ADC_BITS_PER_SAMPLE (16) /* 16bit */
#define CODEC_ADC_I2S_PORT ((i2s_port_t)0)
#define CODEC_ADC_BITS_PER_SAMPLE ((i2s_data_bit_width_t)16) /* 16bit */
#define CODEC_ADC_SAMPLE_RATE (48000)
#define RECORD_HARDWARE_AEC (false)
#define BOARD_PA_GAIN (10) /* Power amplifier gain defined by board (dB) */
Expand Down
4 changes: 2 additions & 2 deletions components/audio_board/lyrat_v4_3/board_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@
#define AUXIN_DETECT_GPIO GPIO_NUM_12
#define HEADPHONE_DETECT GPIO_NUM_19
#define PA_ENABLE_GPIO GPIO_NUM_21
#define CODEC_ADC_I2S_PORT (0)
#define CODEC_ADC_BITS_PER_SAMPLE (16) /* 16bit */
#define CODEC_ADC_I2S_PORT ((i2s_port_t)0)
#define CODEC_ADC_BITS_PER_SAMPLE ((i2s_data_bit_width_t)16) /* 16bit */
#define CODEC_ADC_SAMPLE_RATE (48000)
#define RECORD_HARDWARE_AEC (false)
#define BOARD_PA_GAIN (10) /* Power amplifier gain defined by board (dB) */
Expand Down
4 changes: 2 additions & 2 deletions components/audio_board/lyratd_msc_v2_1/board_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
#define PA_ENABLE_GPIO GPIO_NUM_22
#define CODEC_RESET_GPIO GPIO_NUM_19
#define DSP_RESET_GPIO GPIO_NUM_21
#define CODEC_ADC_I2S_PORT (0)
#define CODEC_ADC_BITS_PER_SAMPLE (16) /* 16bit */
#define CODEC_ADC_I2S_PORT ((i2s_port_t)0)
#define CODEC_ADC_BITS_PER_SAMPLE ((i2s_data_bit_width_t)16) /* 16bit */
#define CODEC_ADC_SAMPLE_RATE (44100)
#define RECORD_HARDWARE_AEC (false)
#define BOARD_PA_GAIN (20) /* Power amplifier gain defined by board (dB) */
Expand Down
4 changes: 2 additions & 2 deletions components/audio_board/lyratd_msc_v2_2/board_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
#define PA_ENABLE_GPIO GPIO_NUM_22
#define CODEC_RESET_GPIO GPIO_NUM_19
#define DSP_RESET_GPIO GPIO_NUM_21
#define CODEC_ADC_I2S_PORT (0)
#define CODEC_ADC_BITS_PER_SAMPLE (16) /* 16bit */
#define CODEC_ADC_I2S_PORT ((i2s_port_t)0)
#define CODEC_ADC_BITS_PER_SAMPLE ((i2s_data_bit_width_t)16) /* 16bit */
#define CODEC_ADC_SAMPLE_RATE (44100)
#define RECORD_HARDWARE_AEC (false)
#define BOARD_PA_GAIN (20) /* Power amplifier gain defined by board (dB) */
Expand Down
2 changes: 1 addition & 1 deletion components/audio_mixer/include/audio_mixer.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ extern "C"
}

#define AUDIO_MIXER_DEFAULT_CONF(samplerate, channels, bits_per_sample, max_slot) { \
.sample_rate = samplerate, \
.channel = channels, \
.bits = bits_per_sample, \
.sample_rate = samplerate, \
.task_stack = 4096, \
.task_prio = 6, \
.task_core = 1, \
Expand Down
2 changes: 1 addition & 1 deletion components/audio_pipeline/include/audio_element.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ typedef struct {

typedef esp_err_t (*el_io_func)(audio_element_handle_t self);
typedef audio_element_err_t (*process_func)(audio_element_handle_t self, char *el_buffer, int el_buf_len);
typedef audio_element_err_t (*stream_func)(audio_element_handle_t self, char *buffer, int len, TickType_t ticks_to_wait,
typedef int (*stream_func)(audio_element_handle_t self, char *buffer, int len, TickType_t ticks_to_wait,
void *context);
typedef esp_err_t (*event_cb_func)(audio_element_handle_t el, audio_event_iface_msg_t *event, void *ctx);
typedef esp_err_t (*ctrl_func)(audio_element_handle_t self, void *in_data, int in_size, void *out_data, int *out_size);
Expand Down
30 changes: 15 additions & 15 deletions components/audio_recorder/include/recorder_sr.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,21 +93,21 @@ typedef struct {
}
#endif

#define DEFAULT_RECORDER_SR_CFG() { \
.afe_cfg = AFE_CONFIG_DEFAULT(), \
.input_order = INPUT_ORDER_DEFAULT(), \
.multinet_init = true, \
.feed_task_core = FEED_TASK_PINNED_CORE, \
.feed_task_prio = FEED_TASK_PRIO, \
.feed_task_stack = FEED_TASK_STACK_SZ, \
.fetch_task_core = FETCH_TASK_PINNED_CORE, \
.fetch_task_prio = FETCH_TASK_PRIO, \
.fetch_task_stack = FETCH_TASK_STACK_SZ, \
.rb_size = SR_OUTPUT_RB_SIZE, \
.partition_label = "model", \
.mn_language = ESP_MN_CHINESE, \
.wn_wakeword = NULL, \
};
#define DEFAULT_RECORDER_SR_CFG() { \
.afe_cfg = AFE_CONFIG_DEFAULT(), \
.input_order = INPUT_ORDER_DEFAULT(), \
.multinet_init = true, \
.feed_task_core = FEED_TASK_PINNED_CORE, \
.feed_task_prio = FEED_TASK_PRIO, \
.feed_task_stack = FEED_TASK_STACK_SZ, \
.fetch_task_core = FETCH_TASK_PINNED_CORE, \
.fetch_task_prio = FETCH_TASK_PRIO, \
.fetch_task_stack = FETCH_TASK_STACK_SZ, \
.rb_size = SR_OUTPUT_RB_SIZE, \
.partition_label = "model", \
.mn_language = ESP_MN_CHINESE, \
.wn_wakeword = NULL, \
}

/**
* @brief Initialize sr processor, and the sr is disabled as default.
Expand Down
9 changes: 8 additions & 1 deletion components/audio_stream/include/embed_flash_stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@

#include "audio_element.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
* @brief Flash-embedding stream configurations, if any entry is zero then the configuration will be set to default values
*/
Expand Down Expand Up @@ -90,5 +94,8 @@ audio_element_handle_t embed_flash_stream_init(embed_flash_stream_cfg_t *config)
*/
esp_err_t embed_flash_stream_set_context(audio_element_handle_t embed_stream, const embed_item_info_t *context, int max_num);

#endif // __EMBED_FLASH_H__
#ifdef __cplusplus
}
#endif

#endif // __EMBED_FLASH_H__
18 changes: 9 additions & 9 deletions components/audio_stream/include/i2s_stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ typedef struct {
#if SOC_I2S_SUPPORTS_TDM
i2s_tdm_config_t tdm_cfg; /*!< I2S TDM mode major configuration that including clock/slot/gpio configuration */
#endif // SOC_I2S_SUPPORTS_TDM
i2s_data_bit_width_t expand_src_bits; /*!< The source bits per sample when data expand */
bool use_alc; /*!< It is a flag for ALC. If use ALC, the value is true. Or the value is false */
int volume; /*!< The volume of audio input data will be set. */
int out_rb_size; /*!< Size of output ringbuffer */
Expand All @@ -200,6 +199,7 @@ typedef struct {
int multi_out_num; /*!< The number of multiple output */
bool uninstall_drv; /*!< whether uninstall the i2s driver when stream destroyed*/
bool need_expand; /*!< whether to expand i2s data */
i2s_data_bit_width_t expand_src_bits; /*!< The source bits per sample when data expand */
int buffer_len; /*!< Buffer length use for an Element. Note: when 'bits_per_sample' is 24 bit, the buffer length must be a multiple of 3. The recommended value is 3600 */
} i2s_stream_cfg_t;

Expand Down Expand Up @@ -251,6 +251,14 @@ typedef struct {

#define I2S_STREAM_CFG_DEFAULT_WITH_TYLE_AND_CH(port, rate, bits, stream_type, channel) { \
.type = stream_type, \
.transmit_mode = I2S_COMM_MODE_STD, \
.chan_cfg = { \
.id = port, \
.role = I2S_ROLE_MASTER, \
.dma_desc_num = 3, \
.dma_frame_num = 312, \
.auto_clear = true, \
}, \
.std_cfg = { \
.clk_cfg = I2S_STD_CLK_DEFAULT_CONFIG(rate), \
.slot_cfg = I2S_STD_PHILIPS_SLOT_DEFAULT_ADF_CONFIG(bits, channel), \
Expand All @@ -261,14 +269,6 @@ typedef struct {
}, \
}, \
}, \
.transmit_mode = I2S_COMM_MODE_STD, \
.chan_cfg = { \
.id = port, \
.role = I2S_ROLE_MASTER, \
.dma_desc_num = 3, \
.dma_frame_num = 312, \
.auto_clear = true, \
}, \
.use_alc = false, \
.volume = 0, \
.out_rb_size = I2S_STREAM_RINGBUFFER_SIZE, \
Expand Down
19 changes: 9 additions & 10 deletions components/battery_service/include/battery_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,15 @@ typedef struct {
void *charger_monitor; /*!< Charger monitor. Not supported yet */
} battery_service_config_t;

#define BATTERY_SERVICE_DEFAULT_CONFIG() \
{ \
.task_stack = 3 * 1024, \
.task_prio = 6, \
.task_core = 0, \
.evt_cb = NULL, \
.cb_ctx = NULL, \
.extern_stack = true, \
.vol_monitor = NULL, \
}
#define BATTERY_SERVICE_DEFAULT_CONFIG() { \
.task_stack = 3 * 1024, \
.task_prio = 6, \
.task_core = 0, \
.extern_stack = true, \
.evt_cb = NULL, \
.cb_ctx = NULL, \
.vol_monitor = NULL, \
}

/**
* @brief Create the battery service instance
Expand Down
2 changes: 1 addition & 1 deletion components/esp-adf-libs
3 changes: 2 additions & 1 deletion components/esp_peripherals/include/periph_lcd.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@
#ifndef _PERIPH_LCD_H_
#define _PERIPH_LCD_H_

#include "esp_lcd_panel_io.h" // Do not use extern "C" with this header to avoid C++ linkage issues.

#ifdef __cplusplus
extern "C" {
#endif

#if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 4, 0))
#include "esp_lcd_panel_io.h"
#include "esp_lcd_panel_vendor.h"
#include "driver/spi_master.h"
#include "esp_peripherals.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ extern "C"
#define MIXER_PIPELINE_TASK_PRIO (5)

#define AUDIO_MIXER_PIPELINE_CFG_DEFAULT() { \
.mixer = NULL, \
.url = NULL, \
.mixer = NULL, \
.slot = 0, \
.resample_rate = 44100, \
.resample_channel = 2, \
Expand Down
8 changes: 4 additions & 4 deletions examples/display/led_pixels/components/convert/include/cnv.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@ extern "C" {
#define CNV_CFG_DEFAULT() { \
.source_size = 2048, \
.audio_samplerate = CNV_AUDIO_SAMPLE, \
.audio_resolution_bits = CNV_AUDIO_RESOLUTION_BITS, \
.n_samples = CNV_N_SAMPLES, \
.default_rms_min = CNV_AUDIO_MIN_RMS, \
.default_rms_max = CONFIG_EXAMPLE_DEFAULT_AUDIO_MAX_RMS, \
.window_max_width_db = CNV_AUDIO_WINDOW_MAX_WIDTH_DB, \
.regress_threshold_vol = CNV_AUDIO_REGRESS_THRESHOLD_VOL, \
.audio_resolution_bits = CNV_AUDIO_RESOLUTION_BITS, \
.default_rms_min = CNV_AUDIO_MIN_RMS, \
.default_rms_max = CONFIG_EXAMPLE_DEFAULT_AUDIO_MAX_RMS, \
.total_leds = CNV_TOTAL_LEDS, \
.task_stack = 3072, \
.task_core = 0, \
.task_prio = 12, \
.task_core = 0, \
}

typedef struct cnv_handle_s cnv_handle_t;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,25 @@ extern "C" {
#define PIXEL_RENDERER_CTRL_IO (CONFIG_EXAMPLE_LED_CTRL_IO) /*!< LED control signal pin */

#define PIXEL_RENDERER_CFG_DEFAULT() { \
.total_leds = CNV_TOTAL_LEDS, \
.x_axis_points = CNV_TOTAL_LEDS, \
.y_axis_points = 1, \
.origin_offset = 0, \
.total_leds = CNV_TOTAL_LEDS, \
.queue_size = 3, \
.task_stack = 3072, \
.task_core = 0, \
.task_prio = 21, \
.task_core = 0, \
}

#define PIXEL_RENDERER_SPECTRUM_DISPLAY_CFG_DEFAULT() { \
.total_leds = 64, \
.x_axis_points = 8, \
.y_axis_points = 8, \
.origin_offset = 7, \
.total_leds = 64, \
.queue_size = 3, \
.task_stack = 3072, \
.task_core = 0, \
.task_prio = 21, \
.task_core = 0, \
}

typedef struct pixel_renderer_handle pixel_renderer_handle_t;
Expand Down
8 changes: 8 additions & 0 deletions examples/dueros/main/dueros_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@
#ifndef _DUER_APP_H_
#define _DUER_APP_H_

#ifdef __cplusplus
extern "C" {
#endif

void duer_app_init(void);

#ifdef __cplusplus
}
#endif

#endif

0 comments on commit ff7f39d

Please sign in to comment.