Add documentation to a few areas

This commit is contained in:
Jm Casler
2023-07-26 16:34:36 -07:00
committed by Thomas Göttgens
parent 06a6a992c2
commit 5f38e79b8f
7 changed files with 209 additions and 13 deletions

View File

@@ -1,3 +1,11 @@
/**
* @file FSCommon.cpp
* @brief This file contains functions for common filesystem operations such as copying, renaming, listing and deleting files and directories.
*
* The functions in this file are used to perform common filesystem operations such as copying, renaming, listing and deleting files and directories.
* These functions are used in the Meshtastic-device project to manage files and directories on the device's filesystem.
*
*/
#include "FSCommon.h"
#include "configuration.h"
@@ -14,6 +22,13 @@ SPIClass SPI1(HSPI);
#endif // HAS_SDCARD
/**
* @brief Copies a file from one location to another.
*
* @param from The path of the source file.
* @param to The path of the destination file.
* @return true if the file was successfully copied, false otherwise.
*/
bool copyFile(const char *from, const char *to)
{
#ifdef FSCom
@@ -43,6 +58,14 @@ bool copyFile(const char *from, const char *to)
#endif
}
/**
* Renames a file from pathFrom to pathTo.
*
* @param pathFrom The original path of the file.
* @param pathTo The new path of the file.
*
* @return True if the file was successfully renamed, false otherwise.
*/
bool renameFile(const char *pathFrom, const char *pathTo)
{
#ifdef FSCom
@@ -59,6 +82,13 @@ bool renameFile(const char *pathFrom, const char *pathTo)
#endif
}
/**
* Lists the contents of a directory.
*
* @param dirname The name of the directory to list.
* @param levels The number of levels of subdirectories to list.
* @param del Whether or not to delete the contents of the directory after listing.
*/
void listDir(const char *dirname, uint8_t levels, bool del = false)
{
#ifdef FSCom
@@ -154,6 +184,13 @@ void listDir(const char *dirname, uint8_t levels, bool del = false)
#endif
}
/**
* @brief Removes a directory and all its contents.
*
* This function recursively removes a directory and all its contents, including subdirectories and files.
*
* @param dirname The name of the directory to remove.
*/
void rmDir(const char *dirname)
{
#ifdef FSCom
@@ -182,6 +219,9 @@ void fsInit()
#endif
}
/**
* Initializes the SD card and mounts the file system.
*/
void setupSDCard()
{
#ifdef HAS_SDCARD