diff options
| author | jacqueline <me@jacqueline.id.au> | 2023-10-04 15:38:18 +1100 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2023-10-04 15:38:18 +1100 |
| commit | ee8e5234562c2b9ee1bb261785135abd4f718f83 (patch) | |
| tree | cecd2f215dcd7298e17e9538902da8c59b7fadb8 /src/database/file_gatherer.cpp | |
| parent | 28633e857f86a21d874117fd677de5e8ad21d8d3 (diff) | |
| download | tangara-fw-ee8e5234562c2b9ee1bb261785135abd4f718f83.tar.gz | |
Add a basic database reindex screen
Diffstat (limited to 'src/database/file_gatherer.cpp')
| -rw-r--r-- | src/database/file_gatherer.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/database/file_gatherer.cpp b/src/database/file_gatherer.cpp index d8c80b0d..b4e87acb 100644 --- a/src/database/file_gatherer.cpp +++ b/src/database/file_gatherer.cpp @@ -14,6 +14,7 @@ #include "ff.h" #include "memory_resource.hpp" +#include "spi.hpp" namespace database { @@ -30,7 +31,11 @@ auto FileGathererImpl::FindFiles( const TCHAR* next_path = static_cast<const TCHAR*>(next_path_str.c_str()); FF_DIR dir; - FRESULT res = f_opendir(&dir, next_path); + FRESULT res; + { + auto lock = drivers::acquire_spi(); + res = f_opendir(&dir, next_path); + } if (res != FR_OK) { // TODO: log. continue; @@ -38,7 +43,10 @@ auto FileGathererImpl::FindFiles( for (;;) { FILINFO info; - res = f_readdir(&dir, &info); + { + auto lock = drivers::acquire_spi(); + res = f_readdir(&dir, &info); + } if (res != FR_OK || info.fname[0] == 0) { // No more files in the directory. break; |
