You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -21,47 +21,132 @@ This module is primarily used for packaging assets (such as images, fonts, etc.)
21
21
5.**LVGL-Specific Binary Format Support**:
22
22
- Supports image conversion to binary files required by LVGL, ensuring compatibility with the LVGL graphics library and optimizing performance for display rendering.
23
23
24
+
## Add to Project
24
25
25
-
## Add to project
26
+
Packages from this repository are uploaded to [Espressif's component service](https://components.espressif.com/). You can add them to your project via `idf.py add-dependency`, e.g.
26
27
27
-
Packages from this repository are uploaded to [Espressif's component service](https://components.espressif.com/).
28
-
You can add them to your project via `idf.py add-dependancy`, e.g.
29
-
```
30
-
idf.py add-dependency esp_mmap_assets
28
+
```sh
29
+
idf.py add-dependency esp_mmap_assets
31
30
```
32
31
33
-
Alternatively, you can create `idf_component.yml`. More is in [Espressif's documentation](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-component-manager.html).
32
+
Alternatively, you can create `idf_component.yml`. More details are available in [Espressif's documentation](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-component-manager.html).
34
33
35
34
## Usage
36
35
37
36
### CMake
38
-
Optionally, users can opt to have the image automatically flashed together with the app binaries, partition tables, etc. on idf.py flash by specifying FLASH_IN_PROJECT. For example:
37
+
38
+
The following options are supported. These options allow you to configure various aspects of image handling.
39
+
39
40
```c
41
+
set(options
42
+
FLASH_IN_PROJECT,
43
+
FLASH_APPEND_APP,
44
+
MMAP_SUPPORT_SJPG,
45
+
MMAP_SUPPORT_SPNG,
46
+
MMAP_SUPPORT_QOI,
47
+
MMAP_SUPPORT_SQOI,
48
+
MMAP_SUPPORT_RAW,
49
+
MMAP_RAW_DITHER,
50
+
MMAP_RAW_BGR_MODE)
51
+
```
52
+
53
+
```c
54
+
set(one_value_args
55
+
MMAP_FILE_SUPPORT_FORMAT,
56
+
MMAP_SPLIT_HEIGHT,
57
+
MMAP_RAW_FILE_FORMAT)
58
+
```
59
+
60
+
### Option Explanations
61
+
62
+
#### General Options
63
+
64
+
-**`FLASH_IN_PROJECT`**: Users can opt to have the image automatically flashed together with the app binaries, partition tables, etc. on `idf.py flash`
65
+
-**`FLASH_APPEND_APP`**: Enables appending binary data (`bin`) to the application binary (`app_bin`).
-**`MMAP_SPLIT_HEIGHT`**: Defines height for image splitting to reduce memory usage. Depends on:
68
+
-`MMAP_SUPPORT_SJPG`
69
+
-`MMAP_SUPPORT_SPNG`
70
+
-`MMAP_SUPPORT_SQOI`
71
+
72
+
##### General demo
73
+
74
+
```c
40
75
spiffs_create_partition_assets(
41
76
my_spiffs_partition
42
77
my_folder
43
78
FLASH_IN_PROJECT
44
-
MMAP_FILE_SUPPORT_FORMAT ".png"
45
-
MMAP_SUPPORT_QOI
46
-
MMAP_SUPPORT_SQOI
47
-
MMAP_SPLIT_HEIGHT 16)
48
-
```
49
-
Additionally, the following options are supported. These options allow you to configure various aspects of image handling, such as enabling support for different formats (SJPG, SPNG, QOI, SQOI, RAW), and controlling how RAW images are processed.
50
-
```c
51
-
set(options FLASH_IN_PROJECT, // Defines storage type (flash in project)
52
-
MMAP_SUPPORT_SJPG, // Enable support for SJPG format
53
-
MMAP_SUPPORT_SPNG, // Enable support for SPNG format
54
-
MMAP_SUPPORT_QOI, // Enable support for QOI format
55
-
MMAP_SUPPORT_SQOI, // Enable support for SQOI format
56
-
MMAP_SUPPORT_RAW, // Enable support for RAW format (LVGL conversion only)
57
-
MMAP_RAW_DITHER, // Enable dithering for RAW images (LVGL conversion only)
58
-
MMAP_RAW_BGR_MODE) // Enable BGR mode for RAW images (LVGL conversion only)
59
-
60
-
set(one_value_args MMAP_FILE_SUPPORT_FORMAT, // Specify supported file format (e.g., .png, .jpg)
61
-
MMAP_SPLIT_HEIGHT, // Define the height for image splitting
62
-
MMAP_RAW_FILE_FORMAT) // Specify the file format for RAW images (LVGL conversion only)
79
+
MMAP_FILE_SUPPORT_FORMAT ".jpg,.png,.ttf"
80
+
)
81
+
```
63
82
64
-
```
83
+
#### Supported Image Formats
84
+
85
+
-**`MMAP_SUPPORT_SJPG`**: Enables support for **SJPG** format.
86
+
-**`MMAP_SUPPORT_SPNG`**: Enables support for **SPNG** format.
87
+
-**`MMAP_SUPPORT_QOI`**: Enables support for **QOI** format.
88
+
-**`MMAP_SUPPORT_SQOI`**: Enables support for **SQOI** format. Depends on:
89
+
-`MMAP_SUPPORT_QOI`
90
+
91
+
##### Image Splitting Demo
92
+
93
+
```c
94
+
spiffs_create_partition_assets(
95
+
my_spiffs_partition
96
+
my_folder
97
+
FLASH_IN_PROJECT
98
+
MMAP_FILE_SUPPORT_FORMAT ".jpg"
99
+
MMAP_SUPPORT_SJPG
100
+
MMAP_SPLIT_HEIGHT 16
101
+
)
102
+
```
103
+
104
+
#### LVGL Bin Support
105
+
106
+
-**`MMAP_SUPPORT_RAW`**: Converts images to LVGL-supported **Binary** data.
ESP_LOGD(TAG, "The storage free size is %ld KB", storage_size / 1024);
92
-
ESP_LOGD(TAG, "The partition size is %ld KB", partition->size / 1024);
93
-
ESP_GOTO_ON_FALSE((storage_size>partition->size), ESP_ERR_INVALID_SIZE, err, TAG, "The free size is less than %s partition required", partition->label);
116
+
ESP_LOGD(TAG, "The partition size is %ld KB", size / 1024);
117
+
ESP_GOTO_ON_FALSE((storage_size>size), ESP_ERR_INVALID_SIZE, err, TAG, "The free size is less than %s partition required", partition->label);
0 commit comments