App:Library:LVGL:docs:Introduction

提供: robot-jp wiki
2022年6月20日 (月) 15:01時点におけるTakashi (トーク | 投稿記録)による版 (→‎FAQ (よくある質問))
ナビゲーションに移動検索に移動

https://docs.lvgl.io/8.2/intro/index.html

戻る : Previous

Introduction (序文)

英文 自動翻訳

LVGL (Light and Versatile Graphics Library) is a free and open-source graphics library providing everything you need to create an embedded GUI with easy-to-use graphical elements, beautiful visual effects and a low memory footprint.

LVGL(Light and Versatile Graphics Library)は、無料のオープンソースグラフィックライブラリであり、使いやすいグラフィック要素、美しい視覚効果、および低メモリフットプリントを備えた埋め込みGUIを作成するために必要なすべてを提供します。

Key features (主な機能)

英文 自動翻訳
  • Powerful building blocks such as buttons, charts, lists, sliders, images, etc.
  • Advanced graphics with animations, anti-aliasing, opacity, smooth scrolling
  • Various input devices such as touchpad, mouse, keyboard, encoder, etc.
  • Multi-language support with UTF-8 encoding
  • Multi-display support, i.e. use multiple TFT, monochrome displays simultaneously
  • Fully customizable graphic elements with CSS-like styles
  • Hardware independent: use with any microcontroller or display
  • Scalable: able to operate with little memory (64 kB Flash, 16 kB RAM)
  • OS, external memory and GPU are supported but not required
  • Single frame buffer operation even with advanced graphic effects
  • Written in C for maximal compatibility (C++ compatible)
  • Simulator to start embedded GUI design on a PC without embedded hardware
  • Binding to MicroPython
  • Tutorials, examples, themes for rapid GUI design
  • Documentation is available online and as PDF
  • Free and open-source under MIT license
  • ボタン、チャート、リスト、スライダー、画像などの強力なビルディングブロック。
  • アニメーション、アンチエイリアシング、不透明度、スムーズなスクロールを備えた高度なグラフィックス
  • タッチパッド、マウス、キーボード、エンコーダーなどのさまざまな入力デバイス。
  • UTF-8エンコーディングによる多言語サポート
  • マルチディスプレイのサポート、つまり複数のTFT、モノクロディスプレイを同時に使用
  • CSSのようなスタイルで完全にカスタマイズ可能なグラフィック要素
  • ハードウェアに依存しない:任意のマイクロコントローラーまたはディスプレイで使用
  • スケーラブル:少ないメモリで動作可能(64 kBフラッシュ、16 kB RAM)
  • OS、外部メモリ、GPUはサポートされていますが、必須ではありません
  • 高度なグラフィック効果でもシングルフレームバッファ操作
  • 最大限の互換性のためにCで書かれています(C ++互換)
  • 組み込みハードウェアのないPCで組み込みGUIデザインを開始するシミュレーター
  • MicroPythonへのバインド
  • チュートリアル、例、迅速なGUIデザインのテーマ
  • ドキュメントはオンラインおよびPDFで入手できます
  • MITライセンスに基づく無料のオープンソース

Requirements (要求事項)

英文 自動翻訳

Basically, every modern controller which is able to drive a display is suitable to run LVGL.

The minimal requirements are:

  • 16, 32 or 64 bit microcontroller or processor
  • > 16 MHz clock speed is recommended
  • Flash/ROM: > 64 kB for the very essential components (> 180 kB is recommended)
  • RAM:
    • Static RAM usage: ~2 kB depending on the used features and object types
    • Stack: > 2kB (> 8 kB is recommended)
    • Dynamic data (heap): > 4 KB (> 32 kB is recommended if using several objects).     Set by LV_MEM_SIZE in lv_conf.h.
    • Display buffer: > "Horizontal resolution" pixels (> 10× "Horizontal resolution" is recommended)
    • One frame buffer in the MCU or in an external display controller
  • C99 or newer compiler
  • Basic C (or C++) knowledge: pointers, structs, callbacks.


Note that memory usage may vary depending on architecture, compiler and build options.

基本的に、ディスプレイを駆動できる最新のコントローラーはすべて、LVGLの実行に適しています。

最小要件は次のとおりです。

  • 16、32、または64ビットのマイクロコントローラーまたはプロセッサー
  • >16MHzのクロック速度をお勧めします
  • フラッシュ/ROM:非常に重要なコンポーネントの場合は> 64 kB(> 180 kBを推奨)
  • RAM:
    • Static RAMの使用量:最大2 kB  使用する機能とオブジェクトタイプによる
    • Stack:> 2kB(> 8 kBを推奨)
    • Dynamic data (heap):> 4 KB(> 32 kBを推奨 複数のオブジェクトを使用する場合)。 lv_conf.hLV_MEM_SIZE で設定します。
    • Display buffer:> "水平解像度" ピクセル数(> 10×”水平解像度" を推奨)
    • MCUまたは外部ディスプレイコントローラの1つのフレームバッファ
  • C99以降のコンパイラ
  • 基本的なC(またはC ++)の知識: ポインター構造体コールバック


注:メモリ使用量は、アーキテクチャ、コンパイラ、およびビルドオプションによって異なる場合があります。

License (ライセンス)

英文 自動翻訳

The LVGL project (including all repositories) is licensed under MIT license. This means you can use it even in commercial projects.

It's not mandatory, but we highly appreciate it if you write a few words about your project in the My projects category of the forum or a private message to lvgl.io.

Although you can get LVGL for free there is a massive amount of work behind it. It's created by a group of volunteers who made it available for you in their free time.

To make the LVGL project sustainable, please consider contributing to the project. You can choose from many different ways of contributing such as simply writing a tweet about you using LVGL, fixing bugs, translating the documentation, or even becoming a maintainer.

LVGLプロジェクト(すべてのリポジトリを含む)は、MITライセンスの下でライセンスされています。これは、商業プロジェクトでも使用できることを意味します。

必須ではありませんが、フォーラムの My Project カテゴリにプロジェクトについていくつかの単語を書き込んだり、lvgl.ioへのプライベートメッセージを書き込んだりしていただければ幸いです。

LVGLは無料で入手できますが、その背後には膨大な量の作業があります。それは彼らの自由な時間にあなたのためにそれを利用可能にしたボランティアのグループによって作成されました。

LVGLプロジェクトを持続可能にするために、プロジェクトへの貢献を検討してください。LVGLを使用して自分に関するツイートを書く、バグを修正する、ドキュメントを翻訳する、さらにはメンテナになるなど、さまざまな貢献方法から選択できます。

Repository layout (リポジトリの配置)

英文 自動翻訳

All repositories of the LVGL project are hosted on GitHub: https://github.com/lvgl

You will find these repositories there:

LVGLプロジェクトのすべてのリポジトリは、GitHubでホストされています:https://github.com/lvgl

これらのリポジトリはそこにあります:

  • lvgl 多くの例を含むライブラリ自体。
  • lv_demo LVGLで作成されたデモ。
  • lv_drivers デバイスドライバーの表示と入力
  • blog ブログのサイトのソース(https://blog.lvgl.io
  • sim オンラインシミュレーターのサイトのソース(https://sim.lvgl.io
  • lv_sim_... さまざまなIDEおよびプラットフォーム用のシミュレータプロジェクト
  • lv_port_... 開発ボードへのLVGLポート
  • lv_binding_.. 他の言語との結合
  • lv_... 他のプラットフォームへの移植

Release policy (リリースの方針)

英文 自動翻訳

The core repositories follow the rules of Semantic versioning:

  • Major versions for incompatible API changes. E.g. v5.0.0, v6.0.0
  • Minor version for new but backward-compatible functionalities. E.g. v6.1.0, v6.2.0
  • Patch version for backward-compatible bug fixes. E.g. v6.1.1, v6.1.2

Tags like vX.Y.Z are created for every release.

Release cycle

  • Bug fixes: Released on demand even weekly
  • Minor releases: Every 3-4 months
  • Major releases: Approximately yearly

Branches

The core repositories have at least the following branches:

  • master latest version, patches are merged directly here.
  • release/vX.Y stable versions of the minor releases
  • fix/some-description temporary branches for bug fixes
  • feat/some-description temporary branches for features

Changelog

The changes are recorded in CHANGELOG.md.

Version support

Before v8 every minor release of major releases is supported for 1 year. Starting from v8, every minor release is supported for 1 year.

Version Release date Support end Active
v5.3 Feb 1, 2019 Feb 1, 2020 No
v6.1 Nov 26, 2019 Nov 26, 2020 No
v7.11 Mar 16, 2021 Mar 16, 2022 Yes
v8.0 1 Jun, 2021 1 Jun, 2022 Yes
v8.1 10 Nov, 2021 10 Nov, 2022 Yes
v8.2 In progress

コアリポジトリは、セマンティックバージョニングのルールに従います。

  • 互換性のないAPI変更のメジャーバージョン。例:v5.0.0、v6.0.0
  • 新しいが下位互換性のある機能のマイナーバージョン。例:v6.1.0、v6.2.0
  • 下位互換性のあるバグ修正のためのパッチバージョン。例:v6.1.1、v6.1.2

のようなタグvX.Y.Zは、リリースごとに作成されます。

リリースサイクル

  • バグ修正:毎週でもオンデマンドでリリース
  • マイナーリリース:3〜4か月ごと
  • メジャーリリース:約毎年

ブランチ

コアリポジトリには、少なくとも次のブランチがあります。

  • master最新バージョンでは、パッチはここに直接マージされます。
  • release/vX.Yマイナーリリースの安定バージョン
  • fix/some-descriptionバグ修正のための一時的なブランチ
  • feat/some-description機能の一時的なブランチ

変更ログ

変更履歴はCHANGELOG.mdに記録されています。

バージョンサポート

v8より前では、メジャーリリースのすべてのマイナーリリースが1年間サポートされています。v8以降、すべてのマイナーリリースが1年間サポートされます。

バージョン 発売日 サポート終了 アクティブ
v5.3 2019年2月1日 2020年2月1日 いいえ
v6.1 2019年11月26日 2020年11月26日 いいえ
v7.11 2021年3月16日 2022年3月16日 はい
v8.0 2021年6月1日 2022年6月1日 はい
v8.1 2021年11月10日 2022年11月10日 はい
v8.2 進行中

FAQ (よくある質問)

英文 自動翻訳

Where can I ask questions?

You can ask questions in the forum: https://forum.lvgl.io/.

We use GitHub issues for development related discussion. You should use them only if your question or issue is tightly related to the development of the library.

Before posting a question, please ready this FAQ section as you might find answer to your issue here too.

どこで質問できますか?

フォーラムで質問することができます:https://forum.lvgl.io/

開発関連のディスカッションにはGitHubの問題を使用します。質問や問題がライブラリの開発に密接に関連している場合にのみ、これらを使用する必要があります。

質問を投稿する前に、このFAQセクションを準備してください。ここでも、問題に対する回答が見つかる可能性があります。

Is my MCU/hardware supported?

Every MCU which is capable of driving a display via parallel port, SPI, RGB interface or anything else and fulfills the Requirements is supported by LVGL.

This includes:

  • "Common" MCUs like STM32F, STM32H, NXP Kinetis, LPC, iMX, dsPIC33, PIC32 etc.
  • Bluetooth, GSM, Wi-Fi modules like Nordic NRF and Espressif ESP32
  • Linux with frame buffer device such as /dev/fb0. This includes Single-board computers like the Raspberry Pi
  • Anything else with a strong enough MCU and a peripheral to drive a display

私のMCU/ハードウェアはサポートされていますか?

パラレルポート、SPI、RGBインターフェイスなどを介してディスプレイを駆動でき、要件を満たすすべてのMCUは、LVGLでサポートされています。

これも:

  • STM32F、STM32H、NXP Kinetis、LPC、iMX、dsPIC33、PIC32などの「一般的な」MCU。
  • Bluetooth、GSM、NordicNRFやEspressifESP32などのWi-Fiモジュール
  • / dev/fb0などのフレームバッファデバイスを備えたLinux。これには、RaspberryPiのようなシングルボードコンピューターが含まれます
  • ディスプレイを駆動するのに十分な強度のMCUと周辺機器を備えたその他のもの

Is my display supported?

LVGL needs just one simple driver function to copy an array of pixels into a given area of the display.

If you can do this with your display then you can use it with LVGL.

Some examples of the supported display types:

  • TFTs with 16 or 24 bit color depth
  • Monitors with an HDMI port
  • Small monochrome displays
  • Gray-scale displays
  • even LED matrices
  • or any other display where you can control the color/state of the pixels


See the Porting section to learn more.

私のディスプレイはサポートされていますか?

LVGLは、ピクセルの配列をディスプレイの特定の領域にコピーするために1つの単純なドライバー関数を必要とします。

ディスプレイでこれを行うことができれば LVGL で使用できます。

サポートされている表示タイプの例:

  • 16ビット色または24ビット色のTFT
  • HDMIポート付きモニター
  • 小さなモノクロディスプレイ
  • グレースケールディスプレイ
  • LEDマトリックス
  • その他、ピクセルの色/状態を制御できるディスプレイ


詳細については、section "Porting(移植)" を参照してください。

LVGL doesn't start, randomly crashes or nothing is drawn on the display. What can be the problem?

  • Try increasing LV_MEM_SIZE.
  • Be sure lv_disp_drv_t, lv_indev_drv_t and lv_fs_drv_t are global or static.
  • Be sure your display works without LVGL. E.g. paint it to red on start up.
  • Enable Logging
  • Enable asserts in lv_conf.h (LV_USE_ASSERT_...)
  • If you use an RTOS
    • increase the stack size of the task which calls lv_timer_handler()
    • Be sure you used a mutex as described here

LVGLが起動しない、ランダムにクラッシュする、またはディスプレイに何も表示されない。何が問題になる可能性がありますか?

  • LV_MEM_SIZE の値を増やしてみてください
  • lv_disp_drv_t , lv_indev_drv_t , lv_fs_drv_t が全て global または static であることを確認してください。
  • ディスプレイが LVGLなしで機能することを確認してください。たとえば、起動時に赤に塗りつぶす等。
  • logging を有効にする
  • lv_conf.hLV_USE_ASSERT_...) で assert を有効にする
  • RTOSを使用している場合
    • lv_timer_handler() で呼び出すタスクのスタックサイズを増やす
    • ここで説明 されているように mutex を使用していることを確認してください

My display driver is not called. What have I missed?

Be sure you are calling lv_tick_inc(x) in an interrupt and lv_timer_handler() in your main while(1).


Learn more in the Tick and Task handler sections.

ディスプレイドライバが呼び出されません。私は何を失敗しましたか?

lv_tick_inc(x) を割込から呼び出し、

lv_timer_handler() をメインの while(1) で呼び出していることを確認してください


詳細については、section "tick" と "task handler" をご覧ください。

Why is the display driver called only once? Only the upper part of the display is refreshed.

Be sure you are calling lv_disp_flush_ready(drv) at the end of your "display flush callback".

ディスプレイドライバが1回だけ呼び出されるのはなぜですか?表示の上部だけが更新されます。

"display flush callback" の最後にある lv_disp_flush_ready(drv) を呼び出していることを確認してください。


Why do I see only garbage on the screen?

Probably there a bug in your display driver. Try the following code without using LVGL. You should see a square with red-blue gradient.

#define BUF_W 20
#define BUF_H 10

lv_color_t buf[BUF_W * BUF_H];
lv_color_t * buf_p = buf;
uint16_t x, y;
for(y = 0; y < BUF_H; y++) {
    lv_color_t c = lv_color_mix(LV_COLOR_BLUE, LV_COLOR_RED, (y * 255) / BUF_H);
    for(x = 0; x < BUF_W; x++){
        (*buf_p) =  c;
        buf_p++;
    }
}

lv_area_t a;
a.x1 = 10;
a.y1 = 40;
a.x2 = a.x1 + BUF_W - 1;
a.y2 = a.y1 + BUF_H - 1;
my_flush_cb(NULL, &a, buf);

Why do I see nonsense colors on the screen?

Probably LVGL's color format is not compatible with your display's color format. Check LV_COLOR_DEPTH in lv_conf.h.

If you are using 16-bit colors with SPI (or another byte-oriented interface) you probably need to set LV_COLOR_16_SWAP  1 in lv_conf.h. It swaps the upper and lower bytes of the pixels.

How to speed up my UI?

  • Turn on compiler optimization and enable cache if your MCU has it
  • Increase the size of the display buffer
  • Use two display buffers and flush the buffer with DMA (or similar peripheral) in the background
  • Increase the clock speed of the SPI or parallel port if you use them to drive the display
  • If your display has an SPI port consider changing to a model with a parallel interface because it has much higher throughput
  • Keep the display buffer in internal RAM (not in external SRAM) because LVGL uses it a lot and it should have a fast access time

How to reduce flash/ROM usage?

You can disable all the unused features (such as animations, file system, GPU etc.) and object types in lv_conf.h.

If you are using GCC you can add -fdata-sections -ffunction-sections compiler flags and --gc-sections linker flag to remove unused functions and variables from the final binary.

How to reduce the RAM usage

  • Lower the size of the Display buffer
  • Reduce LV_MEM_SIZE in lv_conf.h. This memory is used when you create objects like buttons, labels, etc.
  • To work with lower LV_MEM_SIZE you can create objects only when required and delete them when they are not needed anymore

How to work with an operating system?

To work with an operating system where tasks can interrupt each other (preemptively) you should protect LVGL related function calls with a mutex. See the Operating system and interrupts section to learn more.


画面にゴミだけが表示されるのはなぜですか?

おそらく、ディスプレイドライバにバグがあります。LVGLを使用せずに次のコードを試してください。赤青のグラデーションの正方形が表示されます。

#define BUF_W 20
#define BUF_H 10

lv_color_t buf[BUF_W * BUF_H];
lv_color_t * buf_p = buf;
uint16_t x, y;
for(y = 0; y < BUF_H; y++) {
    lv_color_t c = lv_color_mix(LV_COLOR_BLUE, LV_COLOR_RED, (y * 255) / BUF_H);
    for(x = 0; x < BUF_W; x++){
        (*buf_p) =  c;
        buf_p++;
    }
}

lv_area_t a;
a.x1 = 10;
a.y1 = 40;
a.x2 = a.x1 + BUF_W - 1;
a.y2 = a.y1 + BUF_H - 1;
my_flush_cb(NULL, &a, buf);

画面に意味のない色が表示されるのはなぜですか?

おそらく、LVGLのカラーフォーマットはディスプレイのカラーフォーマットと互換性がありません。lv_conf.hをチェックLV_COLOR_DEPTHインします。

SPI(または別のバイト指向インターフェイス)で16ビットカラーを使用している場合は、おそらくlv_conf.hで設定する必要があります。ピクセルの上位バイトと下位バイトを交換します。LV_COLOR_16_SWAP  1

UIを高速化する方法は?

  • コンパイラの最適化をオンにし、MCUにキャッシュがある場合はキャッシュを有効にします
  • 表示バッファのサイズを大きくします
  • 2つのディスプレイバッファを使用し、バックグラウンドでDMA(または同様の周辺機器)を使用してバッファをフラッシュします
  • SPIまたはパラレルポートを使用してディスプレイを駆動する場合は、それらのクロック速度を上げてください
  • ディスプレイにSPIポートがある場合は、スループットがはるかに高いため、パラレルインターフェイスを備えたモデルに変更することを検討してください。
  • LVGLはディスプレイバッファを頻繁に使用し、アクセス時間が高速である必要があるため、ディスプレイバッファを(外部SRAMではなく)内部RAMに保持します。

フラッシュ/ROMの使用量を減らす方法は?

lv_conf.hで、未使用の機能(アニメーション、ファイルシステム、GPUなど)とオブジェクトタイプをすべて無効にすることができます。

GCCを使用している場合は、コンパイラフラグとリンカフラグを追加して、未使用の関数と変数を最終的なバイナリから削除できます。-fdata-sections -ffunction-sections--gc-sections

RAM使用量を減らす方法

  • 表示バッファのサイズを小さくします
  • lv_conf.hLV_MEM_SIZE減らします。このメモリは、ボタンやラベルなどのオブジェクトを作成するときに使用されます。
  • 下位で作業するLV_MEM_SIZEには、必要な場合にのみオブジェクトを作成し、不要になったときにオブジェクトを削除できます。

オペレーティングシステムを操作する方法は?

タスクが(プリエンプティブに)相互に割り込むことができるオペレーティングシステムで作業するには、ミューテックスを使用してLVGL関連の関数呼び出しを保護する必要があります。詳細については、オペレーティングシステムと割り込みのセクションを参照してください。



戻る