This is an automated email from the ASF dual-hosted git repository.

rymek pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit fee8e5fc62eb85422e59ef17e88e42569378b940
Author: Jerzy Kasenberg <jerzy.kasenb...@codecoup.pl>
AuthorDate: Thu Mar 2 15:56:30 2023 +0100

    apps: Add LVGL demos
    
    This adds application that allows to run LVGL provided
    demos. Several demos can be selected by LVGL_DEMO syscfg value.
---
 apps/lvgl/demo/README.md  | 91 +++++++++++++++++++++++++++++++++++++++++++++++
 apps/lvgl/demo/pkg.yml    | 32 +++++++++++++++++
 apps/lvgl/demo/src/main.c | 54 ++++++++++++++++++++++++++++
 apps/lvgl/demo/syscfg.yml | 31 ++++++++++++++++
 4 files changed, 208 insertions(+)

diff --git a/apps/lvgl/demo/README.md b/apps/lvgl/demo/README.md
new file mode 100644
index 000000000..cce212d6c
--- /dev/null
+++ b/apps/lvgl/demo/README.md
@@ -0,0 +1,91 @@
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+-->
+
+# LVGL demo
+
+## Overview
+
+This application allows to run LVGL demos in mynewt environment.
+Following LVGL demos can be selected in the syscfg.yml of the target by 
settings **LVGL_DEMO** variable to one of the following:
+- benchmark
+- flex_layout
+- keypad_encoder
+- music
+- stress
+- widgets
+
+#### Several displays are supported:
+- ILI9341 (240x320)
+- ILI9486 (320x480)
+- ST7735S (128x160)
+- ST7789  (240x320)
+- GC9A01  (240x240)
+
+#### Two touch screen controllers:
+- XPT2046
+- STMPE610
+
+### Example display boards with configuration
+- Adafruit 2.8" https://www.adafruit.com/product/1651
+suscfg.yml values
+```yaml
+    LVGL_ILI9341: 1
+    LVGL_STMPE610: 1
+
+    LCD_ITF: spi
+    LCD_SPI_DEV_NAME: '"spi0"'
+    LCD_SPI_FREQ: 16000
+    LCD_CS_PIN: ARDUINO_PIN_D10
+    LCD_DC_PIN: ARDUINO_PIN_D9
+    LCD_BL_PIN: ARDUINO_PIN_D3
+    LCD_RESET_PIN: -1
+
+    STMPE610_SPI_DEV_NAME: '"spi0"'
+    STMPE610_SPI_CS_PIN: ARDUINO_PIN_D8
+    STMPE610_SPI_FREQ: 1200
+
+```
+- Waveshare 3.5" https://www.waveshare.com/3.5inch-tft-touch-shield.htm
+  suscfg.yml values
+```yaml
+    LVGL_ILI9486: 1
+    LVGL_XPT2046: 1
+
+    LCD_ITF: spi
+    LCD_SPI_DEV_NAME: '"spi0"'
+    LCD_SPI_WITH_SHIFT_REGISTER: 1
+    LCD_SPI_FREQ: 32000
+    LCD_CS_PIN: ARDUINO_PIN_D10
+    LCD_DC_PIN: ARDUINO_PIN_D7
+    LCD_BL_PIN: ARDUINO_PIN_D9
+    LCD_RESET_PIN: ARDUINO_PIN_D8
+
+    XPT2046_SPI_DEV_NAME: '"spi0"'
+    XPT2046_SPI_FREQ: 1200
+    XPT2046_SPI_CS_PIN: ARDUINO_PIN_D4
+    XPT2046_INT_PIN: ARDUINO_PIN_D3
+    XPT2046_XY_SWAP: 1
+    XPT2046_X_INV: 1
+    XPT2046_Y_INV: 1
+    XPT2046_MIN_X: 300
+    XPT2046_MIN_Y: 300
+
+```
diff --git a/apps/lvgl/demo/pkg.yml b/apps/lvgl/demo/pkg.yml
new file mode 100644
index 000000000..6c7b9a742
--- /dev/null
+++ b/apps/lvgl/demo/pkg.yml
@@ -0,0 +1,32 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+pkg.name: apps/lvgl/demo
+pkg.type: app
+pkg.description: Application that runs LVGL demos.
+pkg.author: "Apache Mynewt <d...@mynewt.apache.org>"
+pkg.homepage: "http://mynewt.apache.org/";
+pkg.keywords:
+
+pkg.deps:
+    - "@apache-mynewt-core/sys/log"
+    - "@apache-mynewt-core/sys/console"
+    - "@apache-mynewt-core/hw/drivers/display/lvgl"
+
+pkg.cflags:
diff --git a/apps/lvgl/demo/src/main.c b/apps/lvgl/demo/src/main.c
new file mode 100644
index 000000000..f087e9e0f
--- /dev/null
+++ b/apps/lvgl/demo/src/main.c
@@ -0,0 +1,54 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <assert.h>
+
+#include <sysinit/sysinit.h>
+#include <os/os.h>
+#include <demos/benchmark/lv_demo_benchmark.h>
+#include <demos/music/lv_demo_music.h>
+#include <demos/stress/lv_demo_stress.h>
+#include <demos/widgets/lv_demo_widgets.h>
+#include <examples/widgets/lv_example_widgets.h>
+#include "hal/hal_gpio.h"
+#include <console/console.h>
+
+int
+main(int argc, char **argv)
+{
+    sysinit();
+
+    if (MYNEWT_VAL_CHOICE(LVGL_DEMO, benchmark)) {
+        lv_demo_benchmark_run_scene(31);
+    } else if (MYNEWT_VAL_CHOICE(LVGL_DEMO, keypad_encoder)) {
+        lv_demo_keypad_encoder();
+    } else if (MYNEWT_VAL_CHOICE(LVGL_DEMO, music)) {
+        lv_demo_music();
+    } else if (MYNEWT_VAL_CHOICE(LVGL_DEMO, stress)) {
+        lv_demo_stress();
+    } else if (MYNEWT_VAL_CHOICE(LVGL_DEMO, widgets)) {
+        lv_demo_widgets();
+    }
+
+    while (1) {
+        os_eventq_run(os_eventq_dflt_get());
+    }
+    return 0;
+}
+
diff --git a/apps/lvgl/demo/syscfg.yml b/apps/lvgl/demo/syscfg.yml
new file mode 100644
index 000000000..ccd86a1c4
--- /dev/null
+++ b/apps/lvgl/demo/syscfg.yml
@@ -0,0 +1,31 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+syscfg.defs:
+    LVGL_DEMO:
+        description: LVGL demo to run.
+        choices:
+            - benchmark
+            - flex_layout
+            - keypad_encoder
+            - music
+            - stress
+            - widgets
+        value: widgets
+
+syscfg.vals:

Reply via email to