Merge branch 'main' into LCD_API

This commit is contained in:
2023-11-09 15:01:36 +01:00
24 changed files with 5061 additions and 184 deletions

50
project/Core/Src/llfs.c Normal file
View File

@@ -0,0 +1,50 @@
/**
* @file llfs.c
* @brief Linked List Filesystem implementation (llfs)
* @author Lorenz C.
* @todo Implement file extension filter
*/
#include <string.h>
#define LOGGER_LEVEL_WARN
#include "llfs.h"
#include "log.h"
extern struct llfs_data_file* llfs_root;
const char* TAG = "llfs";
// TODO: Implement file extension filter
size_t llfs_file_list(llfs_file_t* file_list, size_t max_files, char* filter) {
size_t file_count = 0;
const struct llfs_data_file* file = llfs_root;
LOG_DEBUG(TAG, "Getting file list with filter: %s", filter);
while (file != NULL && file_count < max_files) {
file_list[file_count].data = file->data;
file_list[file_count].name = file->name;
file_list[file_count].len = file->len;
file_count++;
file = file->next;
}
LOG_DEBUG(TAG, "Files found: %d", file_count);
return file_count;
}
llfs_file_t* llfs_file_open(const char* name) {
const struct llfs_data_file* file = llfs_root;
LOG_DEBUG(TAG, "Opening file: %s", name);
while (file != NULL) {
if (strcmp(file->name, name) == 0) {
LOG_DEBUG(TAG, "File found: %s, size: %d", file->name, file->len);
return (llfs_file_t*)file;
}
file = file->next;
}
LOG_DEBUG(TAG, "File not found: %s", name);
return NULL;
}

3152
project/Core/Src/llfs_data.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -22,6 +22,7 @@
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#define LOGGER_LEVEL_ALL
#include "log.h"
//#include "test_img.h"
@@ -36,7 +37,7 @@
/* Private define ------------------------------------------------------------*/
/* USER CODE BEGIN PD */
static const char *TAG = "main";
/* USER CODE END PD */
/* Private macro -------------------------------------------------------------*/
@@ -125,6 +126,7 @@ int main(void)
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
MX_LWIP_Process();
}
/* USER CODE END 3 */
}