Lines Matching full:the
9 identifier letter. For example, if an SD card is associated with the letter
15 If you want to skip the drive-letter prefix in Unix-like paths, you can use the
23 LVGL contains prepared drivers for the API of POSIX, standard C,
35 This identifier is merely a way for the LVGL File System abtraction logic to look up
36 the appropriate registered file-system driver for a given path.
41 letter must be unique among all registered file-system drivers, and in the range [A-Z]
42 or the character '/'. See :ref:`lv_fs_adding_a_driver` for how this is done.
44 Later, when using paths to files on your file system, you prefix the path with that
53 Let's use the letter 'Z' as the identifier character, and "path_to_file" as the path,
54 then the path strings you pass to ``lv_fs_...()`` functions would look like this::
59 | +-- This part gets passed to the OS-level file-system functions.
61 +-- This part LVGL strips from path string, and uses it to find the appropriate
64 Note also that the path can be a relative path or a "rooted path" (beginning with
65 ``/``), though rooted paths are recommended since the driver does not yet provide a
66 way to set the default directory.
78 - "Z:/Users/me/wip/proposal.txt" (if the default drive is known to be C:)
82 Reminder: Note carefully that the prefixed "Z:" has nothing to do with the "C:" and
83 "D:" Windows/DOS drive letters in 3 of the above examples, which are part of the path.
84 "Z:" is used to look up the driver for that file system in the list of all file-system
98 registered in a way similar to the code below. The :cpp:type:`lv_fs_drv_t` variable
100 its contents need to remain valid as long as the driver is in use.
107 drv.letter = 'S'; /* An uppercase letter to identify the drive */
110 drv.ready_cb = my_ready_cb; /* Callback to tell if the drive is ready to use */
116 drv.tell_cb = my_tell_cb; /* Callback to tell the cursor position */
124 lv_fs_drv_register(&drv); /* Finally register the drive */
126 Any of the callbacks can be ``NULL`` to indicate that operation is not
129 Implementing the callbacks
135 The prototype of ``open_cb`` looks like this:
141 ``path`` is the path after the drive letter (e.g. "S:path/to/file.txt" -> "path/to/file.txt").
144 The return value is a pointer to a *file object* that describes the
145 opened file or ``NULL`` if there were any issues (e.g. the file wasn't
146 found). The returned file object will be passed to other file system
152 The other callbacks are quite similar. For example ``write_cb`` looks
159 For ``file_p``, LVGL passes the return value of ``open_cb``, ``buf`` is
160 the data to write, ``btw`` is the number of "bytes to write", ``bw`` is the number of
161 "bytes written" (written to during the function call).
165 This file also provides a template for new file-system drivers you can use if the
171 As of this writing, the list of already-available file-system drivers can be enabled
172 by setting one or more of the following macros to a non-zero value in ``lv_conf.h``.
173 The drivers are as implied by the macro names.
191 If you are using one of the following file-system drivers:
198 can use to provide a path that gets dynamically prefixed to the ``path_to_file``
199 portion of of the path strings provided to ``lv_fs_...()`` functions when files and
201 portion of a path can be typed by an end user), or simply to reduce the length of the
204 Do this by filling in the full path to the directory you wish his access to be
205 limited to in the applicable ``LV_FS_xxx_PATH`` macro in ``lv_conf.h``. Do not
206 prefix the path with the driver-identifier letter, and do append a directory
207 separator character at the end.
221 Then in both cases, path strings passed to ``lv_fs_...()`` functions in the
231 The example below shows how to read from a file:
247 The mode in :cpp:func:`lv_fs_open` can be :cpp:enumerator:`LV_FS_MODE_WR` to open for
251 This example shows how to read a directory's content. It's up to the
252 driver how to mark directories in the result but it can be a good
286 variables stored in the compiled program).
288 To use files in Image Widgets the following callbacks are required:
303 Files will buffer their reads if the corresponding ``LV_FS_*_CACHE_SIZE``
305 buffer up to that many bytes to reduce the number of FS driver calls.
308 of access patterns. The one implemented here is optimal for reading large
309 files in chunks, which is what the image decoder does.
310 It has the potential to call the driver's ``read`` fewer
311 times than ``lv_fs_read`` is called. In the best case where the cache size is
312 \>= the size of the file, ``read`` will only be called once. This strategy is good
313 …reading of large files but less helpful for short random reads across a file bigger than the buffer
314 since data will be buffered that will be discarded after the next seek and read.
315 The cache should be sufficiently large or disabled in that case. Another case where the cache shoul…
316 is if the file contents are expected to change by an external factor like with special OS files.
318 The implementation is documented below. Note that the FS functions make calls
319 to other driver FS functions when the cache is enabled. i.e., ``lv_fs_read`` may call the driver's …
320 so the driver needs to implement more callbacks when the cache is enabled.
331 the cache is enabled"] --> B{{"is there cached data
332 at the file position?"}}
333 B -->|yes| C{{"does the cache have
336 the cache to the destination
338 C -->|no| F["copy the available
340 until the end of the cache
341 into the destination buffer"]
342 --> G["seek the real file to the end
343 of what the cache had available"]
344 --> H{{"is the number of remaining bytes
345 larger than the size of the whole cache?"}}
346 H -->|yes| I["read the remaining bytes
347 from the real file to the
349 H -->|no| J["eagerly read the real file
350 to fill the whole cache
351 or as many bytes as the
353 --> O["copy the required bytes
354 to the destination buffer"]
355 B -->|no| K["seek the real file to
356 the file position"]
357 --> L{{"is the number of required
358 bytes greater than the
359 size of the entire cache?"}}
360 L -->|yes| M["read the real file to
361 the destination buffer"]
362 L -->|no| N["eagerly read the real file
363 to fill the whole cache
364 or as many bytes as the
366 --> P["copy the required bytes
367 to the destination buffer"]
372 The part of the cache that coincides with the written content
373 will be updated to reflect the written content.
378 The driver's ``seek`` will not actually be called unless the ``whence``
380 to determine where the end of the file is.
385 The driver's ``tell`` will not actually be called.