cancel
Showing results for 
Search instead for 
Did you mean: 

Display list of files on SD card

Petr3
Associate III

Hello,

im working on MP3 player. I would like to show list of files/folders(file system) in the FAT system on SD card and open them. The length of list is dynamically based on content of SD card. What is the good approach to do this?

 

Thanks for the tips.

4 REPLIES 4
SofLit
ST Employee

Hello,

Look at the implementation of one of the Audio file player/record examples that provides a folder "explorer".

For example:

https://github.com/STMicroelectronics/STM32CubeF7/blob/master/Projects/STM32746G-Discovery/Applications/Audio/Audio_playback_and_record/Src/explorer.c

Hope it helps

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

Thanks for your reply. I meant can be done by some container with scroll bar?

 

Thank you

Hello @Petr3 ,

 

That sounds like a perfect job for the scroll list widget .

As you can have thousands of music, it would be appropriate to limit the number of elements in your scroll list and to update these elements to reflect the current music to display.

I see 2 ways of doing that :

  1. Have a linear scroll list offsetted : have 30 elements, center the scroll list at element 10 (instead of 0), this way you have elements above and below, allowing the user to scroll up or down, you can fetch the scrolled amount with the getScrolledY() method and update the elements accordingly (show music number "previousOffset + getScrolledY()/heightOfElement" and then recenter the scrollList to element 10 with setPosition() ).
  2. Have a circular scroll list : once you have scrolled past the number of elements in the container, you have to update these elements to show music 1+nbrOfScrollElements

Here is a bad illustration of it:

GaetanGodart_0-1726733670356.png

 

It is important to have more elements than what is visible to allow for proper updating during the scroll, because updating the elements can only happen once the scroll is finished (as far as I know).

I hope this helps.

 

Regards,

 

Gaetan Godart
Software engineer at ST (TouchGFX)

Hello @Petr3 ,

 

Were you able to move forward on your issue?

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)