From dd27c3530432ea0b09f01e604bf577f31d8ef841 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Thu, 1 Jun 2023 15:41:47 +1000 Subject: convert lvgl from submodule to a plain old directory --- lib/lvgl | 1 - lib/lvgl/examples/widgets/line/index.rst | 7 +++++++ lib/lvgl/examples/widgets/line/lv_example_line_1.c | 24 ++++++++++++++++++++++ .../examples/widgets/line/lv_example_line_1.py | 20 ++++++++++++++++++ 4 files changed, 51 insertions(+), 1 deletion(-) delete mode 160000 lib/lvgl create mode 100644 lib/lvgl/examples/widgets/line/index.rst create mode 100644 lib/lvgl/examples/widgets/line/lv_example_line_1.c create mode 100644 lib/lvgl/examples/widgets/line/lv_example_line_1.py (limited to 'lib/lvgl/examples/widgets/line') diff --git a/lib/lvgl b/lib/lvgl deleted file mode 160000 index 0732400e..00000000 --- a/lib/lvgl +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 0732400e7b564dd0e7dc4a924619d8e19c5b23a0 diff --git a/lib/lvgl/examples/widgets/line/index.rst b/lib/lvgl/examples/widgets/line/index.rst new file mode 100644 index 00000000..156359a7 --- /dev/null +++ b/lib/lvgl/examples/widgets/line/index.rst @@ -0,0 +1,7 @@ + +Simple Line +"""""""""""""""" + +.. lv_example:: widgets/line/lv_example_line_1 + :language: c + diff --git a/lib/lvgl/examples/widgets/line/lv_example_line_1.c b/lib/lvgl/examples/widgets/line/lv_example_line_1.c new file mode 100644 index 00000000..9c120a29 --- /dev/null +++ b/lib/lvgl/examples/widgets/line/lv_example_line_1.c @@ -0,0 +1,24 @@ +#include "../../lv_examples.h" +#if LV_USE_LINE && LV_BUILD_EXAMPLES + +void lv_example_line_1(void) +{ + /*Create an array for the points of the line*/ + static lv_point_t line_points[] = { {5, 5}, {70, 70}, {120, 10}, {180, 60}, {240, 10} }; + + /*Create style*/ + static lv_style_t style_line; + lv_style_init(&style_line); + lv_style_set_line_width(&style_line, 8); + lv_style_set_line_color(&style_line, lv_palette_main(LV_PALETTE_BLUE)); + lv_style_set_line_rounded(&style_line, true); + + /*Create a line and apply the new style*/ + lv_obj_t * line1; + line1 = lv_line_create(lv_scr_act()); + lv_line_set_points(line1, line_points, 5); /*Set the points*/ + lv_obj_add_style(line1, &style_line, 0); + lv_obj_center(line1); +} + +#endif diff --git a/lib/lvgl/examples/widgets/line/lv_example_line_1.py b/lib/lvgl/examples/widgets/line/lv_example_line_1.py new file mode 100644 index 00000000..3a5822ff --- /dev/null +++ b/lib/lvgl/examples/widgets/line/lv_example_line_1.py @@ -0,0 +1,20 @@ +# Create an array for the points of the line +line_points = [ {"x":5, "y":5}, + {"x":70, "y":70}, + {"x":120, "y":10}, + {"x":180, "y":60}, + {"x":240, "y":10}] + +# Create style +style_line = lv.style_t() +style_line.init() +style_line.set_line_width(8) +style_line.set_line_color(lv.palette_main(lv.PALETTE.BLUE)) +style_line.set_line_rounded(True) + +# Create a line and apply the new style +line1 = lv.line(lv.scr_act()) +line1.set_points(line_points, 5) # Set the points +line1.add_style(style_line, 0) +line1.center() + -- cgit v1.2.3