How to get the sdcard handler in the ADF read MP3 from sdcard example

ihouses
Posts: 19
Joined: Sun Jul 09, 2017 1:41 pm

How to get the sdcard handler in the ADF read MP3 from sdcard example

Postby ihouses » Mon Jan 04, 2021 1:38 pm

Hi,

I am working with the ADF example play_sdcard_mp3_example in the Lyrat board.
I can play the test.mp3 but now I want to do operations with the SDcard like open files, list files... etc. Since the SDcard was initialized in
audio_board_sdcard_init(), how can I get the sdcard handler that is used in the IDF example? sdmmc_card_t

Altivecer
Posts: 15
Joined: Thu May 05, 2022 10:55 pm

Re: How to get the sdcard handler in the ADF read MP3 from sdcard example

Postby Altivecer » Tue May 10, 2022 4:45 pm

Hi,

did you ever figure this out?
I'm running into the same issue.

Doug

tempo.tian
Posts: 40
Joined: Wed Jun 22, 2022 12:10 pm

Re: How to get the sdcard handler in the ADF read MP3 from sdcard example

Postby tempo.tian » Wed Jun 22, 2022 12:46 pm

You do not need to get sdcard handle.
You can call function in <stdio.h> directly to operate open, read, close file action using fopen, fclose etc.

Altivecer
Posts: 15
Joined: Thu May 05, 2022 10:55 pm

Re: How to get the sdcard handler in the ADF read MP3 from sdcard example

Postby Altivecer » Mon Jun 27, 2022 11:39 pm

Just a note, you have to but "/sdcard/" in front of the file name

FILE *demo = fopen("/sdcard/demo.txt", "w+");

printf("demo = %u\n", (uint32_t)demo);
fprintf(demo, "This is a test");
fclose(demo);

works and creates a file on the SD Card.

Thank you so much.

Doug

Who is online

Users browsing this forum: Baidu [Spider] and 9 guests