Files
microchip-application-bmd38…/fs.h
T
2024-04-10 21:26:34 +08:00

26 lines
875 B
C

#pragma once
#ifndef __FS_H__
#define __FS_H__
#include "lfs.h"
#include "lfs_util.h"
typedef lfs_file_t file_t;
#define FS_O_RDONLY LFS_O_RDONLY // Open a file as read only
#define FS_O_WRONLY LFS_O_WRONLY // Open a file as write only
#define FS_O_RDWR LFS_O_RDWR // Open a file as read and write
#define FS_O_CREAT LFS_O_CREAT // Create a file if it does not exist
#define FS_O_EXCL LFS_O_EXCL // Fail if a file already exists
#define FS_O_TRUNC LFS_O_TRUNC // Truncate the existing file to zero size
#define FS_O_APPEND LFS_O_APPEND // Move to end of file on every write
void fs_init(void);
int fs_file_open(file_t *hFile, char *filename, uint32_t attr);
int fs_file_write(file_t *hFile, void *write, uint32_t size);
int fs_file_read(file_t *hFile, void *read, uint32_t size);
int fs_file_close(file_t *hFile);
int fs_dir(char *path);
#endif // !__FS_H__