diff options
| author | jacqueline <me@jacqueline.id.au> | 2023-06-01 15:41:47 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2023-06-01 15:41:47 +1000 |
| commit | dd27c3530432ea0b09f01e604bf577f31d8ef841 (patch) | |
| tree | bbf86cf81a78f0ff0b07f31f1c390db473f26fd3 /lib/lvgl/examples/widgets/led | |
| parent | 6fd588e970470b15936187980829916d0dbe77bb (diff) | |
| download | tangara-fw-dd27c3530432ea0b09f01e604bf577f31d8ef841.tar.gz | |
convert lvgl from submodule to a plain old directory
Diffstat (limited to 'lib/lvgl/examples/widgets/led')
| m--------- | lib/lvgl | 0 | ||||
| -rw-r--r-- | lib/lvgl/examples/widgets/led/index.rst | 7 | ||||
| -rw-r--r-- | lib/lvgl/examples/widgets/led/lv_example_led_1.c | 26 | ||||
| -rw-r--r-- | lib/lvgl/examples/widgets/led/lv_example_led_1.py | 20 |
4 files changed, 53 insertions, 0 deletions
diff --git a/lib/lvgl b/lib/lvgl deleted file mode 160000 -Subproject 0732400e7b564dd0e7dc4a924619d8e19c5b23a diff --git a/lib/lvgl/examples/widgets/led/index.rst b/lib/lvgl/examples/widgets/led/index.rst new file mode 100644 index 00000000..abfa810c --- /dev/null +++ b/lib/lvgl/examples/widgets/led/index.rst @@ -0,0 +1,7 @@ + +LED with custom style +""""""""""""""""""""" + +.. lv_example:: widgets/led/lv_example_led_1 + :language: c + diff --git a/lib/lvgl/examples/widgets/led/lv_example_led_1.c b/lib/lvgl/examples/widgets/led/lv_example_led_1.c new file mode 100644 index 00000000..f06f31ef --- /dev/null +++ b/lib/lvgl/examples/widgets/led/lv_example_led_1.c @@ -0,0 +1,26 @@ +#include "../../lv_examples.h" +#if LV_USE_LED && LV_BUILD_EXAMPLES + +/** + * Create LED's with different brightness and color + */ +void lv_example_led_1(void) +{ + /*Create a LED and switch it OFF*/ + lv_obj_t * led1 = lv_led_create(lv_scr_act()); + lv_obj_align(led1, LV_ALIGN_CENTER, -80, 0); + lv_led_off(led1); + + /*Copy the previous LED and set a brightness*/ + lv_obj_t * led2 = lv_led_create(lv_scr_act()); + lv_obj_align(led2, LV_ALIGN_CENTER, 0, 0); + lv_led_set_brightness(led2, 150); + lv_led_set_color(led2, lv_palette_main(LV_PALETTE_RED)); + + /*Copy the previous LED and switch it ON*/ + lv_obj_t * led3 = lv_led_create(lv_scr_act()); + lv_obj_align(led3, LV_ALIGN_CENTER, 80, 0); + lv_led_on(led3); +} + +#endif diff --git a/lib/lvgl/examples/widgets/led/lv_example_led_1.py b/lib/lvgl/examples/widgets/led/lv_example_led_1.py new file mode 100644 index 00000000..5e1b1267 --- /dev/null +++ b/lib/lvgl/examples/widgets/led/lv_example_led_1.py @@ -0,0 +1,20 @@ +# +# Create LED's with different brightness and color +# + +# Create a LED and switch it OFF +led1 = lv.led(lv.scr_act()) +led1.align(lv.ALIGN.CENTER, -80, 0) +led1.off() + +# Copy the previous LED and set a brightness +led2 = lv.led(lv.scr_act()) +led2.align(lv.ALIGN.CENTER, 0, 0) +led2.set_brightness(150) +led2.set_color(lv.palette_main(lv.PALETTE.RED)) + +# Copy the previous LED and switch it ON +led3 = lv.led(lv.scr_act()) +led3.align(lv.ALIGN.CENTER, 80, 0) +led3.on() + |
