Skip to content

Commit

Permalink
Support specifying a CPU core ID
Browse files Browse the repository at this point in the history
  • Loading branch information
rohansingh authored and chmorgan committed Feb 28, 2024
1 parent 50739ad commit 916bc82
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion audio_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ esp_err_t audio_player_new(audio_player_config_t config)
&instance,
(UBaseType_t) instance.config.priority,
(TaskHandle_t * const) NULL,
0);
(BaseType_t) instance.config.coreID);

ESP_GOTO_ON_FALSE(pdPASS == task_val, ESP_ERR_NO_MEM, cleanup,
TAG, "Failed create audio task");
Expand Down
1 change: 1 addition & 0 deletions include/audio_player.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ typedef struct {
audio_reconfig_std_clock clk_set_fn;
audio_player_write_fn write_fn;
UBaseType_t priority; /*< FreeRTOS task priority */
BaseType_t coreID; /*< ESP32 core ID */
} audio_player_config_t;

/**
Expand Down
6 changes: 4 additions & 2 deletions test/audio_player_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ TEST_CASE("audio player can be newed and deleted", "[audio player]")
audio_player_config_t config = { .mute_fn = audio_mute_function,
.write_fn = bsp_i2s_write,
.clk_set_fn = bsp_i2s_reconfig_clk,
.priority = 0 };
.priority = 0,
.coreID = 0 };
esp_err_t ret = audio_player_new(config);
TEST_ASSERT_EQUAL(ret, ESP_OK);

Expand Down Expand Up @@ -174,7 +175,8 @@ TEST_CASE("audio player states and callbacks are correct", "[audio player]")
audio_player_config_t config = { .mute_fn = audio_mute_function,
.write_fn = bsp_i2s_write,
.clk_set_fn = bsp_i2s_reconfig_clk,
.priority = 0 };
.priority = 0,
.coreID = 0 };
ret = audio_player_new(config);
TEST_ASSERT_EQUAL(ret, ESP_OK);

Expand Down

0 comments on commit 916bc82

Please sign in to comment.