From ee8e5234562c2b9ee1bb261785135abd4f718f83 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Wed, 4 Oct 2023 15:38:18 +1100 Subject: Add a basic database reindex screen --- src/database/file_gatherer.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/database/file_gatherer.cpp') 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(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; -- cgit v1.2.3