Merge branch 'master' into feat/test-unity

This commit is contained in:
Gabor Kiss-Vamosi
2021-06-23 12:51:26 +02:00
30 changed files with 828 additions and 621 deletions
+1
View File
@@ -10,6 +10,7 @@ scripts/cppcheck_res.txt
scripts/built_in_font/lv_font_*
docs/doxygen_html
docs/xml
docs/examples.md
docs/out_latex
docs/_static/built_lv_examples
docs/LVGL.pdf
+1 -1
View File
@@ -166,7 +166,7 @@ menu "LVGL configuration"
1: Add default bare metal and FreeRTOS interrupt handling
routines for PXP (lv_gpu_nxp_pxp_osa.c) and call
lv_gpu_nxp_pxp_init() automatically during lv_init().
Note that symbol FSL_RTOS_FREE_RTOS has to be defined in order
Note that symbol SDK_OS_FREE_RTOS has to be defined in order
to use FreeRTOS OSA, otherwise bare-metal implementation is
selected.
0: lv_gpu_nxp_pxp_init() has to be called manually before
+1 -1
View File
@@ -1,5 +1,5 @@
MIT licence
Copyright (c) 2020 LVGL LLC
Copyright (c) 2021 LVGL Kft
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+6 -6
View File
@@ -115,14 +115,14 @@ LVGL is also avaiable as:
This list shows the recommended way of learning the library:
1. Check the [Online demos](https://lvgl.io/demos) to see LVGL in action (3 minutes)
2. Read the [Introduction](https://docs.lvgl.io/master/intro/index.html) page of the documentation (5 minutes)
3. Get familiar with the basics on the [Quick overview](https://docs.lvgl.io/master/html/get-started/quick-overview.html) page (15 minutes)
4. Set up a [Simulator](https://docs.lvgl.io/latest/master/get-started/pc-simulator.html) (10 minutes)
3. Get familiar with the basics on the [Quick overview](https://docs.lvgl.io/master/get-started/quick-overview.html) page (15 minutes)
4. Set up a [Simulator](https://docs.lvgl.io/master/get-started/pc-simulator.html) (10 minutes)
5. Try out some [Examples](https://github.com/lvgl/lvgl/tree/master/examples)
6. Port LVGL to a board. See the [Porting](https://docs.lvgl.io/master/porting/index.html) guide or check the ready to use [Projects](https://github.com/lvgl?q=lv_port_&type=&language=)
6. Port LVGL to a board. See the [Porting](https://docs.lvgl.io/master/porting/index.html) guide or check the ready to use [Projects](https://github.com/lvgl?q=lv_port_)
7. Read the [Overview](https://docs.lvgl.io/master/overview/index.html) page to get a better understanding of the library (2-3 hours)
8. Check the documentation of the [Widgets](https://docs.lvgl.io/master/html/widgets/index.html) to see their features and usage
8. Check the documentation of the [Widgets](https://docs.lvgl.io/master/widgets/index.html) to see their features and usage
9. If you have questions go to the [Forum](http://forum.lvgl.io/)
10. Read the [Contributing](https://docs.lvgl.io/master/contributing/index.html) guide to see how you can help to improve LVGL (15 minutes)
10. Read the [Contributing](https://docs.lvgl.io/master/CONTRIBUTING.html) guide to see how you can help to improve LVGL (15 minutes)
## Examples
@@ -177,5 +177,5 @@ Feel free to contact us if you have any questions.
## Contributing
LVGL is an open project and contribution is very welcome. There are many ways to contribute from simply speaking about your project, through writing examples, improving the documentation, fixing bugs to hosing your own project under the LVGL organization.
For a detailed description of contribution opportunities visit the [Contributing](https://docs.lvgl.io/master/CONTRIBUTING.htmll) section of the documentation.
For a detailed description of contribution opportunities visit the [Contributing](https://docs.lvgl.io/master/CONTRIBUTING.html) section of the documentation.
+24 -11
View File
@@ -16,7 +16,8 @@ class LvExample(Directive):
required_arguments = 1
option_spec = {
'excluded_languages': excluded_list,
'language': directives.unchanged
'language': directives.unchanged,
'description': directives.unchanged
}
def get_example_code_path(self, example_path, language):
return os.path.abspath("../examples/" + example_path + "." + language)
@@ -27,8 +28,10 @@ class LvExample(Directive):
return 'C'
else:
return language
def embed_code(self, example_file, example_path, language):
def github_path(self, example_path, language):
env = self.state.document.settings.env
return f"https://github.com/lvgl/lvgl/blob/{env.config.repo_commit_hash}/examples/{example_path}.{language}"
def embed_code(self, example_file, example_path, language, buttons={}):
toggle = nodes.container('', literal_block=False, classes=['toggle'])
header = nodes.container('', literal_block=False, classes=['header'])
toggle.append(header)
@@ -40,7 +43,10 @@ class LvExample(Directive):
literal_list = nodes.literal_block(contents, contents)
literal_list['language'] = language
toggle.append(literal_list)
header.append(nodes.raw(text=f"<p>{self.human_language_name(language)} code &nbsp; <a onclick=\"event.stopPropagation();\" class='fa fa-github' href='https://github.com/lvgl/lvgl/blob/{env.config.repo_commit_hash}/examples/{example_path}.{language}'>&nbsp; view on GitHub</a></p>", format='html'))
paragraph_node = nodes.raw(text=f"<p>{self.human_language_name(language)} code &nbsp;</p>", format='html')
for text, url in buttons.items():
paragraph_node.append(nodes.raw(text=f"<a class='lv-example-link-button' onclick=\"event.stopPropagation();\" href='{url}'>{text}</a>", format='html'))
header.append(paragraph_node)
return toggle
def run(self):
example_path = self.arguments[0]
@@ -50,20 +56,27 @@ class LvExample(Directive):
env = self.state.document.settings.env
iframe_node = nodes.raw(text=f"<iframe loading='lazy' class='lv-example' src='/{env.config.version}/_static/built_lv_examples?example={example_name}&w=320&h=240'></iframe>", format='html')
micropython_node = nodes.raw(text=f"<a style='display: inline-block; margin-bottom: 1rem;' target='_blank' href='https://sim.lvgl.io/v{env.config.version}/micropython/ports/javascript/index.html?script_startup=https://raw.githubusercontent.com/lvgl/lvgl/{env.config.repo_commit_hash}/examples/header.py&script=https://raw.githubusercontent.com/lvgl/lvgl/{env.config.repo_commit_hash}/examples/{example_path}.py'>Click to try in the MicroPython simulator!</a>", format='html')
iframe_html = ""
c_path = self.get_example_code_path(example_path, 'c')
py_path = self.get_example_code_path(example_path, 'py')
c_code = self.embed_code(c_path, example_path, 'c')
py_code = self.embed_code(py_path, example_path, 'py')
c_code = self.embed_code(c_path, example_path, 'c', buttons={
'<i class="fa fa-github"></i>&nbsp;GitHub': self.github_path(example_path, 'c')
})
py_code = self.embed_code(py_path, example_path, 'py', buttons={
'<i class="fa fa-github"></i>&nbsp;GitHub': self.github_path(example_path, 'py'),
'<i class="fa fa-play"></i>&nbsp;Simulator': f"https://sim.lvgl.io/v{env.config.version}/micropython/ports/javascript/index.html?script_startup=https://raw.githubusercontent.com/lvgl/lvgl/{env.config.repo_commit_hash}/examples/header.py&script=https://raw.githubusercontent.com/lvgl/lvgl/{env.config.repo_commit_hash}/examples/{example_path}.py"
})
if not 'c' in excluded_languages:
if env.app.tags.has('html'):
node_list.append(iframe_node)
if not 'py' in excluded_languages:
node_list.append(micropython_node)
iframe_html = f"<div class='lv-example' data-real-src='/{env.config.version}/_static/built_lv_examples?example={example_name}&w=320&h=240'></div>"
description_html = f"<div class='lv-example-description'>{self.options.get('description', '')}</div>"
layout_node = nodes.raw(text=f"<div class='lv-example-container'>{iframe_html}{description_html}</div>", format='html')
node_list.append(layout_node)
if not 'c' in excluded_languages:
node_list.append(c_code)
if not 'py' in excluded_languages:
+34 -2
View File
@@ -19,7 +19,7 @@ span.pre:first-child
code.sig-name
{
//margin-left:8px;
/*margin-left:8px;*/
}
.toggle .header {
@@ -64,11 +64,43 @@ code.sig-name
transform: translate(0, -10px);
}
.lv-example {
.lv-example, .lv-example > iframe {
border: none;
outline: none;
padding: none;
display: block;
width: 320px;
height: 240px;
flex: none;
position: relative;
}
.lv-example > iframe {
position: absolute;
top: 0;
left: 0;
}
.lv-example-container {
display: flex;
}
.lv-example-description {
flex: 1 1 auto;
margin-left: 1rem;
}
.lv-example-link-button {
display: inline-block;
padding: 4px 8px;
border-radius: 4px;
background-color: #2980b9;
color: white;
margin: 0 4px;
}
.lv-example-link-button:hover {
color: white;
filter: brightness(120%);
}
.lv-example-link-button:visited {
color: white;
}
+27
View File
@@ -51,5 +51,32 @@ document.addEventListener('DOMContentLoaded', (event) => {
});
})
document.addEventListener('DOMContentLoaded', (event) => {
function onIntersection(entries) {
entries.forEach(entry => {
let currentlyLoaded = entry.target.getAttribute("data-is-loaded") == "true";
let shouldBeLoaded = entry.intersectionRatio > 0;
if(currentlyLoaded != shouldBeLoaded) {
entry.target.setAttribute("data-is-loaded", shouldBeLoaded);
if(shouldBeLoaded) {
let iframe = document.createElement("iframe");
iframe.src = entry.target.getAttribute("data-real-src");
entry.target.appendChild(iframe);
} else {
let iframe = entry.target.querySelector("iframe");
iframe.parentNode.removeChild(iframe);
}
}
});
}
const config = {
rootMargin: '600px 0px',
threshold: 0.01
};
let observer = new IntersectionObserver(onIntersection, config);
document.querySelectorAll(".lv-example").forEach(iframe => {
observer.observe(iframe);
});
});
</script>
{% endblock %}
+6 -3
View File
@@ -1,5 +1,7 @@
#!/usr/bin/env python3
import os
def process_index_rst(path):
# print(path)
with open(path) as fp:
@@ -73,10 +75,11 @@ layouts = {
def print_item(path, lvl, d, fout):
for k in d:
v = d[k]
b = os.path.basename(k)
if k.startswith(path + "/lv_example_"):
fout.write("#"*lvl + " " + v + "\n")
fout.write('<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=' + b +'&amp;w=320&amp;h=240"></iframe>\n')
fout.write('```eval_rst\n')
fout.write(f".. lv_example:: {k}\n")
fout.write('```\n')
fout.write("\n")
def exec():
-364
View File
@@ -1,364 +0,0 @@
```eval_rst
.. include:: /header.rst
:github_url: |github_link_base|/examples.md
```
# Examples
## Get started
### A button with a label and react on click event
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_get_started_1&amp;w=320&amp;h=240"></iframe>
### Create styles from scratch for buttons
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_get_started_2&amp;w=320&amp;h=240"></iframe>
### Create a slider and write its value on a label
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_get_started_3&amp;w=320&amp;h=240"></iframe>
## Styles
### Size styles
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_style_1&amp;w=320&amp;h=240"></iframe>
### Background styles
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_style_2&amp;w=320&amp;h=240"></iframe>
### Border styles
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_style_3&amp;w=320&amp;h=240"></iframe>
### Outline styles
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_style_4&amp;w=320&amp;h=240"></iframe>
### Shadow styles
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_style_5&amp;w=320&amp;h=240"></iframe>
### Image styles
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_style_6&amp;w=320&amp;h=240"></iframe>
### Text styles
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_style_8&amp;w=320&amp;h=240"></iframe>
### Line styles
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_style_9&amp;w=320&amp;h=240"></iframe>
### Transition
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_style_10&amp;w=320&amp;h=240"></iframe>
### Using multiple styles
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_style_11&amp;w=320&amp;h=240"></iframe>
### Local styles
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_style_12&amp;w=320&amp;h=240"></iframe>
### Add styles to parts and states
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_style_13&amp;w=320&amp;h=240"></iframe>
### Extending the current theme
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_style_14&amp;w=320&amp;h=240"></iframe>
## Animations
### Start animation on an event
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_anim_1&amp;w=320&amp;h=240"></iframe>
### Playback animation
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_anim_2&amp;w=320&amp;h=240"></iframe>
## Events
### Button click event
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_event_1&amp;w=320&amp;h=240"></iframe>
### Handle multiple events
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_event_2&amp;w=320&amp;h=240"></iframe>
### Event bubbling
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_event_3&amp;w=320&amp;h=240"></iframe>
## Layouts
### Flex
#### A simple row and a column layout with flexbox
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_flex_1&amp;w=320&amp;h=240"></iframe>
#### Arrange items in rows with wrap and even spacing
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_flex_2&amp;w=320&amp;h=240"></iframe>
#### Demonstrate flex grow
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_flex_3&amp;w=320&amp;h=240"></iframe>
#### Demonstrate flex grow.
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_flex_4&amp;w=320&amp;h=240"></iframe>
#### Demonstrate column and row gap style properties
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_flex_5&amp;w=320&amp;h=240"></iframe>
#### RTL base direction changes order of the items
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_flex_6&amp;w=320&amp;h=240"></iframe>
### Grid
#### A simple grid
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_grid_1&amp;w=320&amp;h=240"></iframe>
#### Demonstrate cell placement and span
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_grid_2&amp;w=320&amp;h=240"></iframe>
#### Demonstrate grid's "free unit"
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_grid_3&amp;w=320&amp;h=240"></iframe>
#### Demonstrate track placement
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_grid_4&amp;w=320&amp;h=240"></iframe>
#### Demonstrate column and row gap
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_grid_5&amp;w=320&amp;h=240"></iframe>
#### Demonstrate RTL direction on grid
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_grid_6&amp;w=320&amp;h=240"></iframe>
## Scrolling
### Nested scrolling
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_scroll_1&amp;w=320&amp;h=240"></iframe>
### Snapping
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_scroll_2&amp;w=320&amp;h=240"></iframe>
### Floating button
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_scroll_3&amp;w=320&amp;h=240"></iframe>
### Styling the scrollbars
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_scroll_4&amp;w=320&amp;h=240"></iframe>
### Right to left scrolling
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_scroll_5&amp;w=320&amp;h=240"></iframe>
### Translate on scroll
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_scroll_6&amp;w=320&amp;h=240"></iframe>
## Widgets
### Base object
#### Base objects with custom styles
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_obj_1&amp;w=320&amp;h=240"></iframe>
#### Make an object draggable
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_obj_2&amp;w=320&amp;h=240"></iframe>
### Arc
#### Simple Arc
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_arc_1&amp;w=320&amp;h=240"></iframe>
#### Loader with Arc
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_arc_2&amp;w=320&amp;h=240"></iframe>
### Bar
#### Simple Bar
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_bar_1&amp;w=320&amp;h=240"></iframe>
#### Styling a bar
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_bar_2&amp;w=320&amp;h=240"></iframe>
#### Temperature meter
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_bar_3&amp;w=320&amp;h=240"></iframe>
#### Stripe pattern and range value
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_bar_4&amp;w=320&amp;h=240"></iframe>
#### Bar with RTL and RTL base direction
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_bar_5&amp;w=320&amp;h=240"></iframe>
#### Custom drawr to show the current value
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_bar_6&amp;w=320&amp;h=240"></iframe>
### Button
#### Simple Buttons
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_btn_1&amp;w=320&amp;h=240"></iframe>
#### Styling buttons
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_btn_2&amp;w=320&amp;h=240"></iframe>
#### Gummy button
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_btn_3&amp;w=320&amp;h=240"></iframe>
### Button matrix
#### Simple Button matrix
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_btnmatrix_1&amp;w=320&amp;h=240"></iframe>
#### Custom buttons
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_btnmatrix_2&amp;w=320&amp;h=240"></iframe>
#### Pagination
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_btnmatrix_3&amp;w=320&amp;h=240"></iframe>
### Calendar
#### Calendar with header
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_calendar_1&amp;w=320&amp;h=240"></iframe>
### Canvas
#### Drawing on the Canvas and rotate
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_canvas_1&amp;w=320&amp;h=240"></iframe>
#### Transparent Canvas with chroma keying
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_canvas_2&amp;w=320&amp;h=240"></iframe>
### Chart
#### Line Chart
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_chart_1&amp;w=320&amp;h=240"></iframe>
#### Faded area line chart with custom division lines
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_chart_2&amp;w=320&amp;h=240"></iframe>
#### Axis ticks and labels with scrolling
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_chart_3&amp;w=320&amp;h=240"></iframe>
#### Show the value of the pressed points
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_chart_4&amp;w=320&amp;h=240"></iframe>
#### Display 1000 data points with zooming and scrolling
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_chart_5&amp;w=320&amp;h=240"></iframe>
#### Show cursor on the clicked point
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_chart_6&amp;w=320&amp;h=240"></iframe>
#### Scatter chart
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_chart_7&amp;w=320&amp;h=240"></iframe>
### Checkbox
#### Simple Checkboxes
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_checkbox_1&amp;w=320&amp;h=240"></iframe>
### Colorwheel
#### Simple Colorwheel
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_colorwheel_1&amp;w=320&amp;h=240"></iframe>
### Dropdown
#### Simple Drop down list
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_dropdown_1&amp;w=320&amp;h=240"></iframe>
#### Drop down in four directions
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_dropdown_2&amp;w=320&amp;h=240"></iframe>
#### Menu
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_dropdown_3&amp;w=320&amp;h=240"></iframe>
### Image
#### Image from variable and symbol
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_img_1&amp;w=320&amp;h=240"></iframe>
#### Image recoloring
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_img_2&amp;w=320&amp;h=240"></iframe>
#### Rotate and zoom
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_img_3&amp;w=320&amp;h=240"></iframe>
#### Image offset and styling
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_img_4&amp;w=320&amp;h=240"></iframe>
### Image button
#### Simple Image button
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_imgbtn_1&amp;w=320&amp;h=240"></iframe>
### Keyboard
#### Keyboard with text area
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_keyboard_1&amp;w=320&amp;h=240"></iframe>
### Label
#### Line wrap, recoloring and scrolling
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_label_1&amp;w=320&amp;h=240"></iframe>
#### Text shadow
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_label_2&amp;w=320&amp;h=240"></iframe>
#### Show LTR, RTL and Chinese texts
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_label_3&amp;w=320&amp;h=240"></iframe>
### LED
#### LED with custom style
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_led_1&amp;w=320&amp;h=240"></iframe>
### Line
#### Simple Line
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_line_1&amp;w=320&amp;h=240"></iframe>
### List
#### Simple List
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_list_1&amp;w=320&amp;h=240"></iframe>
### Meter
#### Simple meter
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_meter_1&amp;w=320&amp;h=240"></iframe>
#### A meter with multiple arcs
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_meter_2&amp;w=320&amp;h=240"></iframe>
#### A clock from a meter
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_meter_3&amp;w=320&amp;h=240"></iframe>
#### Pie chart
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_meter_4&amp;w=320&amp;h=240"></iframe>
### Message box
#### Simple Message box
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_msgbox_1&amp;w=320&amp;h=240"></iframe>
### Roller
#### Simple Roller
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_roller_1&amp;w=320&amp;h=240"></iframe>
#### Styling the roller
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_roller_2&amp;w=320&amp;h=240"></iframe>
#### add fade mask to roller
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_roller_3&amp;w=320&amp;h=240"></iframe>
### Slider
#### Simple Slider
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_slider_1&amp;w=320&amp;h=240"></iframe>
#### Slider with custom style
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_slider_2&amp;w=320&amp;h=240"></iframe>
#### Slider with extended drawer
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_slider_3&amp;w=320&amp;h=240"></iframe>
### Span
#### Span with custom styles
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_span_1&amp;w=320&amp;h=240"></iframe>
### Spinbox
#### Simple Spinbox
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_spinbox_1&amp;w=320&amp;h=240"></iframe>
### Spinner
#### Simple spinner
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_spinner_1&amp;w=320&amp;h=240"></iframe>
### Switch
#### Simple Switch
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_switch_1&amp;w=320&amp;h=240"></iframe>
### Table
#### Simple table
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_table_1&amp;w=320&amp;h=240"></iframe>
#### Lightweighted list from table
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_table_2&amp;w=320&amp;h=240"></iframe>
### Tabview
#### Simple Tabview
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_tabview_1&amp;w=320&amp;h=240"></iframe>
#### Tabs on the left, styling and no scrolling
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_tabview_2&amp;w=320&amp;h=240"></iframe>
### Textarea
#### Simple Text area
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_textarea_1&amp;w=320&amp;h=240"></iframe>
#### Text area with password field
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_textarea_2&amp;w=320&amp;h=240"></iframe>
#### Text auto-formatting
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_textarea_3&amp;w=320&amp;h=240"></iframe>
### Tabview
#### Tileview with content
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_tileview_1&amp;w=320&amp;h=240"></iframe>
### Window
#### Simple window
<iframe loading="lazy" class="lv-example" src="_static/built_lv_examples?example=lv_example_win_1&amp;w=320&amp;h=240"></iframe>
+2
View File
@@ -20,6 +20,8 @@ The parts of the Spinbox are identical to the [Text area](/widgets/core/textarea
`lv_spinbox_set_step(spinbox, 100)` sets which digits to change on increment/decrement. Only multiples of ten can be set, and not for example 3.
`lv_spinbox_set_pos(spinbox, 1)` sets the cursor to a specific digit to change on increment/decrement. For example position '0' sets the cursor to the least significant digit.
### Format
`lv_spinbox_set_digit_format(spinbox, digit_count, separator_position)` sets the number format. `digit_count` is the number of digits excluding the decimal separator and the sign.
+1
View File
@@ -4,6 +4,7 @@ Simple Arc
.. lv_example:: widgets/arc/lv_example_arc_1
:language: c
:description: A simple example to demonstrate the use of an arc.
Loader with Arc
""""""""""""""""
@@ -39,5 +39,5 @@ img.header.cf = lv.img.CF.TRUE_COLOR
img.header.w = _CANVAS_WIDTH
img.header.h = _CANVAS_HEIGHT
canvas.fill_bg(lv_palette_lighten(LV_PALETTE_GREY, 3), LV_OPA_COVER)
canvas.fill_bg(lv.palette_lighten(lv.PALETTE.GREY, 3), lv.OPA.COVER)
canvas.transform(img, 30, LV_IMG_ZOOM_NONE, 0, 0, _CANVAS_WIDTH // 2, _CANVAS_HEIGHT // 2, True);
+1 -1
View File
@@ -122,7 +122,7 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h"*/
#define LV_USE_GPU_NXP_PXP 0
#if LV_USE_GPU_NXP_PXP
/*1: Add default bare metal and FreeRTOS interrupt handling routines for PXP (lv_gpu_nxp_pxp_osa.c)
* and call lv_gpu_nxp_pxp_init() automatically during lv_init(). Note that symbol FSL_RTOS_FREE_RTOS
* and call lv_gpu_nxp_pxp_init() automatically during lv_init(). Note that symbol SDK_OS_FREE_RTOS
* has to be defined in order to use FreeRTOS OSA, otherwise bare-metal implementation is selected.
*0: lv_gpu_nxp_pxp_init() has to be called manually before lv_init()
*/
+45 -4
View File
@@ -30,6 +30,11 @@
#include "../gpu/lv_gpu_stm32_dma2d.h"
#endif
#if LV_USE_GPU_NXP_PXP && LV_USE_GPU_NXP_PXP_AUTO_INIT
#include "../gpu/lv_gpu_nxp_pxp.h"
#include "../gpu/lv_gpu_nxp_pxp_osa.h"
#endif
/*********************
* DEFINES
*********************/
@@ -105,6 +110,13 @@ void lv_init(void)
lv_gpu_stm32_dma2d_init();
#endif
#if LV_USE_GPU_NXP_PXP && LV_USE_GPU_NXP_PXP_AUTO_INIT
if(lv_gpu_nxp_pxp_init(&pxp_default_cfg) != LV_RES_OK) {
LV_LOG_ERROR("PXP init error. STOP.\n");
for(; ;) ;
}
#endif
_lv_obj_style_init();
_lv_ll_init(&LV_GC_ROOT(_lv_disp_ll), sizeof(lv_disp_t));
_lv_ll_init(&LV_GC_ROOT(_lv_indev_ll), sizeof(lv_indev_t));
@@ -472,8 +484,18 @@ static void lv_obj_draw(lv_event_t * e)
coords.y1 -= h;
coords.y2 += h;
lv_obj_draw_part_dsc_t part_dsc;
lv_obj_draw_dsc_init(&part_dsc, clip_area);
part_dsc.rect_dsc = &draw_dsc;
part_dsc.draw_area = &coords;
part_dsc.part = LV_PART_MAIN;
lv_event_send(obj, LV_EVENT_DRAW_PART_BEGIN, &part_dsc);
lv_draw_rect(&coords, clip_area, &draw_dsc);
lv_event_send(obj, LV_EVENT_DRAW_PART_END, &part_dsc);
#if LV_DRAW_COMPLEX
if(lv_obj_get_style_clip_corner(obj, LV_PART_MAIN)) {
lv_draw_mask_radius_param_t * mp = lv_mem_buf_get(sizeof(lv_draw_mask_radius_param_t));
@@ -530,8 +552,23 @@ static void draw_scrollbar(lv_obj_t * obj, const lv_area_t * clip_area)
lv_res_t sb_res = scrollbar_init_draw_dsc(obj, &draw_dsc);
if(sb_res != LV_RES_OK) return;
if(lv_area_get_size(&hor_area) > 0) lv_draw_rect(&hor_area, clip_area, &draw_dsc);
if(lv_area_get_size(&ver_area) > 0) lv_draw_rect(&ver_area, clip_area, &draw_dsc);
lv_obj_draw_part_dsc_t part_dsc;
lv_obj_draw_dsc_init(&part_dsc, clip_area);
part_dsc.rect_dsc = &draw_dsc;
part_dsc.part = LV_PART_SCROLLBAR;
if(lv_area_get_size(&hor_area) > 0) {
part_dsc.draw_area = &hor_area;
lv_event_send(obj, LV_EVENT_DRAW_PART_BEGIN, &part_dsc);
lv_draw_rect(&hor_area, clip_area, &draw_dsc);
lv_event_send(obj, LV_EVENT_DRAW_PART_END, &part_dsc);
}
if(lv_area_get_size(&ver_area) > 0) {
part_dsc.draw_area = &ver_area;
lv_event_send(obj, LV_EVENT_DRAW_PART_BEGIN, &part_dsc);
lv_draw_rect(&ver_area, clip_area, &draw_dsc);
lv_event_send(obj, LV_EVENT_DRAW_PART_END, &part_dsc);
}
}
/**
@@ -622,8 +659,12 @@ static void lv_obj_event(const lv_obj_class_t * class_p, lv_event_t * e)
else if(c == LV_KEY_LEFT || c == LV_KEY_DOWN) {
lv_obj_clear_state(obj, LV_STATE_CHECKED);
}
lv_res_t res = lv_event_send(obj, LV_EVENT_VALUE_CHANGED, NULL);
if(res != LV_RES_OK) return;
/*With Enter LV_EVENT_RELEASED will send VALUE_CHANGE event*/
if(c != LV_KEY_ENTER) {
lv_res_t res = lv_event_send(obj, LV_EVENT_VALUE_CHANGED, NULL);
if(res != LV_RES_OK) return;
}
}
}
else if(code == LV_EVENT_FOCUSED) {
+56 -56
View File
@@ -408,75 +408,75 @@ static void lv_refr_area(const lv_area_t * area_p)
draw_buf->area.y2 = lv_disp_get_ver_res(disp_refr) - 1;
disp_refr->driver->draw_buf->last_part = 1;
lv_refr_area_part(area_p);
return;
}
/*Normal refresh: draw the area in parts*/
else {
lv_disp_draw_buf_t * draw_buf = lv_disp_get_draw_buf(disp_refr);
/*Calculate the max row num*/
lv_coord_t w = lv_area_get_width(area_p);
lv_coord_t h = lv_area_get_height(area_p);
lv_coord_t y2 =
area_p->y2 >= lv_disp_get_ver_res(disp_refr) ? lv_disp_get_ver_res(disp_refr) - 1 : area_p->y2;
lv_disp_draw_buf_t * draw_buf = lv_disp_get_draw_buf(disp_refr);
/*Calculate the max row num*/
lv_coord_t w = lv_area_get_width(area_p);
lv_coord_t h = lv_area_get_height(area_p);
lv_coord_t y2 = area_p->y2 >= lv_disp_get_ver_res(disp_refr) ?
lv_disp_get_ver_res(disp_refr) - 1 : area_p->y2;
int32_t max_row = (uint32_t)draw_buf->size / w;
int32_t max_row = (uint32_t)draw_buf->size / w;
if(max_row > h) max_row = h;
if(max_row > h) max_row = h;
/*Round down the lines of draw_buf if rounding is added*/
if(disp_refr->driver->rounder_cb) {
lv_area_t tmp;
tmp.x1 = 0;
tmp.x2 = 0;
tmp.y1 = 0;
/*Round down the lines of draw_buf if rounding is added*/
if(disp_refr->driver->rounder_cb) {
lv_area_t tmp;
tmp.x1 = 0;
tmp.x2 = 0;
tmp.y1 = 0;
lv_coord_t h_tmp = max_row;
do {
tmp.y2 = h_tmp - 1;
disp_refr->driver->rounder_cb(disp_refr->driver, &tmp);
lv_coord_t h_tmp = max_row;
do {
tmp.y2 = h_tmp - 1;
disp_refr->driver->rounder_cb(disp_refr->driver, &tmp);
/*If this height fits into `max_row` then fine*/
if(lv_area_get_height(&tmp) <= max_row) break;
/*If this height fits into `max_row` then fine*/
if(lv_area_get_height(&tmp) <= max_row) break;
/*Decrement the height of the area until it fits into `max_row` after rounding*/
h_tmp--;
} while(h_tmp > 0);
/*Decrement the height of the area until it fits into `max_row` after rounding*/
h_tmp--;
} while(h_tmp > 0);
if(h_tmp <= 0) {
LV_LOG_WARN("Can't set draw_buf height using the round function. (Wrong round_cb or to "
"small draw_buf)");
return;
}
else {
max_row = tmp.y2 + 1;
}
if(h_tmp <= 0) {
LV_LOG_WARN("Can't set draw_buf height using the round function. (Wrong round_cb or to "
"small draw_buf)");
return;
}
/*Always use the full row*/
lv_coord_t row;
lv_coord_t row_last = 0;
for(row = area_p->y1; row + max_row - 1 <= y2; row += max_row) {
/*Calc. the next y coordinates of draw_buf*/
draw_buf->area.x1 = area_p->x1;
draw_buf->area.x2 = area_p->x2;
draw_buf->area.y1 = row;
draw_buf->area.y2 = row + max_row - 1;
if(draw_buf->area.y2 > y2) draw_buf->area.y2 = y2;
row_last = draw_buf->area.y2;
if(y2 == row_last) disp_refr->driver->draw_buf->last_part = 1;
lv_refr_area_part(area_p);
else {
max_row = tmp.y2 + 1;
}
}
/*If the last y coordinates are not handled yet ...*/
if(y2 != row_last) {
/*Calc. the next y coordinates of draw_buf*/
draw_buf->area.x1 = area_p->x1;
draw_buf->area.x2 = area_p->x2;
draw_buf->area.y1 = row;
draw_buf->area.y2 = y2;
/*Always use the full row*/
lv_coord_t row;
lv_coord_t row_last = 0;
for(row = area_p->y1; row + max_row - 1 <= y2; row += max_row) {
/*Calc. the next y coordinates of draw_buf*/
draw_buf->area.x1 = area_p->x1;
draw_buf->area.x2 = area_p->x2;
draw_buf->area.y1 = row;
draw_buf->area.y2 = row + max_row - 1;
if(draw_buf->area.y2 > y2) draw_buf->area.y2 = y2;
row_last = draw_buf->area.y2;
if(y2 == row_last) disp_refr->driver->draw_buf->last_part = 1;
lv_refr_area_part(area_p);
}
disp_refr->driver->draw_buf->last_part = 1;
lv_refr_area_part(area_p);
}
/*If the last y coordinates are not handled yet ...*/
if(y2 != row_last) {
/*Calc. the next y coordinates of draw_buf*/
draw_buf->area.x1 = area_p->x1;
draw_buf->area.x2 = area_p->x2;
draw_buf->area.y1 = row;
draw_buf->area.y2 = y2;
disp_refr->driver->draw_buf->last_part = 1;
lv_refr_area_part(area_p);
}
}
+8 -8
View File
@@ -701,8 +701,8 @@ LV_ATTRIBUTE_FAST_MEM static void map_normal(const lv_area_t * disp_area, lv_col
blit.src_stride = lv_area_get_width(map_area) * sizeof(lv_color_t);
blit.src_area.x1 = (draw_area->x1 - (map_area->x1 - disp_area->x1));
blit.src_area.y1 = (draw_area->y1 - (map_area->y1 - disp_area->y1));
blit.src_area.x2 = blit.src_area.x1 + draw_area_w;
blit.src_area.y2 = blit.src_area.y1 + draw_area_h;
blit.src_area.x2 = blit.src_area.x1 + draw_area_w - 1;
blit.src_area.y2 = blit.src_area.y1 + draw_area_h - 1;
blit.dst = disp_buf;
blit.dst_width = lv_area_get_width(disp_area);
@@ -710,8 +710,8 @@ LV_ATTRIBUTE_FAST_MEM static void map_normal(const lv_area_t * disp_area, lv_col
blit.dst_stride = lv_area_get_width(disp_area) * sizeof(lv_color_t);
blit.dst_area.x1 = draw_area->x1;
blit.dst_area.y1 = draw_area->y1;
blit.dst_area.x2 = blit.dst_area.x1 + draw_area_w;
blit.dst_area.y2 = blit.dst_area.y1 + draw_area_h;
blit.dst_area.x2 = blit.dst_area.x1 + draw_area_w - 1;
blit.dst_area.y2 = blit.dst_area.y1 + draw_area_h - 1;
blit.opa = opa;
@@ -751,8 +751,8 @@ LV_ATTRIBUTE_FAST_MEM static void map_normal(const lv_area_t * disp_area, lv_col
blit.src_stride = lv_area_get_width(map_area) * sizeof(lv_color_t);
blit.src_area.x1 = (draw_area->x1 - (map_area->x1 - disp_area->x1));
blit.src_area.y1 = (draw_area->y1 - (map_area->y1 - disp_area->y1));
blit.src_area.x2 = blit.src_area.x1 + draw_area_w;
blit.src_area.y2 = blit.src_area.y1 + draw_area_h;
blit.src_area.x2 = blit.src_area.x1 + draw_area_w - 1;
blit.src_area.y2 = blit.src_area.y1 + draw_area_h - 1;
blit.dst = disp_buf;
blit.dst_width = lv_area_get_width(disp_area);
@@ -760,8 +760,8 @@ LV_ATTRIBUTE_FAST_MEM static void map_normal(const lv_area_t * disp_area, lv_col
blit.dst_stride = lv_area_get_width(disp_area) * sizeof(lv_color_t);
blit.dst_area.x1 = draw_area->x1;
blit.dst_area.y1 = draw_area->y1;
blit.dst_area.x2 = blit.dst_area.x1 + draw_area_w;
blit.dst_area.y2 = blit.dst_area.y1 + draw_area_h;
blit.dst_area.x2 = blit.dst_area.x1 + draw_area_w - 1;
blit.dst_area.y2 = blit.dst_area.y1 + draw_area_h - 1;
blit.opa = opa;
+10 -7
View File
@@ -113,6 +113,7 @@ void lv_obj_set_flex_align(lv_obj_t * obj, lv_flex_align_t main_place, lv_flex_a
void lv_obj_set_flex_grow(lv_obj_t * obj, uint8_t grow)
{
lv_obj_set_style_flex_grow(obj, grow, 0);
lv_obj_mark_layout_as_dirty(lv_obj_get_parent(obj));
}
@@ -342,8 +343,10 @@ static int32_t find_track_end(lv_obj_t * cont, flex_t * f, int32_t item_start_id
LV_ASSERT_MALLOC(new_dsc);
if(new_dsc == NULL) return item_id;
lv_memcpy(new_dsc, t->grow_dsc, sizeof(grow_dsc_t) * (t->grow_item_cnt - 1));
lv_mem_buf_release(t->grow_dsc);
if(t->grow_dsc) {
lv_memcpy(new_dsc, t->grow_dsc, sizeof(grow_dsc_t) * (t->grow_item_cnt - 1));
lv_mem_buf_release(t->grow_dsc);
}
new_dsc[t->grow_item_cnt - 1].item = item;
new_dsc[t->grow_item_cnt - 1].min_size = f->row ? lv_obj_get_style_min_width(item, LV_PART_MAIN) : lv_obj_get_style_min_height(item, LV_PART_MAIN);
new_dsc[t->grow_item_cnt - 1].max_size = f->row ? lv_obj_get_style_max_width(item, LV_PART_MAIN) : lv_obj_get_style_max_height(item, LV_PART_MAIN);
@@ -453,16 +456,16 @@ static void children_repos(lv_obj_t * cont, flex_t * f, int32_t item_first_id, i
break;
}
}
lv_area_t old_coords;
lv_area_copy(&old_coords, &item->coords);
area_set_main_size(&item->coords, s);
if(f->row) item->w_layout = 1;
else item->h_layout = 1;
if(area_get_main_size(&old_coords) != area_get_main_size(&item->coords)) {
if(s != area_get_main_size(&item->coords)) {
lv_obj_invalidate(item);
lv_area_t old_coords;
lv_area_copy(&old_coords, &item->coords);
area_set_main_size(&item->coords, s);
lv_event_send(item, LV_EVENT_SIZE_CHANGED, &old_coords);
lv_event_send(lv_obj_get_parent(item), LV_EVENT_CHILD_CHANGED, item);
lv_obj_invalidate(item);
+4 -21
View File
@@ -50,7 +50,6 @@ static lv_opa_t lv_span_get_style_text_blend_mode(lv_obj_t * par, lv_span_t * sp
static int32_t lv_span_get_style_text_decor(lv_obj_t * par, lv_span_t * span);
static inline void span_text_check(const char ** text);
static inline bool is_break_char(uint32_t letter);
static void get_txt_coords(const lv_obj_t * span, lv_area_t * area);
static void lv_draw_span(lv_obj_t * spans, const lv_area_t * coords, const lv_area_t * mask);
static bool lv_txt_get_snippet(const char * txt, const lv_font_t * font, lv_coord_t letter_space,
@@ -442,9 +441,9 @@ lv_coord_t lv_spangroup_get_expand_height(lv_obj_t * obj, lv_coord_t width)
/* break word deal width */
if(isfill && next_ofs > 0 && snippet_cnt > 0) {
uint32_t letter = (uint32_t)cur_txt[cur_txt_ofs + next_ofs - 1];
if(!(letter == '\0' || letter == '\n' || letter == '\r' || is_break_char(letter))) {
if(!(letter == '\0' || letter == '\n' || letter == '\r' || _lv_txt_is_break_char(letter))) {
letter = (uint32_t)cur_txt[cur_txt_ofs + next_ofs];
if(!(letter == '\0' || letter == '\n' || letter == '\r' || is_break_char(letter))) {
if(!(letter == '\0' || letter == '\n' || letter == '\r' || _lv_txt_is_break_char(letter))) {
break;
}
}
@@ -694,22 +693,6 @@ static inline void span_text_check(const char ** text)
}
}
static inline bool is_break_char(uint32_t letter)
{
uint8_t i;
bool ret = false;
/*Compare the letter to TXT_BREAK_CHARS*/
for(i = 0; LV_TXT_BREAK_CHARS[i] != '\0'; i++) {
if(letter == (uint32_t)LV_TXT_BREAK_CHARS[i]) {
ret = true; /*If match then it is break char*/
break;
}
}
return ret;
}
/**
* draw span group
* @param spans obj handle
@@ -788,9 +771,9 @@ static void lv_draw_span(lv_obj_t * obj, const lv_area_t * coords, const lv_area
/* break word deal width */
if(isfill && next_ofs > 0 && lv_get_snippet_cnt() > 0) {
uint32_t letter = (uint32_t)cur_txt[cur_txt_ofs + next_ofs - 1];
if(!(letter == '\0' || letter == '\n' || letter == '\r' || is_break_char(letter))) {
if(!(letter == '\0' || letter == '\n' || letter == '\r' || _lv_txt_is_break_char(letter))) {
letter = (uint32_t)cur_txt[cur_txt_ofs + next_ofs];
if(!(letter == '\0' || letter == '\n' || letter == '\r' || is_break_char(letter))) {
if(!(letter == '\0' || letter == '\n' || letter == '\r' || _lv_txt_is_break_char(letter))) {
break;
}
}
+17
View File
@@ -145,6 +145,23 @@ void lv_spinbox_set_range(lv_obj_t * obj, int32_t range_min, int32_t range_max)
lv_spinbox_updatevalue(obj);
}
/**
* Set cursor position to a specific digit for edition
* @param spinbox pointer to spinbox
* @param pos selected position in spinbox
*/
void lv_spinbox_set_pos(lv_obj_t * obj, uint8_t pos)
{
lv_spinbox_t * spinbox = (lv_spinbox_t *)obj;
int32_t step_limit;
step_limit = LV_MAX(spinbox->range_max, (spinbox->range_min < 0 ? (-spinbox->range_min) : spinbox->range_min));
int32_t new_step = spinbox->step * lv_pow(10, pos);
if(pos <= 0) spinbox->step = 1;
else if(new_step <= step_limit) spinbox->step = new_step;
lv_spinbox_updatevalue(obj);
}
/*=====================
* Getter functions
*====================*/
+6
View File
@@ -99,6 +99,12 @@ void lv_spinbox_set_step(lv_obj_t * obj, uint32_t step);
*/
void lv_spinbox_set_range(lv_obj_t * obj, int32_t range_min, int32_t range_max);
/**
* Set cursor position to a specific digit for edition
* @param spinbox pointer to spinbox
* @param pos selected position in spinbox
*/
void lv_spinbox_set_pos(lv_obj_t * obj, uint8_t pos);
/*=====================
* Getter functions
*====================*/
+9 -37
View File
@@ -71,8 +71,6 @@ static void lv_gpu_nxp_pxp_run(void);
static void lv_gpu_nxp_pxp_blit_recolor(lv_color_t * dest, lv_coord_t dest_width, const lv_color_t * src,
lv_coord_t src_width,
lv_coord_t copy_width, lv_coord_t copy_height, lv_opa_t opa, lv_color_t recolor, lv_opa_t recolorOpa);
static void lv_gpu_nxp_invalidate_cache(uint32_t address, uint32_t width, uint32_t height, uint32_t stride,
uint32_t pxSize);
/**********************
* STATIC VARIABLES
@@ -160,8 +158,7 @@ void lv_gpu_nxp_pxp_fill(lv_color_t * dest_buf, lv_coord_t dest_width, const lv_
.width = fill_area->x2 - fill_area->x1 + 1,
.height = fill_area->y2 - fill_area->y1 + 1,
};
lv_gpu_nxp_invalidate_cache(outputConfig.buffer0Addr, outputConfig.width, outputConfig.height, outputConfig.pitchBytes,
sizeof(lv_color_t));
PXP_SetOutputBufferConfig(LV_GPU_NXP_PXP_ID, &outputConfig);
if(opa > LV_OPA_MAX) {
@@ -272,9 +269,6 @@ void lv_gpu_nxp_pxp_blit(lv_color_t * dest, lv_coord_t dest_width, const lv_colo
PXP_SetAlphaSurfacePosition(LV_GPU_NXP_PXP_ID, 0U, 0U, copy_width - 1U, copy_height - 1U);
PXP_SetAlphaSurfaceBlendConfig(LV_GPU_NXP_PXP_ID, &asBlendConfig);
lv_gpu_nxp_invalidate_cache(asBufferConfig.bufferAddr, copy_width, copy_height, asBufferConfig.pitchBytes,
sizeof(lv_color_t));
if(colorKeyEnabled) {
PXP_SetAlphaSurfaceOverlayColorKey(LV_GPU_NXP_PXP_ID, colorKey, colorKey);
}
@@ -290,10 +284,7 @@ void lv_gpu_nxp_pxp_blit(lv_color_t * dest, lv_coord_t dest_width, const lv_colo
outputBufferConfig.height = copy_height;
PXP_SetOutputBufferConfig(LV_GPU_NXP_PXP_ID, &outputBufferConfig);
lv_gpu_nxp_invalidate_cache(outputBufferConfig.buffer0Addr, outputBufferConfig.width, outputBufferConfig.height,
outputBufferConfig.pitchBytes, sizeof(lv_color_t));
lv_gpu_nxp_pxp_run(); /*Start PXP task*/
lv_gpu_nxp_pxp_run(); /* Start PXP task */
}
/**
@@ -349,6 +340,12 @@ void lv_gpu_nxp_pxp_disable_recolor(void)
*/
static void lv_gpu_nxp_pxp_run(void)
{
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
if(disp && disp->driver->clean_dcache_cb) { /* Clean & invalidate cache */
disp->driver->clean_dcache_cb(disp->driver);
}
pxp_cfg.pxp_run();
}
@@ -396,9 +393,6 @@ static void lv_gpu_nxp_pxp_blit_recolor(lv_color_t * dest, lv_coord_t dest_width
PXP_SetAlphaSurfaceBufferConfig(LV_GPU_NXP_PXP_ID, &asBufferConfig);
PXP_SetAlphaSurfacePosition(LV_GPU_NXP_PXP_ID, 0U, 0U, copy_width - 1U, copy_height - 1U);
lv_gpu_nxp_invalidate_cache(asBufferConfig.bufferAddr, copy_width, copy_height, asBufferConfig.pitchBytes,
sizeof(lv_color_t));
/*Disable PS buffer, use as color generator*/
PXP_SetProcessSurfacePosition(LV_GPU_NXP_PXP_ID, 0xFFFFU, 0xFFFFU, 0U, 0U);
PXP_SetProcessSurfaceBackGroundColor(LV_GPU_NXP_PXP_ID, lv_color_to32(recolor));
@@ -413,9 +407,6 @@ static void lv_gpu_nxp_pxp_blit_recolor(lv_color_t * dest, lv_coord_t dest_width
outputBufferConfig.height = copy_height;
PXP_SetOutputBufferConfig(LV_GPU_NXP_PXP_ID, &outputBufferConfig);
lv_gpu_nxp_invalidate_cache(outputBufferConfig.buffer0Addr, outputBufferConfig.width, outputBufferConfig.height,
outputBufferConfig.pitchBytes, sizeof(lv_color_t));
pxp_porter_duff_config_t pdConfig;
/*Configure Porter-Duff blending - For RGB 565 only!*/
@@ -454,23 +445,4 @@ static void lv_gpu_nxp_pxp_blit_recolor(lv_color_t * dest, lv_coord_t dest_width
}
}
/**
* @brief Invalidate cache for rectangular area of memory
*
* @param[in] address starting address of area
* @param[in] width width of area in pixels
* @param[in] height height of area in pixels
* @param[in] stride stride in bytes
* @param[in] pxSize pixel size in bytes
*/
static void lv_gpu_nxp_invalidate_cache(uint32_t address, uint32_t width, uint32_t height, uint32_t stride,
uint32_t pxSize)
{
int y;
for(y = 0; y < height; y++) {
DCACHE_CleanInvalidateByRange(address, width * pxSize);
address += stride;
}
}
#endif /*LV_USE_GPU && LV_USE_GPU_NXP_PXP*/
#endif /* LV_USE_GPU_NXP_PXP */
+5
View File
@@ -61,6 +61,11 @@ extern "C" {
#define LV_GPU_NXP_PXP_BLIT_OPA_SIZE_LIMIT 16
#endif
#ifndef LV_GPU_NXP_PXP_BUFF_SYNC_BLIT_SIZE_LIMIT
/** Minimum invalidated area (in pixels) to be synchronized by PXP during buffer sync */
#define LV_GPU_NXP_PXP_BUFF_SYNC_BLIT_SIZE_LIMIT 32
#endif
#ifndef LV_GPU_NXP_PXP_FILL_SIZE_LIMIT
/** Minimum area (in pixels) to be filled by PXP with 100% opacity*/
#define LV_GPU_NXP_PXP_FILL_SIZE_LIMIT 64
+9 -8
View File
@@ -32,13 +32,14 @@
*********************/
#include "../lv_conf_internal.h"
#include "../misc/lv_log.h"
#if LV_USE_GPU_NXP_PXP && LV_USE_GPU_NXP_PXP_AUTO_INIT
#include "lv_gpu_nxp_pxp.h"
#include "fsl_pxp.h"
#if defined(FSL_RTOS_FREE_RTOS)
#if defined(SDK_OS_FREE_RTOS)
#include "FreeRTOS.h"
#include "semphr.h"
#endif
@@ -62,7 +63,7 @@ static void _lv_gpu_nxp_pxp_run(void);
* STATIC VARIABLES
**********************/
#if defined(FSL_RTOS_FREE_RTOS)
#if defined(SDK_OS_FREE_RTOS)
static SemaphoreHandle_t s_pxpIdle;
#else
static volatile bool s_pxpIdle;
@@ -81,13 +82,13 @@ static void _lv_gpu_nxp_pxp_run(void);
*/
void PXP_IRQHandler(void)
{
#if defined(FSL_RTOS_FREE_RTOS)
#if defined(SDK_OS_FREE_RTOS)
BaseType_t taskAwake = pdFALSE;
#endif
if(kPXP_CompleteFlag & PXP_GetStatusFlags(LV_GPU_NXP_PXP_ID)) {
PXP_ClearStatusFlags(LV_GPU_NXP_PXP_ID, kPXP_CompleteFlag);
#if defined(FSL_RTOS_FREE_RTOS)
#if defined(SDK_OS_FREE_RTOS)
xSemaphoreGiveFromISR(s_pxpIdle, &taskAwake);
portYIELD_FROM_ISR(taskAwake);
#else
@@ -106,7 +107,7 @@ void PXP_IRQHandler(void)
*/
static lv_res_t _lv_gpu_nxp_pxp_interrupt_init(void)
{
#if defined(FSL_RTOS_FREE_RTOS)
#if defined(SDK_OS_FREE_RTOS)
s_pxpIdle = xSemaphoreCreateBinary();
if(s_pxpIdle == NULL) {
return LV_RES_INV;
@@ -128,7 +129,7 @@ static lv_res_t _lv_gpu_nxp_pxp_interrupt_init(void)
static void _lv_gpu_nxp_pxp_interrupt_deinit(void)
{
NVIC_DisableIRQ(LV_GPU_NXP_PXP_IRQ_ID);
#if defined(FSL_RTOS_FREE_RTOS)
#if defined(SDK_OS_FREE_RTOS)
vSemaphoreDelete(s_pxpIdle);
#endif
}
@@ -138,14 +139,14 @@ static void _lv_gpu_nxp_pxp_interrupt_deinit(void)
*/
static void _lv_gpu_nxp_pxp_run(void)
{
#if !defined(FSL_RTOS_FREE_RTOS)
#if !defined(SDK_OS_FREE_RTOS)
s_pxpIdle = false;
#endif
PXP_EnableInterrupts(LV_GPU_NXP_PXP_ID, kPXP_CompleteInterruptEnable);
PXP_Start(LV_GPU_NXP_PXP_ID);
#if defined(FSL_RTOS_FREE_RTOS)
#if defined(SDK_OS_FREE_RTOS)
if(xSemaphoreTake(s_pxpIdle, portMAX_DELAY) != pdTRUE) {
LV_LOG_ERROR("xSemaphoreTake error. Task halted.");
for(; ;) ;
File diff suppressed because it is too large Load Diff
+10 -2
View File
@@ -43,8 +43,11 @@ extern "C" {
* DEFINES
*********************/
/** Stride in px required by VG-Lite HW. Don't change this.*/
#define LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX 16
/** Use this symbol as limit to disable feature (value has to be larger than supported resolution) */
#define LV_GPU_NXP_VG_LITE_FEATURE_DISABLED (1920*1080+1)
/** Stride in px required by VG-Lite HW. Don't change this. */
#define LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX 16U
#ifndef LV_GPU_NXP_VG_LITE_FILL_SIZE_LIMIT
/** Minimum area (in pixels) to be filled by VG-Lite with 100% opacity*/
@@ -61,6 +64,11 @@ extern "C" {
#define LV_GPU_NXP_VG_LITE_BLIT_SIZE_LIMIT 32
#endif
#ifndef LV_GPU_NXP_VG_LITE_BUFF_SYNC_BLIT_SIZE_LIMIT
/** Minimum invalidated area (in pixels) to be synchronized by VG-Lite during buffer sync */
#define LV_GPU_NXP_VG_LITE_BUFF_SYNC_BLIT_SIZE_LIMIT 32
#endif
#ifndef LV_GPU_NXP_VG_LITE_BLIT_OPA_SIZE_LIMIT
/** Minimum area (in pixels) for image copy with transparency to be handled by VG-Lite*/
#define LV_GPU_NXP_VG_LITE_BLIT_OPA_SIZE_LIMIT 32
+1 -1
View File
@@ -307,7 +307,7 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h"*/
#endif
#if LV_USE_GPU_NXP_PXP
/*1: Add default bare metal and FreeRTOS interrupt handling routines for PXP (lv_gpu_nxp_pxp_osa.c)
* and call lv_gpu_nxp_pxp_init() automatically during lv_init(). Note that symbol FSL_RTOS_FREE_RTOS
* and call lv_gpu_nxp_pxp_init() automatically during lv_init(). Note that symbol SDK_OS_FREE_RTOS
* has to be defined in order to use FreeRTOS OSA, otherwise bare-metal implementation is selected.
*0: lv_gpu_nxp_pxp_init() has to be called manually before lv_init()
*/
+1 -1
View File
@@ -43,7 +43,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_color_fill(lv_color_t * buf, lv_color_t color, uin
px_num--;
}
uint32_t c32 = color.full + (color.full << 16);
uint32_t c32 = (uint32_t)color.full + ((uint32_t)color.full << 16);
uint32_t * buf32 = (uint32_t *)buf;
while(px_num > 16) {
+1 -27
View File
@@ -26,7 +26,6 @@
/**********************
* STATIC PROTOTYPES
**********************/
static inline bool is_break_char(uint32_t letter);
#if LV_TXT_ENC == LV_TXT_ENC_UTF8
static uint8_t lv_txt_utf8_size(const char * str);
@@ -224,7 +223,7 @@ static uint32_t lv_txt_get_next_word(const char * txt, const lv_font_t * font,
}
/*Check for new line chars and breakchars*/
if(letter == '\n' || letter == '\r' || is_break_char(letter)) {
if(letter == '\n' || letter == '\r' || _lv_txt_is_break_char(letter)) {
/*Update the output width on the first character if it fits.
*Must do this here in case first letter is a break character.*/
if(i == 0 && break_index == NO_BREAK_FOUND && word_w_ptr != NULL) *word_w_ptr = cur_w;
@@ -895,28 +894,3 @@ static uint32_t lv_txt_iso8859_1_get_length(const char * txt)
#error "Invalid character encoding. See `LV_TXT_ENC` in `lv_conf.h`"
#endif
/**********************
* STATIC FUNCTIONS
**********************/
/**
* Test if char is break char or not (a text can broken here or not)
* @param letter a letter
* @return false: 'letter' is not break char
*/
static inline bool is_break_char(uint32_t letter)
{
uint8_t i;
bool ret = false;
/*Compare the letter to TXT_BREAK_CHARS*/
for(i = 0; LV_TXT_BREAK_CHARS[i] != '\0'; i++) {
if(letter == (uint32_t)LV_TXT_BREAK_CHARS[i]) {
ret = true; /*If match then it is break char*/
break;
}
}
return ret;
}
+26
View File
@@ -154,6 +154,32 @@ char * _lv_txt_set_text_vfmt(const char * fmt, va_list ap);
*/
void _lv_txt_encoded_letter_next_2(const char * txt, uint32_t * letter, uint32_t * letter_next, uint32_t *ofs);
/**
* Test if char is break char or not (a text can broken here or not)
* @param letter a letter
* @return false: 'letter' is not break char
*/
static inline bool _lv_txt_is_break_char(uint32_t letter)
{
uint8_t i;
bool ret = false;
/* each chinese character can be break */
if (letter >= 0x4E00 && letter <= 0x9FA5) {
return true;
}
/*Compare the letter to TXT_BREAK_CHARS*/
for(i = 0; LV_TXT_BREAK_CHARS[i] != '\0'; i++) {
if(letter == (uint32_t)LV_TXT_BREAK_CHARS[i]) {
ret = true; /*If match then it is break char*/
break;
}
}
return ret;
}
/***************************************************************
* GLOBAL FUNCTION POINTERS FOR CHARACTER ENCODING INTERFACE
***************************************************************/
-4
View File
@@ -112,10 +112,6 @@ static void lv_switch_event(const lv_obj_class_t * class_p, lv_event_t * e)
*s = LV_MAX(*s, lv_obj_calculate_ext_draw_size(obj, LV_PART_INDICATOR));
}
else if(code == LV_EVENT_CLICKED) {
uint32_t v = lv_obj_get_state(obj) & LV_STATE_CHECKED ? 1 : 0;
res = lv_event_send(obj, LV_EVENT_VALUE_CHANGED, &v);
if(res != LV_RES_OK) return;
lv_obj_invalidate(obj);
}
else if(code == LV_EVENT_DRAW_MAIN) {