ZEReader 0.1.0
A Zephyr-based E-Book-Reader
Loading...
Searching...
No Matches
sd.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2025 Anna-Lena Marx <mail@marx.engineer>
3 *
4 * SPDX-License-Identifier: MPL-2.0
5 */
6
7#ifndef _SD_H_
8#define _SD_H_
9
10#include <stddef.h>
11#include <zephyr/fs/fs.h>
12
20
21#define SD_MOUNTPOINT "/SD:"
22#define SD_ROOTPATH "/SD:/"
23
35char *sd_build_full_path(const char *folder, const char *filename, int *error);
36
43int sd_initialize(void);
44
53int sd_open(char const *const path, struct fs_file_t *f_obj);
54
62int sd_close(struct fs_file_t *f_obj);
63
73int sd_read(struct fs_file_t *f_obj, char *buffer, size_t *size);
74
85int sd_read_chunk(char const *const path, size_t *offset, char *const buffer, size_t *size);
86
87// int sd_write();
88
98int sd_write_chunk(char const *const path, char const *const data, size_t *size);
99
109int sd_list_directories(char const *const path, char *buffer, size_t *size);
110
119int sd_tell_end_offset(char const *const path, size_t *offset);
120
122#endif
int sd_open(char const *const path, struct fs_file_t *f_obj)
Open a file on a SD card.
int sd_list_directories(char const *const path, char *buffer, size_t *size)
List the directories on the SD card.
int sd_read(struct fs_file_t *f_obj, char *buffer, size_t *size)
Read from a file on a SD card.
int sd_close(struct fs_file_t *f_obj)
Close a file on a SD card.
int sd_read_chunk(char const *const path, size_t *offset, char *const buffer, size_t *size)
Open, read from a file on SD card and close it.
int sd_initialize(void)
Initializes the SD card communication.
int sd_write_chunk(char const *const path, char const *const data, size_t *size)
Open, write to a file on SD card and close it.
int sd_tell_end_offset(char const *const path, size_t *offset)
Get the current location of the file pointer inside the file.
char * sd_build_full_path(const char *folder, const char *filename, int *error)
Returns a char pointer on the fully built-up SD card path.