|
microsd 2.2.0
|
microSD Click example More...
Macros | |
| #define | FORMAT_CARD 0 |
| #define | PATH_ROOT "3:/" |
| #define | PATH_DIR1 PATH_ROOT "_DIR1_/" |
| #define | PATH_DIR2 PATH_DIR1 "_DIR2_/" |
| #define | PATH_DIR3 PATH_DIR1 "_DIR3_/" |
| #define | PATH_DIR4 PATH_ROOT "_DIR4_/" |
| #define | PATH_DIR5 PATH_DIR1 "_DIR5_/" |
| #define | PATH_FILE1 PATH_ROOT "_FILE1_.TXT" |
| #define | PATH_FILE2 PATH_DIR3 "_FILE2_.CSV" |
| #define | BUFFER_SIZE 256 |
Functions | |
| void | microsd_check_card_detection (microsd_t *ctx) |
| microSD check card detection function. | |
| void | microsd_display_directory (uint8_t *dir_path) |
| microSD display directory function. | |
| void | microsd_create_directory (uint8_t *dir_path) |
| microSD create directory function. | |
| void | microsd_remove_path (uint8_t *path) |
| microSD remove path function. | |
| void | microsd_rename_path (uint8_t *old_path, uint8_t *new_path) |
| microSD rename path function. | |
| void | microsd_create_file (uint8_t *file_path) |
| microSD create file function. | |
| void | microsd_write_to_file (uint8_t *file_path, uint8_t *data_in, uint32_t data_len) |
| microSD write to file function. | |
| void | microsd_copy_file (uint8_t *src_file_path, uint8_t *dst_file_path) |
| microSD copy file function. | |
| void | microsd_format_drive (uint8_t *path) |
| microSD format drive function. | |
| void | microsd_mount_drive (microsd_t *ctx, uint8_t *path) |
| microSD mount drive function. | |
| void | microsd_unmount_drive (uint8_t *path) |
| microSD unmount drive function. | |
| void | application_init (void) |
| void | application_task (void) |
| int | main (void) |
microSD Click example
This example demonstrates a basic file system functionality and operations with files and directories using a microSD Click board.
The demo application is composed of two sections :
Initializes the driver and logger and performs a several operations with file system that demonstrates the basic usage of microSD Click board.
Reads and displays on the USB UART the contents of all directories created during application init.
| #define BUFFER_SIZE 256 |
| #define FORMAT_CARD 0 |
| #define PATH_DIR1 PATH_ROOT "_DIR1_/" |
| #define PATH_DIR2 PATH_DIR1 "_DIR2_/" |
| #define PATH_DIR3 PATH_DIR1 "_DIR3_/" |
| #define PATH_DIR4 PATH_ROOT "_DIR4_/" |
| #define PATH_DIR5 PATH_DIR1 "_DIR5_/" |
| #define PATH_FILE1 PATH_ROOT "_FILE1_.TXT" |
| #define PATH_FILE2 PATH_DIR3 "_FILE2_.CSV" |
| #define PATH_ROOT "3:/" |
| void application_init | ( | void | ) |
< Logger config object.
< Click config object.
Logger initialization. Default baud rate: 115200 Default log level: LOG_LEVEL_DEBUG
| void application_task | ( | void | ) |
| int main | ( | void | ) |
| void microsd_check_card_detection | ( | microsd_t * | ctx | ) |
microSD check card detection function.
This function checks and waits for a microSD card to be inserted to the Click board.
| [in] | ctx | : Click context object. See microsd_t object definition for detailed explanation. |
| void microsd_copy_file | ( | uint8_t * | src_file_path, |
| uint8_t * | dst_file_path ) |
microSD copy file function.
This function copies the content of a file from the selected absolute path specified by the src_file_path parameter, to the absolute path specified by the dst_file_path parameter.
| [in] | src_file_path | : The source file absolute path. |
| [in] | dst_file_path | : The destination file absolute path. |
| void microsd_create_directory | ( | uint8_t * | dir_path | ) |
microSD create directory function.
This function creates a new directory at the selected absolute path. The path should contain a name of the directory to be created.
| [in] | dir_path | : The absolute path to the directory to be created. |
| void microsd_create_file | ( | uint8_t * | file_path | ) |
microSD create file function.
This function creates a new file at the selected absolute path. The path should contain a name of the file to be created.
| [in] | file_path | : The absolute path to the file to be created. |
| void microsd_display_directory | ( | uint8_t * | dir_path | ) |
microSD display directory function.
This function reads and displays the content of the directory at the selected path.
| [in] | dir_path | : The absolute path to the directory to be displayed. |
| void microsd_format_drive | ( | uint8_t * | path | ) |
microSD format drive function.
This function formats the logical drive previously mounted to file system with identifying drive number.
| [in] | path | : The ROOT path of drive to be formatted. |
| void microsd_mount_drive | ( | microsd_t * | ctx, |
| uint8_t * | path ) |
microSD mount drive function.
This function mounts the initialized logical drive to the initialized physical drive and overall file system.
| [in] | ctx | : Click context object. See microsd_t object definition for detailed explanation. |
| [in] | path | : The ROOT path of drive to be mounted. |
| void microsd_remove_path | ( | uint8_t * | path | ) |
microSD remove path function.
This function removes a file or a directory from the selected absolute path.
| [in] | path | : The absolute path to the file or directory to be removed. |
| void microsd_rename_path | ( | uint8_t * | old_path, |
| uint8_t * | new_path ) |
microSD rename path function.
This function renames a file or a directory from the selected absolute path specified by the old_path parameter, to the absolute path specified by the new_path parameter.
| [in] | old_path | : The old path to the file or directory to be renamed. |
| [in] | new_path | : The new path to the file or directory. |
| void microsd_unmount_drive | ( | uint8_t * | path | ) |
microSD unmount drive function.
This function unmounts the mounted logical drive from the file system.
| [in] | path | : The ROOT path of drive to be unmounted. |
| void microsd_write_to_file | ( | uint8_t * | file_path, |
| uint8_t * | data_in, | ||
| uint32_t | data_len ) |
microSD write to file function.
This function writes a desired number of data bytes to the end of file at the selected absolute path.
| [in] | file_path | : The absolute path to the file. |
| [in] | data_in | : The data buffer to be written. |
| [in] | data_len | : Number of data bytes to be written. |