Skip to content

Commit

Permalink
Embedding flac file in ROM
Browse files Browse the repository at this point in the history
  • Loading branch information
bridadan committed Jun 1, 2020
1 parent 7b25dd1 commit e5fb2f4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 2 additions & 0 deletions main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ set(COMPONENT_PRIV_REQUIRES )
set(COMPONENT_SRCS "main.c")
set(COMPONENT_ADD_INCLUDEDIRS "")

set(COMPONENT_EMBED_FILES "flac_sample_small.flac")

register_component()
6 changes: 4 additions & 2 deletions main/component.mk
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#
# Main component makefile.
#
# This Makefile can be left empty. By default, it will take the sources in the
# src/ directory, compile them and link them into lib(subdirectory_name).a
# This Makefile can be left empty. By default, it will take the sources in the
# src/ directory, compile them and link them into lib(subdirectory_name).a
# in the build directory. This behaviour is entirely configurable,
# please read the ESP-IDF documents if you need to do this.
#

COMPONENT_EMBED_FILES := flac_sample_small.flac
5 changes: 4 additions & 1 deletion main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@

static xQueueHandle i2s_evt_queue = NULL;

extern const uint8_t flac_file_start[] asm("_binary_flac_sample_small_flacc_start");
extern const uint8_t flac_file_end[] asm("_binary_flac_sample_small_flacc_end");

void init_i2s() {
i2s_config_t i2s_config = {
.mode = I2S_MODE_MASTER | I2S_MODE_TX | I2S_MODE_DAC_BUILT_IN,
Expand Down Expand Up @@ -52,7 +55,7 @@ void app_main(void)
i2s_evt_queue = xQueueCreate(10, sizeof(uint32_t));
init_i2s();
init_gpio();
int i = 0;

while (1) {
if (xQueueReceive(i2s_evt_queue, &num, portMAX_DELAY)) {
play = !play;
Expand Down

0 comments on commit e5fb2f4

Please sign in to comment.