Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 20 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
# Demo
# Demo

\[ English | [简体中文](README_zh-cn.md) \]

## Overview
## Overview

This repository implements examples of openvela native application code. Developers can quickly get started with development based on our documentation and examples.
This repository implements examples of openvela native application code. Developers can quickly get started with development based on our documentation and examples.

## Usage Instructions
## Demo List

- [Bicycle Computer](../../../docs/blob/dev/en/demo/X_Track.md)
- [Breakout Game](breakout/Readme.md)
- [Calculator](calculator/Readme.md)
- [Hourglass](hourglass/Readme.md)
- [Music Player](../../../docs/blob/dev/en/demo/Music_Player_Example.md)
- [Music Player 2](music_player2/README-en.md)
- [Relation Calculator](relation_calculator/Readme.md)
- [Smart Band](../../../docs/blob/dev/en/demo/Smart_Band_Example.md)
- [Snake Game](snake_game/Readme.md)
- [Virtual Pet](pet/README.md)
- [Whackmole](Whackmole/README.md)
- [Wooden Fish](wooden_fish/README.md)
| Demo | Description |
|------|-------------|
| [BandX](bandx/README.md) | Smart band UI demo |
| [Breakout](breakout/README.md) | Brick breaker game |
| [Calculator](calculator/README.md) | Calculator with expression evaluation |
| [Hourglass](hourglass/README.md) | Digital hourglass timer |
| [MiMo](mimo/README.md) | Xiaomi MiMo AI model provider |
| [Music Player](music_player/README.md) | Music player application |
| [Music Player 2](music_player2/README.md) | Enhanced music player with splash screen |
| [Virtual Pet](pet/README.md) | Interactive virtual pet |
| [Relation Calculator](relation_calculator/README.md) | Chinese family relation calculator |
| [Snake Game](snake_game/README.md) | Classic snake game |
| [Utils](utils/README.md) | Shared demo utility library |
| [Whack-a-Mole](Whackmole/README.md) | Whack-a-mole game |
| [Wooden Fish](wooden_fish/README.md) | Digital wooden fish |
| [X-TRACK](x_track/README.md) | Bicycle computer / GPS tracker |
32 changes: 18 additions & 14 deletions README_zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,23 @@

## 简介

该仓库实现了 openvela native应用代码示例,开发者可以根据我们的文档和示例,快速上手开发
该仓库实现了 openvela native 应用代码示例,开发者可以根据文档和示例快速上手开发

## 使用说明
## 演示列表

- [音乐播放器](../../../docs/blob/dev/zh-cn/demo/Music_Player_Example_zh-cn.md)
- [智能手环](../../../docs/blob/dev/zh-cn/demo/Smart_Band_Example_zh-cn.md)
- [自行车码表](../../../docs/blob/dev/zh-cn/demo/X_Track_zh-cn.md)
- [计算器](calculator/Readme.md)
- [亲戚计算器](relation_calculator/Readme.md)
- [打地鼠](Whackmole/README_zh-cn.md)
- [音乐播放器2](music_player2/README.md)
- [打砖块](breakout/Readme.md)
- [电子沙漏](hourglass/Readme.md)
- [贪吃蛇](snake_game/Readme.md)
- [虚拟宠物](pet/README.md)
- [电子木鱼](wooden_fish/README_zh-cn.md)
| 演示 | 说明 |
|------|------|
| [智能手环 BandX](bandx/README_zh-cn.md) | 智能手环 UI 演示 |
| [打砖块 Breakout](breakout/README_zh-cn.md) | 经典打砖块游戏 |
| [计算器 Calculator](calculator/README_zh-cn.md) | 支持表达式求值的计算器 |
| [电子沙漏 Hourglass](hourglass/README_zh-cn.md) | 电子沙漏计时器 |
| [MiMo AI](mimo/README_zh-cn.md) | 小米 MiMo AI 大模型接入组件 |
| [音乐播放器](music_player/README_zh-cn.md) | 音乐播放器应用 |
| [音乐播放器 2](music_player2/README_zh-cn.md) | 增强版音乐播放器(含启动页) |
| [虚拟宠物](pet/README_zh-cn.md) | 交互式虚拟宠物 |
| [亲戚计算器](relation_calculator/README_zh-cn.md) | 中国亲戚关系计算器 |
| [贪吃蛇](snake_game/README_zh-cn.md) | 经典贪吃蛇游戏 |
| [工具库 Utils](utils/README_zh-cn.md) | 共享演示工具库 |
| [打地鼠](Whackmole/README_zh-cn.md) | 打地鼠游戏 |
| [电子木鱼](wooden_fish/README_zh-cn.md) | 电子木鱼 |
| [自行车码表 X-TRACK](x_track/README_zh-cn.md) | 自行车码表 / GPS 追踪器 |
130 changes: 130 additions & 0 deletions bandx/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# Smart Band

English | [中文](README_zh-cn.md)

## Introduction

Bandx is a smart band demo that incorporates watch dial, launcher, music, heart rate, stopwatch, sleep, sports, settings and flashlight, with a resolution of 194 x 368 pixels.

This article describes how to run this example on Emulator.

## Prerequisites

To download the source code, see [Quick Start](https://github.com/open-vela/docs/blob/dev/en/quickstart/openvela_ubuntu_quick_start.md).

## Step 1: Configure the project

1. Switch to the root directory of openvela repository and execute the following command to configure Bandx.

**Note**: The emulator configuration file (defconfig) is in the "vendor/openvela/boards/vela/configs/goldfish-armeabi-v7a-ap/" directory, and the emulator code is configured and compiled using "build.sh".

```Bash
./build.sh vendor/openvela/boards/vela/configs/goldfish-armeabi-v7a-ap menuconfig
```

- build.sh: A script for compilation used to configure and compile openvela code.
- vendor/openvela/boards/vela/configs/goldfish-armeabi-v7a-ap: configuration path
- menuconfig: Open the menuconfig page to modify the configuration of the project code.

2. Press the "/" key to search and modify the following configurations:

```Bash
LV_USE_FRAGMENT = y
LVX_USE_DEMO_BANDX = y
BANDX_BASE_PATH = "/data"
```

Take **LV_USE_FRAGMENT** as an example for illustration. The other configurations are modified is the same way.

1. Enter the configuration to be searched.
2. Press "Enter" to go to the configuration page.
3. Press "Enter" to open the configuration, and a \* that appears in [ ] indicates that the configuration is opened.
4. Press the "/" key to continue searching for the remaining configurations, and modify them as described above.
5. Press the letter Q to bring up the exit Save screen.
6. Press the letter Y to save the configuration and exit the Modify Configuration page.

## Step 2: Compile the project

1. Switch to the root directory of openvela repository and execute the following commands one by one in a terminal:

```Bash
# Clean up build artifacts
./build.sh vendor/openvela/boards/vela/configs/goldfish-armeabi-v7a-ap distclean -j8
#Start to build
./build.sh vendor/openvela/boards/vela/configs/goldfish-armeabi-v7a-ap -j8
```

2. After successful execution, you will get the following files:

```plaintext
./nuttx
├── vela_ap.elf
├── vela_ap.bin
```

## Step 3: Launch the emulator and push resources

The font and image resources used in Bandx are located in 'apps/packages/demos/bandx/resources/'. To push these resources to the corresponding file paths mounted by the emulator, follow the steps below.

1. Switch to the root directory of openvela repository and start the emulator:

```bash
./emulator.sh vela
```

2. Push resources to the device by using emulator-supported ADB. Open a new terminal in the root directory of openvela repository, type "adb push" followed by the file path to transfer the resources to the appropriate location.

```bash
# Install adb
sudo apt install android-tools-adb
# Push resources
adb push apps/packages/demos/bandx/resource/font/assets/* /data/font/
adb push apps/packages/demos/bandx/resource/image/assets /data/image/
```

**Note**: If "BANDX_BASE_PATH" is changed to a non-default value like "/tmp", the resource files must also be moved to the "/tmp/font/" and "/tmp/image/" directories. Otherwise, a "resource not found" error will occur.

## Step 4: Start Bandx

1. Enter the following command in the emulator's terminal environment "openvela-ap":
```Bash
bandx &
```
2. To access the Launcher screen, swipe quickly from right to left. Single-click different icons to navigate to subpages, such as the Heart Rate page. To exit the page, swipe quickly from left to right.
**Note**: The music page is just a UI display, with no access to audio.
3. Turn on "Auto-show" in settings to auto-play the entire application. Turn off "Auto-show" to end playing it.
## Step 5: Exit Demo
Shut down the emulator to exit Demo.
## FAQ
### 1. adb command not found
#### Reason
The "adb" tool is not installed.
#### Solution
Install "adb" and execute the following command:
``` Bash
sudo apt install android-tools-adb
```
### 2. Garbled text is shown
#### Reason
Font resources are not loaded correctly.
#### Solution
Follow [Step 3](#step-3-launch-the-emulator-and-push-resources) to push resources.
131 changes: 131 additions & 0 deletions bandx/README_zh-cn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# 智能手环

[English](README.md) | 中文

## 简介

该应用是一款智能手环演示,包括手表表盘、启动器、音乐、心率、秒表、睡眠、运动、设置、手电筒,分辨率为 194*368。

本文介绍如何在模拟器上运行该示例。

## 前提条件

下载源码,请参见[快速入门](https://github.com/open-vela/docs/blob/dev/zh-cn/quickstart/openvela_ubuntu_quick_start.md)

## 步骤一 配置项目

1. 切换到 openvela 仓库的根目录,执行如下命令来配置手环 Bandx。

**说明**:模拟器配置文件(defconfig)在 `vendor/openvela/boards/vela/configs/goldfish-armeabi-v7a-ap/` 目录下,使用 `build.sh` 配置和编译模拟器的代码。

```cpp
./build.sh vendor/openvela/boards/vela/configs/goldfish-armeabi-v7a-ap menuconfig
```

- build.sh:编译脚本,用来配置和编译 openvela 代码
- vendor/openvela/boards/vela/configs/goldfish-armeabi-v7a-ap:配置路径
- menuconfig:打开 menuconfig 页面,修改项目代码的配置。

2. 按下 `/` 键逐个搜索修改如下配置项:

```Bash
LV_USE_FRAGMENT = y
LVX_USE_DEMO_BANDX = y
BANDX_BASE_PATH = "/data"
```

以 LV_USE_FRAGMENT 为例进行操作,其余配置方式相同。

1. 输入待搜索的配置。
2. 按下`Enter`进入到配置页面。
3. 按下`Enter`键打开该配置,`[ ]` 中出现 `*` 表示该配置被打开。
4. 按下 `/` 键可以继续搜索剩下的配置,并按上述步骤修改其余配置。
5. 按下字母`Q`键,弹出退出保存界面。
6. 按下字母`Y`键保存配置,并退出修改配置页面。

## 步骤二 编译项目

1. 切换到 openvela 仓库的根目录,在终端内依次执行如下命令:

```Bash
# 清理构建产物
./build.sh vendor/openvela/boards/vela/configs/goldfish-armeabi-v7a-ap distclean -j8

# 开始构建
./build.sh vendor/openvela/boards/vela/configs/goldfish-armeabi-v7a-ap -j8
```

2. 成功执行后,将得到以下文件:

```plaintext
./nuttx
├── vela_ap.elf
├── vela_ap.bin
```

## 步骤三 启动模拟器并推送资源

Bandx 中使用的字体和图像资源位于 `apps/packages/demos/bandx/resources/` 中,要将这些资源推送到模拟器挂载的相应文件路径,可以按照以下步骤操作。

1. 切换到 openvela 仓库的根目录,启动模拟器:

```bash
./emulator.sh vela
```

2. 使用模拟器支持的 `ADB` 将资源推送到设备,在 openvela 仓库的根目录下打开一个新的终端,输入 `adb push` 后跟文件路径,即可将资源传输到相应位置。

```bash
# 安装adb
sudo apt install android-tools-adb

# 推送资源
adb push apps/packages/demos/bandx/resource/font/assets/* /data/font/
adb push apps/packages/demos/bandx/resource/image/assets /data/image/
```
如果将 `BANDX_BASE_PATH` 更改为非默认值,如 `/tmp`,则资源文件也必须传输到 `/tmp/font/` 和 `/tmp/image/` 目录。否则将出现找不到资源的错误。
## 步骤四 启动 Bandx
1. 在模拟器的终端环境 `openvela-ap>` 中输入如下命令:
```Bash
bandx &
```
2. 要访问 Launcher 界面,`从右向左`快速滑动。单击不同的图标导航到子页面,如 Heart Rate 页面。要退出页面,`从左向右`快速滑动。
**说明**:music页面只是UI展示,没有接入音频。
3. 打开 settings 中的 `Auto-show`,将会自动播放整个应用;关闭 `Auto-show`,自动播放就结束。
## 步骤五 退出 Demo
关闭模拟器退出 Demo。
## 常见问题
### 1. adb 命令找不到
#### 原因
未安装 `adb` 工具。
#### 解决方案
安装 `adb`,执行以下命令:
``` Bash
sudo apt install android-tools-adb
```
### 2. 字体显示为乱码
#### 原因
未正确加载字体资源。
#### 解决方案
请按[步骤三](#步骤三-启动模拟器并推送资源)进行资源推送。
46 changes: 46 additions & 0 deletions breakout/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Breakout - Brick Breaker Game

English | [中文](README_zh-cn.md)

A classic breakout (brick breaker) game demo built with LVGL on OpenVela/NuttX. Control a paddle to bounce a ball and destroy bricks.

## Features

- Classic breakout gameplay
- Touch/input-based paddle control
- LVGL-based graphics rendering
- libuv event loop integration

## Configuration

Enable in menuconfig:

```
LVX_USE_DEMO_BREAKOUT=y
LVX_BREAKOUT_DATA_ROOT="/data"
LVX_BREAKOUT_STACKSIZE=65536
```

## Project Structure

```
breakout/
├── src/
│ └── breakout.h # Game logic declarations
├── breakout_main.cpp # Application entry point (C++)
├── Kconfig # NuttX configuration
├── CMakeLists.txt # CMake build script
└── Makefile # Make build script
```

## Usage

```bash
nsh> breakout
```

## Build

```bash
./build.sh <your-board-config> -j8
```
Loading
Loading