direcetory listings maybe?

Added LISTDIR command and notify responses.
This commit is contained in:
Tim Keller
2021-10-17 16:04:23 +00:00
parent f57f797ff5
commit 91c644b43c
4 changed files with 129 additions and 31 deletions

View File

@@ -5,29 +5,28 @@
using namespace Pinetime::Controllers;
FS::FS(Pinetime::Drivers::SpiNorFlash& driver) :
flashDriver{ driver },
lfsConfig{
.context = this,
.read = SectorRead,
.prog = SectorProg,
.erase = SectorErase,
.sync = SectorSync,
FS::FS(Pinetime::Drivers::SpiNorFlash& driver)
: flashDriver {driver},
lfsConfig {
.context = this,
.read = SectorRead,
.prog = SectorProg,
.erase = SectorErase,
.sync = SectorSync,
.read_size = 16,
.prog_size = 8,
.block_size = blockSize,
.block_count = size / blockSize,
.block_cycles = 1000u,
.read_size = 16,
.prog_size = 8,
.block_size = blockSize,
.block_count = size / blockSize,
.block_cycles = 1000u,
.cache_size = 16,
.lookahead_size = 16,
.name_max = 50,
.attr_max = 50,
}
{ }
.cache_size = 16,
.lookahead_size = 16,
.name_max = 50,
.attr_max = 50,
} {
}
void FS::Init() {
@@ -48,7 +47,6 @@ void FS::Init() {
VerifyResource();
LVGLFileSystemInit();
#endif
}
void FS::VerifyResource() {
@@ -56,7 +54,7 @@ void FS::VerifyResource() {
resourcesValid = true;
}
int FS::FileOpen(lfs_file_t* file_p, const char* fileName, const int flags) {
int FS::FileOpen(lfs_file_t* file_p, const char* fileName, const int flags) {
return lfs_file_open(&lfs, file_p, fileName, flags);
}
@@ -80,6 +78,17 @@ int FS::FileDelete(const char* fileName) {
return lfs_remove(&lfs, fileName);
}
int FS::DirOpen(const char* path, lfs_dir_t* lfs_dir) {
return lfs_dir_open(&lfs, lfs_dir, path);
}
int FS::DirClose(lfs_dir_t* lfs_dir) {
return lfs_dir_close(&lfs, lfs_dir);
}
int FS::DirRead(lfs_dir_t* dir, lfs_info* info) {
return lfs_dir_read(&lfs, dir, info);
}
int FS::DirCreate(const char* path) {
return lfs_mkdir(&lfs, path);
@@ -148,8 +157,7 @@ namespace {
if (file->type == 0) {
return LV_FS_RES_FS_ERR;
}
else {
} else {
return LV_FS_RES_OK;
}
}
@@ -193,5 +201,4 @@ void FS::LVGLFileSystemInit() {
fs_drv.user_data = this;
lv_fs_drv_register(&fs_drv);
}

View File

@@ -21,6 +21,9 @@ namespace Pinetime {
int FileDelete(const char* fileName);
int DirOpen(const char* path, lfs_dir_t* lfs_dir);
int DirClose(lfs_dir_t* lfs_dir);
int DirRead(lfs_dir_t* dir, lfs_info* info);
int DirCreate(const char* path);
int DirDelete(const char* path);