Наиболее простым способом видиться "упаковка" используемого API FatFS в мютекс, аля:
Код
FRESULT RTOS_f_open(
FIL *fp, /* Pointer to the blank file object */
const char *path, /* Pointer to the file name */
BYTE mode, /* Access mode and file open mode flags */
xSemaphoreHandle mutex /* <-- Например так */
)
{
xSemaphoreGive( mutex );
FRESULT fr = f_open( &file, file_name, FA_OPEN_ALWAYS | FA_WRITE );
xSemaphoreTake( mutex, portMAX_DELAY );
return fr;
}
FIL *fp, /* Pointer to the blank file object */
const char *path, /* Pointer to the file name */
BYTE mode, /* Access mode and file open mode flags */
xSemaphoreHandle mutex /* <-- Например так */
)
{
xSemaphoreGive( mutex );
FRESULT fr = f_open( &file, file_name, FA_OPEN_ALWAYS | FA_WRITE );
xSemaphoreTake( mutex, portMAX_DELAY );
return fr;
}
Прошу уже прошедших по этому пути поделиться опытом
