chore(style): remove the trailing space from all source files (#3188)
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
```eval_rst
|
||||
.. include:: /header.rst
|
||||
.. include:: /header.rst
|
||||
:github_url: |github_link_base|/porting/display.md
|
||||
```
|
||||
# Display interface
|
||||
@@ -10,7 +10,7 @@ To register a display for LVGL, a `lv_disp_draw_buf_t` and a `lv_disp_drv_t` var
|
||||
|
||||
## Draw buffer
|
||||
|
||||
Draw buffer(s) are simple array(s) that LVGL uses to render the screen content.
|
||||
Draw buffer(s) are simple array(s) that LVGL uses to render the screen content.
|
||||
Once rendering is ready the content of the draw buffer is sent to the display using the `flush_cb` function set in the display driver (see below).
|
||||
|
||||
A draw buffer can be initialized via a `lv_disp_draw_buf_t` variable like this:
|
||||
@@ -31,7 +31,7 @@ Note that `lv_disp_draw_buf_t` must be a static, global or dynamically allocated
|
||||
As you can see above, the draw buffer may be smaller than the screen. In this case, larger areas are redrawn in smaller segments that fit into the draw buffer(s).
|
||||
If only a small area changes (e.g. a button is pressed) then only that area will be refreshed.
|
||||
|
||||
A larger buffer results in better performance but above 1/10 screen sized buffer(s) there is no significant performance improvement.
|
||||
A larger buffer results in better performance but above 1/10 screen sized buffer(s) there is no significant performance improvement.
|
||||
Therefore it's recommended to choose the size of the draw buffer(s) to be at least 1/10 screen sized.
|
||||
|
||||
## Buffering modes
|
||||
@@ -41,25 +41,25 @@ There are several settings to adjust the number draw buffers and buffering/refre
|
||||
You can measure the performance of different configurations using the [benchmark example](https://github.com/lvgl/lv_demos/tree/master/src/lv_demo_benchmark).
|
||||
|
||||
### One buffer
|
||||
If only one buffer is used LVGL draws the content of the screen into that draw buffer and sends it to the display.
|
||||
If only one buffer is used LVGL draws the content of the screen into that draw buffer and sends it to the display.
|
||||
LVGL then needs to wait until the content of the buffer is sent to the display before drawing something new in it.
|
||||
|
||||
### Two buffers
|
||||
If two buffers are used LVGL can draw into one buffer while the content of the other buffer is sent to the display in the background.
|
||||
If two buffers are used LVGL can draw into one buffer while the content of the other buffer is sent to the display in the background.
|
||||
DMA or other hardware should be used to transfer data to the display so the MCU can continue drawing.
|
||||
This way, the rendering and refreshing of the display become parallel operations.
|
||||
This way, the rendering and refreshing of the display become parallel operations.
|
||||
|
||||
### Full refresh
|
||||
In the display driver (`lv_disp_drv_t`) enabling the `full_refresh` bit will force LVGL to always redraw the whole screen. This works in both *one buffer* and *two buffers* modes.
|
||||
If `full_refresh` is enabled and two screen sized draw buffers are provided, LVGL's display handling works like "traditional" double buffering.
|
||||
If `full_refresh` is enabled and two screen sized draw buffers are provided, LVGL's display handling works like "traditional" double buffering.
|
||||
This means the `flush_cb` callback only has to update the address of the framebuffer (`color_p` parameter).
|
||||
This configuration should be used if the MCU has an LCD controller peripheral and not with an external display controller (e.g. ILI9341 or SSD1963) accessed via serial link. The latter will generally be too slow to maintain high frame rates with full screen redraws.
|
||||
|
||||
### Direct mode
|
||||
If the `direct_mode` flag is enabled in the display driver LVGL will draw directly into a **screen sized frame buffer**. That is the draw buffer(s) needs to be screen sized.
|
||||
If the `direct_mode` flag is enabled in the display driver LVGL will draw directly into a **screen sized frame buffer**. That is the draw buffer(s) needs to be screen sized.
|
||||
It this case `flush_cb` will be called only once when all dirty areas are redrawn.
|
||||
With `direct_mode` the frame buffer always contains the current frame as it should be displayed on the screen.
|
||||
If 2 frame buffers are provided as draw buffers LVGL will alter the buffers but always draw only the dirty areas.
|
||||
With `direct_mode` the frame buffer always contains the current frame as it should be displayed on the screen.
|
||||
If 2 frame buffers are provided as draw buffers LVGL will alter the buffers but always draw only the dirty areas.
|
||||
Therefore the 2 buffers needs to synchronized in `flush_cb` like this:
|
||||
1. Display the frame buffer pointed by `color_p`
|
||||
2. Copy the redrawn areas from `color_p` to the other buffer.
|
||||
@@ -77,18 +77,18 @@ Once the buffer initialization is ready a `lv_disp_drv_t` display driver needs t
|
||||
2. its fields need to be set
|
||||
3. it needs to be registered in LVGL with `lv_disp_drv_register(&disp_drv)`
|
||||
|
||||
Note that `lv_disp_drv_t` also needs to be a static, global or dynamically allocated variable.
|
||||
Note that `lv_disp_drv_t` also needs to be a static, global or dynamically allocated variable.
|
||||
|
||||
### Mandatory fields
|
||||
In the most simple case only the following fields of `lv_disp_drv_t` need to be set:
|
||||
- `draw_buf` pointer to an initialized `lv_disp_draw_buf_t` variable.
|
||||
- `hor_res` horizontal resolution of the display in pixels.
|
||||
- `hor_res` horizontal resolution of the display in pixels.
|
||||
- `ver_res` vertical resolution of the display in pixels.
|
||||
- `flush_cb` a callback function to copy a buffer's content to a specific area of the display.
|
||||
`lv_disp_flush_ready(&disp_drv)` needs to be called when flushing is ready.
|
||||
- `flush_cb` a callback function to copy a buffer's content to a specific area of the display.
|
||||
`lv_disp_flush_ready(&disp_drv)` needs to be called when flushing is ready.
|
||||
LVGL might render the screen in multiple chunks and therefore call `flush_cb` multiple times. To see if the current one is the last chunk of rendering use `lv_disp_flush_is_last(&disp_drv)`.
|
||||
|
||||
### Optional fields
|
||||
### Optional fields
|
||||
There are some optional display driver data fields:
|
||||
- `physical_hor_res` horizontal resolution of the full / physical display in pixels. Only set this when _not_ using the full screen (defaults to -1 / same as `hor_res`).
|
||||
- `physical_ver_res` vertical resolution of the full / physical display in pixels. Only set this when _not_ using the full screen (defaults to -1 / same as `ver_res`).
|
||||
@@ -107,7 +107,7 @@ Some other optional callbacks to make it easier and more optimal to work with mo
|
||||
It can be used if the display controller can refresh only areas with specific height or width (usually 8 px height with monochrome displays).
|
||||
- `set_px_cb` a custom function to write the draw buffer. It can be used to store the pixels more compactly in the draw buffer if the display has a special color format. (e.g. 1-bit monochrome, 2-bit grayscale etc.)
|
||||
This way the buffers used in `lv_disp_draw_buf_t` can be smaller to hold only the required number of bits for the given area size. Note that rendering with `set_px_cb` is slower than normal rendering.
|
||||
- `monitor_cb` A callback function that tells how many pixels were refreshed and in how much time. Called when the last chunk is rendered and sent to the display.
|
||||
- `monitor_cb` A callback function that tells how many pixels were refreshed and in how much time. Called when the last chunk is rendered and sent to the display.
|
||||
- `clean_dcache_cb` A callback for cleaning any caches related to the display.
|
||||
|
||||
LVGL has built-in support to several GPUs (see `lv_conf.h`) but if something else is required these functions can be used to make LVGL use a GPU:
|
||||
@@ -199,7 +199,7 @@ LVGL supports rotation of the display in 90 degree increments. You can select wh
|
||||
|
||||
If you select software rotation (`sw_rotate` flag set to 1), LVGL will perform the rotation for you. Your driver can and should assume that the screen width and height have not changed. Simply flush pixels to the display as normal. Software rotation requires no additional logic in your `flush_cb` callback.
|
||||
|
||||
There is a noticeable amount of overhead to performing rotation in software. Hardware rotation is available to avoid unwanted slowdowns. In this mode, LVGL draws into the buffer as if your screen width and height were swapped. You are responsible for rotating the provided pixels yourself.
|
||||
There is a noticeable amount of overhead to performing rotation in software. Hardware rotation is available to avoid unwanted slowdowns. In this mode, LVGL draws into the buffer as if your screen width and height were swapped. You are responsible for rotating the provided pixels yourself.
|
||||
|
||||
The default rotation of your display when it is initialized can be set using the `rotated` flag. The available options are `LV_DISP_ROT_NONE`, `LV_DISP_ROT_90`, `LV_DISP_ROT_180`, or `LV_DISP_ROT_270`. The rotation values are relative to how you would rotate the physical display in the clockwise direction. Thus, `LV_DISP_ROT_90` means you rotate the hardware 90 degrees clockwise, and the display rotates 90 degrees counterclockwise to compensate.
|
||||
|
||||
@@ -210,13 +210,13 @@ Display rotation can also be changed at runtime using the `lv_disp_set_rotation(
|
||||
Support for software rotation is a new feature, so there may be some glitches/bugs depending on your configuration. If you encounter a problem please open an issue on [GitHub](https://github.com/lvgl/lvgl/issues).
|
||||
|
||||
### Decoupling the display refresh timer
|
||||
Normally the dirty (a.k.a invalid) areas are checked and redrawn in every `LV_DISP_DEF_REFR_PERIOD` milliseconds (set in `lv_conf.h`).
|
||||
Normally the dirty (a.k.a invalid) areas are checked and redrawn in every `LV_DISP_DEF_REFR_PERIOD` milliseconds (set in `lv_conf.h`).
|
||||
However, in some cases you might need more control on when the display refreshing happen, for example to synchronize rendering with VSYNC or the TE signal.
|
||||
|
||||
You can do this in the following way:
|
||||
```c
|
||||
/*Delete the original display refresh timer*/
|
||||
lv_timer_del(disp->refr_timer);
|
||||
lv_timer_del(disp->refr_timer);
|
||||
disp->refr_timer = NULL;
|
||||
|
||||
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
```eval_rst
|
||||
.. include:: /header.rst
|
||||
.. include:: /header.rst
|
||||
:github_url: |github_link_base|/porting/gpu.md
|
||||
```
|
||||
# Add custom GPU
|
||||
LVGL has a flexible and extendable draw pipeline. You can hook it to do some rendering with a GPU or even completely replace the built-in software renderer.
|
||||
|
||||
## Draw context
|
||||
The core structure of drawing is `lv_draw_ctx_t`.
|
||||
It contains a pointer to a buffer where drawing should happen and a couple of callbacks to draw rectangles, texts, and other primitives.
|
||||
The core structure of drawing is `lv_draw_ctx_t`.
|
||||
It contains a pointer to a buffer where drawing should happen and a couple of callbacks to draw rectangles, texts, and other primitives.
|
||||
|
||||
### Fields
|
||||
`lv_draw_ctx_t` has the following fields:
|
||||
- `void * buf` Pointer to a buffer to draw into
|
||||
- `lv_area_t * buf_area` The position and size of `buf` (absolute coordinates)
|
||||
- `const lv_area_t * clip_area` The current clip area with absolute coordinates, always the same or smaller than `buf_area`. All drawings should be clipped to this area.
|
||||
- `void (*draw_rect)()` Draw a rectangle with shadow, gradient, border, etc.
|
||||
- `void (*draw_rect)()` Draw a rectangle with shadow, gradient, border, etc.
|
||||
- `void (*draw_arc)()` Draw an arc
|
||||
- `void (*draw_img_decoded)()` Draw an (A)RGB image that is already decoded by LVGL.
|
||||
- `void (*draw_img_decoded)()` Draw an (A)RGB image that is already decoded by LVGL.
|
||||
- `lv_res_t (*draw_img)()` Draw an image before decoding it (it bypasses LVGL's internal image decoders)
|
||||
- `void (*draw_letter)()` Draw a letter
|
||||
- `void (*draw_line)()` Draw a line
|
||||
@@ -28,22 +28,22 @@ It contains a pointer to a buffer where drawing should happen and a couple of ca
|
||||
(For the sake of simplicity the parameters of the callbacks are not shown here.)
|
||||
|
||||
All `draw_*` callbacks receive a pointer to the current `draw_ctx` as their first parameter. Among the other parameters there is a descriptor that tells what to draw,
|
||||
e.g. for `draw_rect` it's called [lv_draw_rect_dsc_t](https://github.com/lvgl/lvgl/blob/master/src/draw/lv_draw_rect.h),
|
||||
for `lv_draw_line` it's called [lv_draw_line_dsc_t](https://github.com/lvgl/lvgl/blob/master/src/draw/lv_draw_line.h), etc.
|
||||
e.g. for `draw_rect` it's called [lv_draw_rect_dsc_t](https://github.com/lvgl/lvgl/blob/master/src/draw/lv_draw_rect.h),
|
||||
for `lv_draw_line` it's called [lv_draw_line_dsc_t](https://github.com/lvgl/lvgl/blob/master/src/draw/lv_draw_line.h), etc.
|
||||
|
||||
To correctly render according to a `draw_dsc` you need to be familiar with the [Boxing model](https://docs.lvgl.io/master/overview/coords.html#boxing-model) of LVGL and the meanings of the fields. The name and meaning of the fields are identical to name and meaning of the [Style properties](https://docs.lvgl.io/master/overview/style-props.html).
|
||||
|
||||
### Initialization
|
||||
The `lv_disp_drv_t` has 4 fields related to the draw context:
|
||||
- `lv_draw_ctx_t * draw_ctx` Pointer to the `draw_ctx` of this display
|
||||
- `void (*draw_ctx_init)(struct _lv_disp_drv_t * disp_drv, lv_draw_ctx_t * draw_ctx)` Callback to initialize a `draw_ctx`
|
||||
- `lv_draw_ctx_t * draw_ctx` Pointer to the `draw_ctx` of this display
|
||||
- `void (*draw_ctx_init)(struct _lv_disp_drv_t * disp_drv, lv_draw_ctx_t * draw_ctx)` Callback to initialize a `draw_ctx`
|
||||
- `void (*draw_ctx_deinit)(struct _lv_disp_drv_t * disp_drv, lv_draw_ctx_t * draw_ctx)` Callback to de-initialize a `draw_ctx`
|
||||
- `size_t draw_ctx_size` Size of the draw context structure. E.g. `sizeof(lv_draw_sw_ctx_t)`
|
||||
|
||||
When you ignore these fields, LVGL will set default values for callbacks and size in `lv_disp_drv_init()` based on the configuration in `lv_conf.h`.
|
||||
`lv_disp_drv_register()` will allocate a `draw_ctx` based on `draw_ctx_size` and call `draw_ctx_init()` on it.
|
||||
|
||||
However, you can overwrite the callbacks and the size values before calling `lv_disp_drv_register()`.
|
||||
However, you can overwrite the callbacks and the size values before calling `lv_disp_drv_register()`.
|
||||
It makes it possible to use your own `draw_ctx` with your own callbacks.
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ draw_sw_ctx->base_draw.draw_letter = lv_draw_sw_letter;
|
||||
```
|
||||
|
||||
### Blend callback
|
||||
As you saw above the software renderer adds the `blend` callback field. It's a special callback related to how the software renderer works.
|
||||
As you saw above the software renderer adds the `blend` callback field. It's a special callback related to how the software renderer works.
|
||||
All draw operations end up in the `blend` callback which can either fill an area or copy an image to an area by considering an optional mask.
|
||||
|
||||
The `lv_draw_sw_blend_dsc_t` parameter describes what and how to blend. It has the following fields:
|
||||
@@ -81,11 +81,11 @@ The `lv_draw_sw_blend_dsc_t` parameter describes what and how to blend. It has t
|
||||
- `lv_blend_mode_t blend_mode` E.g. `LV_BLEND_MODE_ADDITIVE`
|
||||
|
||||
|
||||
## Extend the software renderer
|
||||
## Extend the software renderer
|
||||
|
||||
### New blend callback
|
||||
|
||||
Let's take a practical example: you would like to use your MCUs GPU for color fill operations only.
|
||||
Let's take a practical example: you would like to use your MCUs GPU for color fill operations only.
|
||||
|
||||
As all draw callbacks call `blend` callback to fill an area in the end only the `blend` callback needs to be overwritten.
|
||||
|
||||
@@ -142,10 +142,10 @@ void my_draw_blend(lv_draw_ctx_t * draw_ctx, const lv_draw_sw_blend_dsc_t * dsc)
|
||||
|
||||
/*Make the blend area relative to the buffer*/
|
||||
lv_area_move(&blend_area, -draw_ctx->buf_area->x1, -draw_ctx->buf_area->y1);
|
||||
|
||||
|
||||
/*Call your custom gou fill function to fill blend_area, on dest_buf with dsc->color*/
|
||||
my_gpu_fill(dest_buf, dest_stride, &blend_area, dsc->color);
|
||||
}
|
||||
}
|
||||
/*Fallback: the GPU doesn't support these settings. Call the SW renderer.*/
|
||||
else {
|
||||
lv_draw_sw_blend_basic(draw_ctx, dsc);
|
||||
@@ -158,7 +158,7 @@ The implementation of wait callback is much simpler:
|
||||
void my_gpu_wait(lv_draw_ctx_t * draw_ctx)
|
||||
{
|
||||
while(my_gpu_is_working());
|
||||
|
||||
|
||||
/*Call SW renderer's wait callback too*/
|
||||
lv_draw_sw_wait_for_finish(draw_ctx);
|
||||
}
|
||||
@@ -171,21 +171,21 @@ A custom `draw_rect` callback might look like this:
|
||||
void my_draw_rect(lv_draw_ctx_t * draw_ctx, const lv_draw_rect_dsc_t * dsc, const lv_area_t * coords)
|
||||
{
|
||||
if(lv_draw_mask_is_any(coords) == false && dsc->grad == NULL && dsc->bg_img_src == NULL &&
|
||||
dsc->shadow_width == 0 && dsc->blend_mode = LV_BLEND_MODE_NORMAL)
|
||||
dsc->shadow_width == 0 && dsc->blend_mode = LV_BLEND_MODE_NORMAL)
|
||||
{
|
||||
/*Draw the background*/
|
||||
my_bg_drawer(draw_ctx, coords, dsc->bg_color, dsc->radius);
|
||||
|
||||
|
||||
/*Draw the border if any*/
|
||||
if(dsc->border_width) {
|
||||
my_border_drawer(draw_ctx, coords, dsc->border_width, dsc->border_color, dsc->border_opa)
|
||||
}
|
||||
|
||||
|
||||
/*Draw the outline if any*/
|
||||
if(dsc->outline_width) {
|
||||
my_outline_drawer(draw_ctx, coords, dsc->outline_width, dsc->outline_color, dsc->outline_opa, dsc->outline_pad)
|
||||
}
|
||||
}
|
||||
}
|
||||
/*Fallback*/
|
||||
else {
|
||||
lv_draw_sw_rect(draw_ctx, dsc, coords);
|
||||
@@ -197,6 +197,6 @@ void my_draw_rect(lv_draw_ctx_t * draw_ctx, const lv_draw_rect_dsc_t * dsc, cons
|
||||
|
||||
## Fully custom draw engine
|
||||
|
||||
For example if your MCU/MPU supports a powerful vector graphics engine you might use only that instead of LVGL's SW renderer.
|
||||
For example if your MCU/MPU supports a powerful vector graphics engine you might use only that instead of LVGL's SW renderer.
|
||||
In this case, you need to base the renderer on the basic `lv_draw_ctx_t` (instead of `lv_draw_sw_ctx_t`) and extend/initialize it as you wish.
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
```eval_rst
|
||||
.. include:: /header.rst
|
||||
.. include:: /header.rst
|
||||
:github_url: |github_link_base|/porting/indev.md
|
||||
```
|
||||
# Input device interface
|
||||
@@ -45,7 +45,7 @@ void my_input_read(lv_indev_drv_t * drv, lv_indev_data_t*data)
|
||||
data->point.y = touchpad_y;
|
||||
data->state = LV_INDEV_STATE_PRESSED;
|
||||
} else {
|
||||
data->state = LV_INDEV_STATE_RELEASED;
|
||||
data->state = LV_INDEV_STATE_RELEASED;
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -108,7 +108,7 @@ void encoder_read(lv_indev_drv_t * drv, lv_indev_data_t*data){
|
||||
```
|
||||
|
||||
#### Using buttons with Encoder logic
|
||||
In addition to standard encoder behavior, you can also utilize its logic to navigate(focus) and edit widgets using buttons.
|
||||
In addition to standard encoder behavior, you can also utilize its logic to navigate(focus) and edit widgets using buttons.
|
||||
This is especially handy if you have only few buttons available, or you want to use other buttons in addition to encoder wheel.
|
||||
|
||||
You need to have 3 buttons available:
|
||||
@@ -141,7 +141,7 @@ void encoder_with_keys_read(lv_indev_drv_t * drv, lv_indev_data_t*data){
|
||||
*Buttons* mean external "hardware" buttons next to the screen which are assigned to specific coordinates of the screen.
|
||||
If a button is pressed it will simulate the pressing on the assigned coordinate. (Similarly to a touchpad)
|
||||
|
||||
To assign buttons to coordinates use `lv_indev_set_button_points(my_indev, points_array)`.
|
||||
To assign buttons to coordinates use `lv_indev_set_button_points(my_indev, points_array)`.
|
||||
`points_array` should look like `const lv_point_t points_array[] = { {12,30},{60,90}, ...}`
|
||||
|
||||
``` important:: The points_array can't go out of scope. Either declare it as a global variable or as a static variable inside a function.
|
||||
@@ -189,9 +189,9 @@ Every input device is associated with a display. By default, a new input device
|
||||
The associated display is stored and can be changed in `disp` field of the driver.
|
||||
|
||||
### Buffered reading
|
||||
By default, LVGL calls `read_cb` periodically. Because of this intermittent polling there is a chance that some user gestures are missed.
|
||||
By default, LVGL calls `read_cb` periodically. Because of this intermittent polling there is a chance that some user gestures are missed.
|
||||
|
||||
To solve this you can write an event driven driver for your input device that buffers measured data. In `read_cb` you can report the buffered data instead of directly reading the input device.
|
||||
To solve this you can write an event driven driver for your input device that buffers measured data. In `read_cb` you can report the buffered data instead of directly reading the input device.
|
||||
Setting the `data->continue_reading` flag will tell LVGL there is more data to read and it should call `read_cb` again.
|
||||
|
||||
## Further reading
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
```eval_rst
|
||||
.. include:: /header.rst
|
||||
.. include:: /header.rst
|
||||
:github_url: |github_link_base|/porting/index.md
|
||||
```
|
||||
|
||||
@@ -19,6 +19,6 @@
|
||||
os
|
||||
log
|
||||
gpu
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
```eval_rst
|
||||
.. include:: /header.rst
|
||||
.. include:: /header.rst
|
||||
:github_url: |github_link_base|/porting/log.md
|
||||
```
|
||||
# Logging
|
||||
@@ -24,7 +24,7 @@ If your system supports `printf`, you just need to enable `LV_LOG_PRINTF` in `lv
|
||||
|
||||
|
||||
### Custom log function
|
||||
If you can't use `printf` or want to use a custom function to log, you can register a "logger" callback with `lv_log_register_print_cb()`.
|
||||
If you can't use `printf` or want to use a custom function to log, you can register a "logger" callback with `lv_log_register_print_cb()`.
|
||||
|
||||
For example:
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
```eval_rst
|
||||
.. include:: /header.rst
|
||||
.. include:: /header.rst
|
||||
:github_url: |github_link_base|/porting/os.md
|
||||
```
|
||||
# Operating system and interrupts
|
||||
@@ -37,7 +37,7 @@ void other_thread(void)
|
||||
mutex_lock(&lvgl_mutex);
|
||||
lv_obj_t *img = lv_img_create(lv_scr_act());
|
||||
mutex_unlock(&lvgl_mutex);
|
||||
|
||||
|
||||
while(1) {
|
||||
mutex_lock(&lvgl_mutex);
|
||||
/* change to the next image */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
```eval_rst
|
||||
.. include:: /header.rst
|
||||
.. include:: /header.rst
|
||||
:github_url: |github_link_base|/porting/project.md
|
||||
```
|
||||
|
||||
@@ -16,7 +16,7 @@ You can clone it or [Download](https://github.com/lvgl/lvgl/archive/refs/heads/m
|
||||
The graphics library itself is the `lvgl` directory. It contains a couple of folders but to use `lvgl` you only need `.c` and `.h` files from the `src` folder.
|
||||
|
||||
### Automatically add files
|
||||
If your IDE automatically adds the files from the folders copied to the project folder (as Eclipse or VSCode does), you can simply copy the `lvgl` folder as it is into your project.
|
||||
If your IDE automatically adds the files from the folders copied to the project folder (as Eclipse or VSCode does), you can simply copy the `lvgl` folder as it is into your project.
|
||||
|
||||
### Make and CMake
|
||||
LVGL also supports `make` and `CMake` build systems out of the box. To add LVGL to your Makefile based build system add these lines to your main Makefile:
|
||||
@@ -48,7 +48,7 @@ To get `lv_conf.h` **copy lvgl/lv_conf_template.h** next to the `lvgl` directory
|
||||
|
||||
Comments in the config file explain the meaning of the options. Be sure to set at least `LV_COLOR_DEPTH` according to your display's color depth. Note that, the examples and demos explicitly need to be enabled in `lv_conf.h`.
|
||||
|
||||
Alternatively, `lv_conf.h` can be copied to another place but then you should add the `LV_CONF_INCLUDE_SIMPLE` define to your compiler options (e.g. `-DLV_CONF_INCLUDE_SIMPLE` for GCC compiler) and set the include path manually (e.g. `-I../include/gui`).
|
||||
Alternatively, `lv_conf.h` can be copied to another place but then you should add the `LV_CONF_INCLUDE_SIMPLE` define to your compiler options (e.g. `-DLV_CONF_INCLUDE_SIMPLE` for GCC compiler) and set the include path manually (e.g. `-I../include/gui`).
|
||||
In this case LVGL will attempt to include `lv_conf.h` simply with `#include "lv_conf.h"`.
|
||||
|
||||
You can even use a different name for `lv_conf.h`. The custom path can be set via the `LV_CONF_PATH` define.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
```eval_rst
|
||||
.. include:: /header.rst
|
||||
.. include:: /header.rst
|
||||
:github_url: |github_link_base|/porting/sleep.md
|
||||
```
|
||||
# Sleep management
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
```eval_rst
|
||||
.. include:: /header.rst
|
||||
.. include:: /header.rst
|
||||
:github_url: |github_link_base|/porting/task-handler.md
|
||||
```
|
||||
# Task Handler
|
||||
|
||||
To handle the tasks of LVGL you need to call `lv_timer_handler()` periodically in one of the following:
|
||||
- *while(1)* of *main()* function
|
||||
- *while(1)* of *main()* function
|
||||
- timer interrupt periodically (lower priority than `lv_tick_inc()`)
|
||||
- an OS task periodically
|
||||
|
||||
@@ -35,7 +35,7 @@ while(1) {
|
||||
while (1) {
|
||||
lv_timer_handler_run_in_period(5); /* run lv_timer_handler() every 5ms */
|
||||
my_delay_ms(5); /* delay 5ms to avoid unnecessary polling */
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
To learn more about timers visit the [Timer](/overview/timer) section.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
```eval_rst
|
||||
.. include:: /header.rst
|
||||
.. include:: /header.rst
|
||||
:github_url: |github_link_base|/porting/tick.md
|
||||
```
|
||||
# Tick interface
|
||||
|
||||
Reference in New Issue
Block a user