Feat(docs): proofread docs batch17 (#7680)

This commit is contained in:
Victor Wheeler
2025-02-03 15:59:05 -07:00
committed by GitHub
parent b7d2eb159a
commit c5f888235d
6 changed files with 91 additions and 68 deletions

View File

@@ -7,7 +7,7 @@ Arduino ESP littlefs
LittleFS is a little fail-safe filesystem designed for microcontrollers and integrated in the Arduino framework LittleFS is a little fail-safe filesystem designed for microcontrollers and integrated in the Arduino framework
when used with ESP32 and ESP8266. when used with ESP32 and ESP8266.
Detailed introduction: For a detailed introduction, see:
- https://github.com/esp8266/Arduino - https://github.com/esp8266/Arduino
- https://github.com/espressif/arduino-esp32 - https://github.com/espressif/arduino-esp32

View File

@@ -4,11 +4,11 @@
Arduino SD Arduino SD
========== ==========
Enables reading and writing on SD cards. Enables reading from and writing to SD cards.
Once an SD memory card is connected to the SPI interface of the Arduino or Genuino board you can create files Once an SD memory card is connected to the SPI interface of the Arduino or Genuino board, you can create files
and read/write on them. You can also move through directories on the SD card.. and read from, and write to them. You can also move through directories on the SD card.
Detailed introduction: For a detailed introduction, see:
- https://www.arduino.cc/reference/en/libraries/sd/ - https://www.arduino.cc/reference/en/libraries/sd/

View File

@@ -4,47 +4,55 @@
Barcode Barcode
======= =======
Barcode generation with LVGL. Uses The LVGL Barcode utility enables you to generate Code-128 bar codes. It uses the
`code128 <https://github.com/fhunleth/code128>`__ by `code128 <https://github.com/fhunleth/code128>`__ library by
`fhunleth <https://github.com/fhunleth>`__. `fhunleth <https://github.com/fhunleth>`__.
.. _barcode_usage: .. _barcode_usage:
Usage Usage
----- *****
Enable :c:macro:`LV_USE_BARCODE` in ``lv_conf.h``. Set :c:macro:`LV_USE_BARCODE` to ``1`` in ``lv_conf.h``.
Use :cpp:func:`lv_barcode_create` to create a barcode object, and use Use :cpp:func:`lv_barcode_create` to create a barcode object, and use
:cpp:func:`lv_barcode_update` to generate a barcode. :cpp:func:`lv_barcode_update` to generate a barcode.
Call :cpp:func:`lv_barcode_set_scale` to adjust scaling, Call :cpp:func:`lv_barcode_set_scale` to adjust scaling,
call :cpp:func:`lv_barcode_set_dark_color` and :cpp:func:`lv_barcode_set_light_color` call :cpp:func:`lv_barcode_set_dark_color` and :cpp:func:`lv_barcode_set_light_color`
adjust color, call :cpp:func:`lv_barcode_set_direction` will set adjust colors. Call :cpp:func:`lv_barcode_set_direction` to set the bar code's
direction to display, and call :cpp:func:`lv_barcode_update` again to regenerate orientation. After any of a bar code's settings have changed, call
the barcode. :cpp:func:`lv_barcode_update` again to regenerate it.
Notes Notes
----- *****
- It is best not to manually set the width of the barcode, because when - It is best not to manually set the width of the barcode, because when
the width of the Widget is lower than the width of the barcode, the the width of the Widget is lower than the width of the barcode, the
display will be incomplete due to truncation. display will be incomplete due to truncation.
- The scale adjustment can only be an integer multiple, for example, - The scale adjustment can only be an integer multiple, for example,
:cpp:expr:`lv_barcode_set_scale(barcode, 2)` means 2x scaling. :cpp:expr:`lv_barcode_set_scale(barcode, 2)` means 2x scaling.
- The direction adjustment can be :cpp:enumerator:`LV_DIR_HOR` or :cpp:enumerator:`LV_DIR_VER` - The direction setting can be :cpp:enumerator:`LV_DIR_HOR` or :cpp:enumerator:`LV_DIR_VER`.
.. _barcode_example: .. _barcode_example:
Example Example
------- *******
.. include:: ../../examples/libs/barcode/index.rst .. include:: ../../examples/libs/barcode/index.rst
.. _barcode_api: .. _barcode_api:
API API
--- ***
:ref:`code128_h` :ref:`code128_h`

View File

@@ -1,54 +1,60 @@
.. _bmp: .. _bmp:
=========== ===========
BMP decoder BMP Decoder
=========== ===========
This extension allows the use of BMP images in LVGL. This BMP Decoder utility allows you to use images from .BMP files in LVGL.
Library source: https://github.com/caj-johnson/bmp-decoder Library source: https://github.com/caj-johnson/bmp-decoder
The pixels are read on demand (not the whole image is loaded) Instead of loading the whole image at once, BMP pixels are read on demand,
so using BMP images requires very little RAM. so using BMP images requires very little RAM.
If enabled in ``lv_conf.h`` by :c:macro:`LV_USE_BMP` LVGL will register a new If enabled in ``lv_conf.h`` by setting :c:macro:`LV_USE_BMP` to ``1``, LVGL will
image decoder automatically so BMP files can be directly used as image register a new image decoder automatically so BMP files can be directly used as image
sources. For example: sources. Example:
.. code-block:: c .. code-block:: c
lv_image_set_src(my_img, "S:path/to/picture.bmp"); lv_image_set_src(my_img, "S:path/to/picture.bmp");
Note that, a file system driver needs to registered to open images from Note that, a :ref:`file_system` driver needs to registered to open images from
files. Read more about it :ref:`overview_file_system` or just files. Follow the instructions in :ref:`file_system`.
enable one in ``lv_conf.h`` with ``LV_USE_FS_...``
.. _bmp_limitations: .. _bmp_limitations:
Limitations Limitations
----------- ***********
- Only BMP files are supported and BMP images as C array - Only BMP files are supported. BMP images as C arrays
(:c:struct:`lv_image_dsc_t`) are not. It's because there is no practical (:c:struct:`lv_image_dsc_t`) are not. This is because there is no practical
differences between how the BMP files and LVGL's image format stores differences between how the BMP files and LVGL's image format stores
the image data. the image data.
- BMP files can be loaded only from file. If you want to store them in - BMP files can be loaded only from .BMP files. If you want to store them in
flash it's better to convert them to C array with `LVGL's image converter <https://lvgl.io/tools/imageconverter>`__. flash it's better to convert them to a C array with `LVGL's image converter <https://lvgl.io/tools/imageconverter>`__.
- The BMP files color format needs to match with :c:macro:`LV_COLOR_DEPTH`. - The BMP file's color format needs to match the configured :c:macro:`LV_COLOR_DEPTH`
Use GIMP to save the image in the required format. Both RGB888 and of the display on which it will be rendered. You can use GIMP to save the image
ARGB888 works with :c:macro:`LV_COLOR_DEPTH` ``32`` in the required format. Both RGB888 and ARGB888 works with
- Palette is not supported. :c:macro:`LV_COLOR_DEPTH` ``32``
- Because not the whole image is read in cannot be zoomed or rotated. - Color palettes are not supported.
- Because the whole image is not loaded, it cannot be zoomed or rotated.
.. _bmp_example: .. _bmp_example:
Example Example
------- *******
.. include:: ../../examples/libs/bmp/index.rst .. include:: ../../examples/libs/bmp/index.rst
.. _bmp_api: .. _bmp_api:
API API
--- ***

View File

@@ -1,4 +1,4 @@
.. _overview_file_system: .. _file_system:
======================= =======================
File System (lv_fs_drv) File System (lv_fs_drv)

View File

@@ -4,37 +4,40 @@
Snapshot Snapshot
======== ========
Snapshot provides API to take snapshot image for LVGL Widget together Snapshot provides an API to take a snapshot image for an LVGL Widget together
with its children. The image will look exactly like the Widget on display. with its children. The image will look exactly like the Widget on the display.
.. _snapshot_usage: .. _snapshot_usage:
Usage Usage
----- *****
Simply call API :cpp:func:`lv_snapshot_take` to generate the image descriptor Simply call function :cpp:expr:`lv_snapshot_take(widget, color_format)` to generate
which can be set as image Widget src using :cpp:func:`lv_image_set_src`. the image descriptor which can be used as an Image Widget's image source using
:cpp:func:`lv_image_set_src`.
Note, only following color formats are supported for now: Note, only following color formats are supported at this time:
- :cpp:enumerator:`LV_COLOR_FORMAT_RGB565` - :cpp:enumerator:`LV_COLOR_FORMAT_RGB565`
- :cpp:enumerator:`LV_COLOR_FORMAT_RGB888` - :cpp:enumerator:`LV_COLOR_FORMAT_RGB888`
- :cpp:enumerator:`LV_COLOR_FORMAT_XRGB8888` - :cpp:enumerator:`LV_COLOR_FORMAT_XRGB8888`
- :cpp:enumerator:`LV_COLOR_FORMAT_ARGB8888` - :cpp:enumerator:`LV_COLOR_FORMAT_ARGB8888`
Free the Image Freeing the Image
~~~~~~~~~~~~~~ -----------------
The memory :cpp:func:`lv_snapshot_take` uses are dynamically allocated using The memory :cpp:func:`lv_snapshot_take` uses is dynamically allocated using
:cpp:func:`lv_draw_buf_create`. Use API :cpp:func:`lv_draw_buf_destroy` to free the memory it :cpp:func:`lv_draw_buf_create`. Use :cpp:func:`lv_draw_buf_destroy` to free the
takes. This will firstly free memory the image data takes, then the memory it allocated.
image descriptor.
The snapshot image which is the draw buffer returned by :cpp:func:`lv_snapshot_take` The snapshot image which is the draw buffer returned by :cpp:func:`lv_snapshot_take`
normally won't be added to cache because it can be drawn directly. So you don't need normally won't be added to the cache because it can be drawn directly. So you don't need
to invalidate cache by :cpp:func:`lv_image_cache_drop` before destroy the draw buffer. to invalidate the cache by calling :cpp:func:`lv_image_cache_drop` before destroying
the draw buffer.
Below code snippet explains usage of this API. The below code snippet demonstrates correct use of :cpp:func:`lv_snapshot_take`:
.. code-block:: c .. code-block:: c
@@ -48,30 +51,36 @@ Below code snippet explains usage of this API.
lv_image_set_src(img_snapshot, snapshot); lv_image_set_src(img_snapshot, snapshot);
} }
Use Existing Buffer Using an Existing Buffer
~~~~~~~~~~~~~~~~~~~ ------------------------
If the snapshot needs update now and then, or simply caller provides memory, use API If the snapshot needs to be updated repeatedly, or if the caller provides the draw
``lv_result_t lv_snapshot_take_to_draw_buf(lv_obj_t * widget, lv_color_format_t cf, lv_draw_buf_t * draw_buf);`` buffer, use :cpp:expr:`lv_snapshot_take_to_draw_buf(widget, color_format, draw_buf)`.
for this case. It's caller's responsibility to create and destroy the draw buffer. In this case, the caller is responsible for creating and destroying the draw buffer.
If snapshot is generated successfully, the image descriptor is updated,
the image data will be stored to the provided ``draw_buf``, and the function will
return :cpp:enumerator:`LV_RESULT_OK`.
Note that snapshot may fail if the provided buffer is not large enough, which can
happen if the Widget's size changes. It's recommended to use
:cpp:expr:`lv_snapshot_reshape_draw_buf(widget, draw_buf)` to first ensure the buffer
is large enough, and if it fails, destroy the existing draw buffer and call
`lv_snapshot_take` directly.
If snapshot is generated successfully, the image descriptor is updated
and image data will be stored to provided ``buf``.
Note that snapshot may fail if provided buffer is not enough, which may
happen when Widget size changes. It's recommended to use API
:cpp:func:`lv_snapshot_reshape_draw_buf` to prepare the buffer firstly and if it
fails, destroy the existing draw buffer and call `lv_snapshot_take` directly.
.. _snapshot_example: .. _snapshot_example:
Example Example
------- *******
.. include:: ../../examples/others/snapshot/index.rst .. include:: ../../examples/others/snapshot/index.rst
.. _snapshot_api: .. _snapshot_api:
API API
--- ***