App:Library:LVGL:docs:Porting:Display interface
https://docs.lvgl.io/8.2/porting/display.html
英文 | 自動翻訳 |
---|---|
Display interface
英文 自動翻訳 To register a display for LVGL, a
lv_disp_draw_buf_t
and alv_disp_drv_t
variable have to be initialized.lv_disp_draw_buf_t
contains internal graphic buffer(s) called draw buffer(s).lv_disp_drv_t
contains callback functions to interact with the display and manipulate low level drawing behavior.
LVGLの表示を登録するには、alv_disp_draw_buf_t
とlv_disp_drv_t
変数を初期化する必要があります。lv_disp_draw_buf_t
ドローバッファと呼ばれる内部グラフィックバッファが含まれています。lv_disp_drv_t
ディスプレイと対話し、低レベルの描画動作を操作するためのコールバック関数が含まれています。
Draw buffer
英文 自動翻訳 Draw buffer(s) are simple array(s) that LVGL uses to render the screen content. Once rendering is ready the content of the draw buffer is sent to the display using the
flush_cb
function set in the display driver (see below).A draw buffer can be initialized via a
lv_disp_draw_buf_t
variable like this:/*A static or global variable to store the buffers*/ static lv_disp_draw_buf_t disp_buf; /*Static or global buffer(s). The second buffer is optional*/ static lv_color_t buf_1[MY_DISP_HOR_RES * 10]; static lv_color_t buf_2[MY_DISP_HOR_RES * 10]; /*Initialize `disp_buf` with the buffer(s). With only one buffer use NULL instead buf_2 */ lv_disp_draw_buf_init(&disp_buf, buf_1, buf_2, MY_DISP_HOR_RES*10);
Note that
lv_disp_draw_buf_t
must be a static, global or dynamically allocated variable. It cannot be a local variable as they are destroyed upon end of scope.As you can see above, the draw buffer may be smaller than the screen. In this case, larger areas are redrawn in smaller segments that fit into the draw buffer(s). If only a small area changes (e.g. a button is pressed) then only that area will be refreshed.
A larger buffer results in better performance but above 1/10 screen sized buffer(s) there is no significant performance improvement. Therefore it's recommended to choose the size of the draw buffer(s) to be at least 1/10 screen sized.描画バッファは、LVGLが画面コンテンツをレンダリングするために使用する単純な配列です。レンダリングの準備ができると、ドローバッファの内容が flush_cb
、ディスプレイドライバで設定された機能を使用してディスプレイに送信されます(以下を参照)。lv_disp_draw_buf_t
ドローバッファは、次のような変数 を介して初期化できます。/*バッファを格納する静的変数またはグローバル変数*/ static lv_disp_draw_buf_t disp_buf ; /*静的またはグローバルバッファ。2番目のバッファーはオプションです*/ static lv_color_t buf_1 [ MY_DISP_HOR_RES * 10 ]; static lv_color_t buf_2 [ MY_DISP_HOR_RES * 10 ]; /*バッファで`disp_buf`を初期化します。バッファが1つしかない場合は、代わりにNULLを使用しますbuf_2 * / lv_disp_draw_buf_init (&disp_buf 、 buf_1 、 buf_2 、 MY_DISP_HOR_RES * 10 );
lv_disp_draw_buf_t
静的、グローバル、または動的に割り当てられた変数である必要があることに注意してください。スコープの終了時に破棄されるため、ローカル変数にすることはできません。
上記のように、ドローバッファは画面よりも小さい場合があります。この場合、大きな領域は、描画バッファに収まる小さなセグメントで再描画されます。小さな領域のみが変更された場合(たとえば、ボタンが押された場合)、その領域のみが更新されます。
バッファを大きくするとパフォーマンスが向上しますが、画面サイズが1/10を超えると、パフォーマンスが大幅に向上することはありません。したがって、描画バッファのサイズは、少なくとも1/10の画面サイズになるように選択することをお勧めします。
Buffering modes
英文 自動翻訳 There are several settings to adjust the number draw buffers and buffering/refreshing modes.
You can measure the performance of different configurations using the benchmark example.
描画バッファの数とバッファリング/更新モードを調整するためのいくつかの設定があります。 ベンチマークの例を使用して、さまざまな構成のパフォーマンスを測定できます。
One buffer
英文 自動翻訳 If only one buffer is used LVGL draws the content of the screen into that draw buffer and sends it to the display. LVGL then needs to wait until the content of the buffer is sent to the display before drawing something new in it.
バッファが1つだけ使用されている場合、LVGLは画面のコンテンツをその描画バッファに描画し、それをディスプレイに送信します。次に、LVGLは、バッファの内容がディスプレイに送信されるまで待機してから、新しいものを描画する必要があります。
Two buffers
英文 自動翻訳 If two buffers are used LVGL can draw into one buffer while the content of the other buffer is sent to the display in the background. DMA or other hardware should be used to transfer data to the display so the MCU can continue drawing. This way, the rendering and refreshing of the display become parallel operations.
2つのバッファーが使用されている場合、LVGLは一方のバッファーに引き込むことができ、もう一方のバッファーの内容はバックグラウンドでディスプレイに送信されます。DMAまたはその他のハードウェアを使用してデータをディスプレイに転送し、MCUが描画を続行できるようにする必要があります。このように、表示のレンダリングと更新は並列操作になります。
Full refresh
英文 自動翻訳 In the display driver (
lv_disp_drv_t
) enabling thefull_refresh
bit will force LVGL to always redraw the whole screen. This works in both one buffer and two buffers modes. Iffull_refresh
is enabled and two screen sized draw buffers are provided, LVGL's display handling works like "traditional" double buffering. This means theflush_cb
callback only has to update the address of the framebuffer (color_p
parameter). This configuration should be used if the MCU has an LCD controller peripheral and not with an external display controller (e.g. ILI9341 or SSD1963) accessed via serial link. The latter will generally be too slow to maintain high frame rates with full screen redraws.ディスプレイドライバ( lv_disp_drv_t
)でfull_refresh
ビットを有効にすると、LVGLは常に画面全体を再描画します。これは、1つのバッファモードと2つのバッファモードの両方で機能します。が有効で、2つの画面サイズの描画バッファが提供されている場合full_refresh
、LVGLの表示処理は「従来の」ダブルバッファリングのように機能します。これは、コールバックがフレームバッファ(パラメータ)flush_cb
のアドレスを更新するだけでよいことを意味します。color_p
この構成は、MCUにLCDコントローラー周辺機器があり、シリアルリンクを介してアクセスされる外部ディスプレイコントローラー(ILI9341やSSD1963など)がない場合に使用する必要があります。後者は一般的に遅すぎて、フルスクリーンの再描画で高いフレームレートを維持できません。
Direct mode
英文 自動翻訳 If the
direct_mode
flag is enabled in the display driver LVGL will draw directly into a screen sized frame buffer. That is the draw buffer(s) needs to be screen sized. It this caseflush_cb
will be called only once when all dirty areas are redrawn. Withdirect_mode
the frame buffer always contains the current frame as it should be displayed on the screen. If 2 frame buffers are provided as draw buffers LVGL will alter the buffers but always draw only the dirty areas. Therefore the 2 buffers needs to synchronized inflush_cb
like this:- Display the frame buffer pointed by
color_p
- Copy the redrawn areas from
color_p
to the other buffer.
The get the redrawn areas to copy use the following functions
_lv_refr_get_disp_refreshing()
returns the display being refresheddisp->inv_areas[LV_INV_BUF_SIZE]
contains the invalidated areasdisp->inv_area_joined[LV_INV_BUF_SIZE]
if 1 that area was joined into another one and should be ignoreddisp->inv_p
number of valid elements ininv_areas
ディスプレイドライバでフラグが有効になっている場合、 direct_mode
LVGLは画面サイズのフレームバッファに直接描画します。つまり、描画バッファは画面サイズにする必要があります。このケースflush_cb
は、すべての汚れた領域が再描画されたときに1回だけ呼び出されます。フレームバッファを使用direct_mode
すると、画面に表示されるはずの現在のフレームが常に含まれます。描画バッファとして2つのフレームバッファが提供されている場合、LVGLはバッファを変更しますが、常にダーティ領域のみを描画します。したがって、2つのバッファは次のように同期する必要がありますflush_cb
。- が指すフレームバッファを表示します
color_p
- LVGLの表示を登録するには、a
color_p
再描画された領域をから他のバッファにコピーします。
再描画された領域を取得してコピーするには、次の関数を使用して、
_lv_refr_get_disp_refreshing()
更新中の表示を返します。その領域が別の領域に結合されている場合disp->inv_areas[LV_INV_BUF_SIZE]
、無効な領域が含まれているため、無視する必要があります。disp->inv_area_joined[LV_INV_BUF_SIZE]disp->inv_pinv_areas
- Display the frame buffer pointed by
Display driver
英文 自動翻訳 Once the buffer initialization is ready a
lv_disp_drv_t
display driver needs to be:- initialized with
lv_disp_drv_init(&disp_drv)
- its fields need to be set
- it needs to be registered in LVGL with
lv_disp_drv_register(&disp_drv)
Note that
lv_disp_drv_t
also needs to be a static, global or dynamically allocated variable.バッファの初期化の準備ができたら、 lv_disp_drv_t
ディスプレイドライバは次のようにする必要があります。- で初期化
lv_disp_drv_init(&disp_drv)
- そのフィールドを設定する必要があります
- LVGLに登録する必要があります
lv_disp_drv_register(&disp_drv)
lv_disp_drv_t
また、静的、グローバル、または動的に割り当てられた変数である必要があることに 注意してください。- initialized with
Mandatory fields
英文 自動翻訳 In the most simple case only the following fields of
lv_disp_drv_t
need to be set:draw_buf
pointer to an initializedlv_disp_draw_buf_t
variable.hor_res
horizontal resolution of the display in pixels.ver_res
vertical resolution of the display in pixels.flush_cb
a callback function to copy a buffer's content to a specific area of the display.lv_disp_flush_ready(&disp_drv)
needs to be called when flushing is ready. LVGL might render the screen in multiple chunks and therefore callflush_cb
multiple times. To see if the current one is the last chunk of rendering uselv_disp_flush_is_last(&disp_drv)
.
最も単純なケースでは、次のフィールドのみlv_disp_drv_t
を設定する必要があります。draw_buf
LVGLの表示を登録するには、alv_disp_draw_buf_t
初期化された変数へのポインタ。hor_res
ピクセル単位のディスプレイの水平解像度。ver_res
ピクセル単位のディスプレイの垂直解像度。flush_cb
バッファの内容をディスプレイの特定の領域にコピーするためのコールバック関数。lv_disp_flush_ready(&disp_drv)
フラッシュの準備ができたら呼び出す必要があります。LVGLは、画面を複数のチャンクでレンダリングするため、flush_cb
複数回呼び出す場合があります。現在のものがレンダリングの最後のチャンクであるかどうかを確認するには、を使用しますlv_disp_flush_is_last(&disp_drv)
。
Optional fields
英文 自動翻訳 There are some optional display driver data fields:
physical_hor_res
horizontal resolution of the full / physical display in pixels. Only set this when not using the full screen (defaults to -1 / same ashor_res
).physical_ver_res
vertical resolution of the full / physical display in pixels. Only set this when not using the full screen (defaults to -1 / same asver_res
).offset_x
horizontal offset from the full / physical display in pixels. Only set this when not using the full screen (defaults to 0).offset_y
vertical offset from the full / physical display in pixels. Only set this when not using the full screen (defaults to 0).color_chroma_key
A color which will be drawn as transparent on chrome keyed images. Set toLV_COLOR_CHROMA_KEY
fromlv_conf.h
by default.anti_aliasing
use anti-aliasing (edge smoothing). Enabled by default ifLV_COLOR_DEPTH
is set to at least 16 inlv_conf.h
.rotated
andsw_rotate
See the Rotation section below.screen_transp
if1
the screen itself can have transparency as well.LV_COLOR_SCREEN_TRANSP
must be enabled inlv_conf.h
andLV_COLOR_DEPTH
must be 32.user_data
A customvoid
user data for the driver.full_refresh
always redrawn the whole screen (see above)direct_mode
draw directly into the frame buffer (see above)
Some other optional callbacks to make it easier and more optimal to work with monochrome, grayscale or other non-standard RGB displays:
rounder_cb
Round the coordinates of areas to redraw. E.g. a 2x2 px can be converted to 2x8. It can be used if the display controller can refresh only areas with specific height or width (usually 8 px height with monochrome displays).set_px_cb
a custom function to write the draw buffer. It can be used to store the pixels more compactly in the draw buffer if the display has a special color format. (e.g. 1-bit monochrome, 2-bit grayscale etc.) This way the buffers used inlv_disp_draw_buf_t
can be smaller to hold only the required number of bits for the given area size. Note that rendering withset_px_cb
is slower than normal rendering.monitor_cb
A callback function that tells how many pixels were refreshed and in how much time. Called when the last chunk is rendered and sent to the display.clean_dcache_cb
A callback for cleaning any caches related to the display.
LVGL has built-in support to several GPUs (see
lv_conf.h
) but if something else is required these functions can be used to make LVGL use a GPU:gpu_fill_cb
fill an area in the memory with a color.gpu_wait_cb
if any GPU function returns while the GPU is still working, LVGL will use this function when required to make sure GPU rendering is ready.
オプションのディスプレイドライバデータフィールドがいくつかあります。physical_hor_res
フル/物理ディスプレイの水平解像度(ピクセル単位)。フルスクリーンを使用しない場合にのみこれを設定します(デフォルトは-1 /と同じhor_res
)。physical_ver_res
フル/物理ディスプレイの垂直解像度(ピクセル単位)。フルスクリーンを使用しない場合にのみこれを設定します(デフォルトは-1 /と同じver_res
)。offset_x
フル/物理ディスプレイからの水平オフセット(ピクセル単位)。フルスクリーンを使用しない場合にのみこれを設定します(デフォルトは0)。offset_y
フル/物理ディスプレイからの垂直オフセット(ピクセル単位)。フルスクリーンを使用しない場合にのみこれを設定します(デフォルトは0)。color_chroma_key
クロームキー画像に透明として描画される色。LV_COLOR_CHROMA_KEY
デフォルトでfromに設定されlv_conf.h
ています。anti_aliasing
アンチエイリアシング(エッジスムージング)を使用します。LV_COLOR_DEPTH
で少なくとも16に設定されている場合、デフォルトで有効になりますlv_conf.h
。rotated
以下の「回転」セクションをsw_rotate
参照してください。[1]LVGLの表示を登録するには、ascreen_transp
LVGLの表示を登録するには、a1
画面自体にも透明性を持たせることができる場合。LV_COLOR_SCREEN_TRANSP
で有効にするlv_conf.h
必要LV_COLOR_DEPTH
があり、32である必要があります。user_data
ドライバーのカスタムvoid
ユーザーデータ。full_refresh
常に画面全体を再描画します(上記を参照)direct_mode
フレームバッファに直接描画します(上記を参照)
モノクロ、グレースケール、またはその他の非標準RGBディスプレイでの作業をより簡単かつ最適にするための、その他のオプションのコールバック:
rounder_cb
再描画する領域の座標を丸めます。たとえば、2x2ピクセルは2x8に変換できます。ディスプレイコントローラーが特定の高さまたは幅(通常、モノクロディスプレイでは8ピクセルの高さ)の領域のみを更新できる場合に使用できます。set_px_cb
ドローバッファを書き込むカスタム関数。ディスプレイに特別なカラーフォーマットがある場合は、ピクセルをドローバッファにコンパクトに格納するために使用できます。(たとえば、1ビットのモノクロ、2ビットのグレースケールなど)このように、で使用されるバッファlv_disp_draw_buf_t
を小さくして、特定の領域サイズに必要なビット数のみを保持できます。set_px_cb
を使用したレンダリングは、通常のレンダリングよりも遅いことに注意してください。monitor_cb
更新されたピクセル数と時間数を通知するコールバック関数。最後のチャンクがレンダリングされてディスプレイに送信されたときに呼び出されます。clean_dcache_cb
表示に関連するキャッシュをクリーンアップするためのコールバック。
LVGLにはいくつかのGPUに対するサポートが組み込まれていますが(を参照
lv_conf.h
)、他に何かが必要な場合は、これらの関数を使用してLVGLにGPUを使用させることができます。gpu_fill_cb
メモリ内の領域を色で塗りつぶします。gpu_wait_cb
GPUがまだ機能している間にGPU関数が戻った場合、LVGLは必要に応じてこの関数を使用して、GPUレンダリングの準備ができていることを確認します。
Examples
英文 自動翻訳 All together it looks like this:
static lv_disp_drv_t disp_drv; /*A variable to hold the drivers. Must be static or global.*/ lv_disp_drv_init(&disp_drv); /*Basic initialization*/ disp_drv.draw_buf = &disp_buf; /*Set an initialized buffer*/ disp_drv.flush_cb = my_flush_cb; /*Set a flush callback to draw to the display*/ disp_drv.hor_res = 320; /*Set the horizontal resolution in pixels*/ disp_drv.ver_res = 240; /*Set the vertical resolution in pixels*/ lv_disp_t * disp; disp = lv_disp_drv_register(&disp_drv); /*Register the driver and save the created display objects*/
Here are some simple examples of the callbacks:
void my_flush_cb(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p) { /*The most simple case (but also the slowest) to put all pixels to the screen one-by-one *`put_px` is just an example, it needs to implemented by you.*/ int32_t x, y; for(y = area->y1; y <= area->y2; y++) { for(x = area->x1; x <= area->x2; x++) { put_px(x, y, *color_p); color_p++; } } /* IMPORTANT!!! * Inform the graphics library that you are ready with the flushing*/ lv_disp_flush_ready(disp_drv); } void my_gpu_fill_cb(lv_disp_drv_t * disp_drv, lv_color_t * dest_buf, const lv_area_t * dest_area, const lv_area_t * fill_area, lv_color_t color); { /*It's an example code which should be done by your GPU*/ uint32_t x, y; dest_buf += dest_width * fill_area->y1; /*Go to the first line*/ for(y = fill_area->y1; y < fill_area->y2; y++) { for(x = fill_area->x1; x < fill_area->x2; x++) { dest_buf[x] = color; } dest_buf+=dest_width; /*Go to the next line*/ } } void my_rounder_cb(lv_disp_drv_t * disp_drv, lv_area_t * area) { /* Update the areas as needed. * For example it makes the area to start only on 8th rows and have Nx8 pixel height.*/ area->y1 = area->y1 & 0x07; area->y2 = (area->y2 & 0x07) + 8; } void my_set_px_cb(lv_disp_drv_t * disp_drv, uint8_t * buf, lv_coord_t buf_w, lv_coord_t x, lv_coord_t y, lv_color_t color, lv_opa_t opa) { /* Write to the buffer as required for the display. * For example it writes only 1-bit for monochrome displays mapped vertically.*/ buf += buf_w * (y >> 3) + x; if(lv_color_brightness(color) > 128) (*buf) |= (1 << (y % 8)); else (*buf) &= ~(1 << (y % 8)); } void my_monitor_cb(lv_disp_drv_t * disp_drv, uint32_t time, uint32_t px) { printf("%d px refreshed in %d ms\n", time, ms); } void my_clean_dcache_cb(lv_disp_drv_t * disp_drv, uint32) { /* Example for Cortex-M (CMSIS) */ SCB_CleanInvalidateDCache(); }
全体として、次のようになります。static lv_disp_drv_t disp_drv ; /*ドライバーを保持する変数。静的またはグローバルである必要があります。*/ lv_disp_drv_init (&disp_drv ); /*基本的な初期化*/ disp_drv 。draw_buf = &disp_buf ; /*初期化されたバッファを設定します*/ disp_drv 。flush_cb = my_flush_cb ; /*ディスプレイに描画するフラッシュコールバックを設定します*/ disp_drv 。hor_res = 320 ; /*水平解像度をピクセル単位で設定します*/ disp_drv 。ver_res = 240; /*垂直解像度をピクセル単位で設定します*/ lv_disp_t * disp ; disp = lv_disp_drv_register (&disp_drv ); / *ドライバーを登録し、作成した表示オブジェクトを保存します* /
コールバックの簡単な例を次に示します。
void my_flush_cb (lv_disp_drv_t * disp_drv 、 const lv_area_t * area 、 lv_color_t * color_p ) { / *すべてのピクセルを1つずつ画面に配置する最も単純なケース(ただし最も遅いケース) *`put_px`は単なる例です。あなたが実装する必要があります。*/ int32_t x 、 y ; for (y = 面積-> y1 ; y <= 面積-> y2 ; y ++ ) { for (x = 面積-> x1 ; x <= 面積-> x2 ; x ++ ) { put_px (x 、 y 、 * color_p ); color_p ++ ; } } /* 重要!!! *フラッシュの準備ができていることをグラフィックライブラリに通知します*/ lv_disp_flush_ready (disp_drv ); } void my_gpu_fill_cb (lv_disp_drv_t * disp_drv 、 lv_color_t * dest_buf 、 const lv_area_t * dest_area 、 const lv_area_t * fill_area 、 lv_color_t color ); { /*これはGPUで実行する必要のあるサンプルコードです*/ uint32_t x 、 y ; dest_buf + = dest_width * fill_area- > y1 ; /*最初の行に移動します*/ for (y = fill_area- > y1 ; y < fill_area- > y2 ; y ++ ) { for (x = fill_area- > x1 ; x < fill_area- > x2 ; x ++ ) { dest_buf [ x ] = color ; } dest_buf + = dest_width ; /*次の行に移動します*/ } } void my_rounder_cb (lv_disp_drv_t * disp_drv 、 lv_area_t * area ) { /*必要に応じて領域を更新します。 *たとえば、領域は8行目から始まり、Nx8ピクセルの高さになります。* / area- > y1 = area- > y1 & 0x07 ; 面積-> y2 = (面積-> y2 & 0x07 ) + 8 ; } void my_set_px_cb (lv_disp_drv_t * disp_drv 、 uint8_t * buf 、 lv_coord_t buf_w 、 lv_coord_t x 、 lv_coord_t y 、 lv_color_t color 、 lv_opa_t opa ){ / *バッファに書き込む *たとえば、垂直方向にマッピングされたモノクロディスプレイの場合は1ビットのみを書き込みます。* / buf + = buf_w * (y >> 3 ) + x ; if (lv_color_brightness (color ) > 128 ) (* buf ) | = (1 << (y % 8 )); else (* buf ) &= 〜(1 << (y % 8 )); } void my_monitor_cb (lv_disp_drv_t * disp_drv 、 uint32_t time 、 uint32_t px ) { printf ("%d pxが%d msで更新されました\n " 、 time 、 ms ); } void my_clean_dcache_cb (lv_disp_drv_t * disp_drv 、 uint32 ) { / * Cortex-M(CMSIS)の例* / SCB_CleanInvalidateDCache (); }
Rotation
英文 自動翻訳 LVGL supports rotation of the display in 90 degree increments. You can select whether you'd like software rotation or hardware rotation.
If you select software rotation (
sw_rotate
flag set to 1), LVGL will perform the rotation for you. Your driver can and should assume that the screen width and height have not changed. Simply flush pixels to the display as normal. Software rotation requires no additional logic in yourflush_cb
callback.There is a noticeable amount of overhead to performing rotation in software. Hardware rotation is available to avoid unwanted slowdowns. In this mode, LVGL draws into the buffer as if your screen width and height were swapped. You are responsible for rotating the provided pixels yourself.
The default rotation of your display when it is initialized can be set using the
rotated
flag. The available options areLV_DISP_ROT_NONE
,LV_DISP_ROT_90
,LV_DISP_ROT_180
, orLV_DISP_ROT_270
. The rotation values are relative to how you would rotate the physical display in the clockwise direction. Thus,LV_DISP_ROT_90
means you rotate the hardware 90 degrees clockwise, and the display rotates 90 degrees counterclockwise to compensate.(Note for users upgrading from 7.10.0 and older: these new rotation enum values match up with the old 0/1 system for rotating 90 degrees, so legacy code should continue to work as expected. Software rotation is also disabled by default for compatibility.)
Display rotation can also be changed at runtime using the
lv_disp_set_rotation(disp, rot)
API.Support for software rotation is a new feature, so there may be some glitches/bugs depending on your configuration. If you encounter a problem please open an issue on GitHub.
LVGLは、90度刻みでのディスプレイの回転をサポートします。ソフトウェアローテーションまたはハードウェアローテーションのどちらを使用するかを選択できます。 ソフトウェアローテーション(
sw_rotate
フラグを1に設定)を選択すると、LVGLがローテーションを実行します。ドライバーは、画面の幅と高さが変更されていないと想定できます。通常どおり、ピクセルをディスプレイにフラッシュするだけです。ソフトウェアローテーションでは、flush_cb
コールバックに追加のロジックは必要ありません。ソフトウェアでローテーションを実行するには、かなりのオーバーヘッドがあります。不要な速度低下を回避するために、ハードウェアローテーションを利用できます。このモードでは、LVGLは、画面の幅と高さが交換されたかのようにバッファに描画します。提供されたピクセルを自分で回転させるのはあなたの責任です。
rotated
初期化時のディスプレイのデフォルトの回転は、フラグを使用して設定できます。使用可能なオプションは、、、、、LV_DISP_ROT_NONE
またはです。回転値は、物理ディスプレイを時計回りに回転させる方法を基準にしています。つまり、ハードウェアを時計回りに90度回転させ、ディスプレイを反時計回りに90度回転させて補正することを意味します。LV_DISP_ROT_90LV_DISP_ROT_180LV_DISP_ROT_270LV_DISP_ROT_90
(7.10.0以前からアップグレードするユーザーへの注意:これらの新しい回転列挙値は、90度回転する古い0/1システムと一致するため、レガシーコードは引き続き期待どおりに機能するはずです。互換性のために、ソフトウェアの回転もデフォルトで無効になっています。)
ディスプレイの回転は、
lv_disp_set_rotation(disp, rot)
APIを使用して実行時に変更することもできます。ソフトウェアローテーションのサポートは新機能であるため、構成によっては不具合やバグが発生する場合があります。問題が発生した場合は、GitHubで問題を開いてください。
Further reading
英文 自動翻訳 - lv_port_disp_template.c for a template for your own driver.
- Drawing to learn more about how rendering works in LVGL.
- Display features to learn more about higher level display features.
- 独自のドライバーのテンプレートのlv_port_disp_template.c 。
- LVGLでレンダリングがどのように機能するかを学ぶための描画。
- [2]より高いレベルの表示機能の詳細については、表示機能を参照してください。
API
@description Display Driver HAL interface header file
Typedefs
英文 自動翻訳 typedef struct _lv_disp_draw_buf_t lv_disp_draw_buf_t
- Structure for holding display buffer information.
typedef struct _lv_disp_drv_t lv_disp_drv_t
- Display Driver structure to be registered by HAL. Only its pointer will be saved in
lv_disp_t
so it should be declared asstatic lv_disp_drv_t my_drv
or allocated dynamically.
typedef struct _lv_disp_t lv_disp_t
- Display structure.
- Note :
lv_disp_drv_t
should be the first member of the structure.
typedef struct _lv_disp_draw_buf_t lv_disp_draw_buf_t- 表示バッファ情報を保持するための構造。
typedef struct _lv_disp_drv_t lv_disp_drv_t
- HALが登録するドライバ構造を表示します。そのポインタのみが保存される
lv_disp_t
ため、動的に宣言static lv_disp_drv_t my_drv
または割り当てる必要があります。
typedef struct _lv_disp_t lv_disp_t
- 表示構造。
- 注 :
lv_disp_drv_t
構造体の最初のメンバーである必要があります。
Enums
enum lv_disp_rot_t
- Values:
- enumerator LV_DISP_ROT_NONE
-
- enumerator LV_DISP_ROT_90
-
- enumerator LV_DISP_ROT_180
-
- enumerator LV_DISP_ROT_270
- Values:
Functions
英文 自動翻訳 void lv_disp_drv_init(lv_disp_drv_t *driver)
- Initialize a display driver with default values. It is used to have known values in the fields and not junk in memory. After it you can safely set only the fields you need.
- Parameters:
- driver -- pointer to driver variable to initialize
- Parameters:
void lv_disp_draw_buf_init(lv_disp_draw_buf_t *draw_buf, void *buf1, void *buf2, uint32_t size_in_px_cnt)
- Initialize a display buffer
- Parameters
- draw_buf -- pointer
lv_disp_draw_buf_t
variable to initialize - buf1 -- A buffer to be used by LVGL to draw the image. Always has to specified and can't be NULL. Can be an array allocated by the user. E.g.
static lv_color_t disp_buf1[1024 * 10]
Or a memory address e.g. in external SRAM - buf2 -- Optionally specify a second buffer to make image rendering and image flushing (sending to the display) parallel. In the
disp_drv->flush
you should use DMA or similar hardware to send the image to the display in the background. It lets LVGL to render next frame into the other buffer while previous is being sent. Set toNULL
if unused. - size_in_px_cnt -- size of the
buf1
andbuf2
in pixel count.
- draw_buf -- pointer
- Parameters
lv_disp_t *lv_disp_drv_register(lv_disp_drv_t *driver)
- Register an initialized display driver. Automatically set the first display as active.
- Parameters
- driver -- pointer to an initialized 'lv_disp_drv_t' variable. Only its pointer is saved!
- Returns
- pointer to the new display or NULL on error
- Parameters
void lv_disp_drv_update(lv_disp_t *disp, lv_disp_drv_t *new_drv)
- Update the driver in run time.
- Parameters
- disp -- pointer to a display. (return value of
lv_disp_drv_register
) - new_drv -- pointer to the new driver
- disp -- pointer to a display. (return value of
- Parameters
void lv_disp_remove(lv_disp_t *disp)
- Remove a display
- Parameters
- disp -- pointer to display
- Parameters
void lv_disp_set_default(lv_disp_t *disp)
- Set a default display. The new screens will be created on it by default.
- Parameters
- disp -- pointer to a display
- Parameters
lv_disp_t *lv_disp_get_default(void)
- Get the default display
- Returns
- pointer to the default display
- Returns
lv_coord_t lv_disp_get_hor_res(lv_disp_t *disp)
- Get the horizontal resolution of a display
- Parameters
- disp -- pointer to a display (NULL to use the default display)
- Returns
- the horizontal resolution of the display
- Parameters
lv_coord_t lv_disp_get_ver_res(lv_disp_t *disp)
- Get the vertical resolution of a display
- Parameters
- disp -- pointer to a display (NULL to use the default display)
- Returns
- the vertical resolution of the display
- Parameters
lv_coord_t lv_disp_get_physical_hor_res(lv_disp_t *disp)
- Get the full / physical horizontal resolution of a display
- Parameters
- disp -- pointer to a display (NULL to use the default display)
- Returns
- the full / physical horizontal resolution of the display
- Parameters
lv_coord_t lv_disp_get_physical_ver_res(lv_disp_t *disp)
- Get the full / physical vertical resolution of a display
- Parameters
- disp -- pointer to a display (NULL to use the default display)
- Returns
- the full / physical vertical resolution of the display
- Parameters
lv_coord_t lv_disp_get_offset_x(lv_disp_t *disp)
- Get the horizontal offset from the full / physical display
- Parameters
- disp -- pointer to a display (NULL to use the default display)
- Returns
- the horizontal offset from the full / physical display
- Parameters
lv_coord_t lv_disp_get_offset_y(lv_disp_t *disp)
- Get the vertical offset from the full / physical display
- Parameters
- disp -- pointer to a display (NULL to use the default display)
- Returns
- the horizontal offset from the full / physical display
- Parameters
bool lv_disp_get_antialiasing(lv_disp_t *disp)
- Get if anti-aliasing is enabled for a display or not
- Parameters
- disp -- pointer to a display (NULL to use the default display)
- Returns
- true: anti-aliasing is enabled: false: disabled
- Parameters
lv_coord_t lv_disp_get_dpi(const lv_disp_t *disp)
- Get the DPI of the display
- Parameters
- disp -- pointer to a display (NULL to use the default display)
- Returns
- dpi of the display
- Parameters
void lv_disp_set_rotation(lv_disp_t *disp, lv_disp_rot_t rotation)
- Set the rotation of this display.
- Parameters
- disp -- pointer to a display (NULL to use the default display)
- rotation -- rotation angle
- Parameters
lv_disp_rot_t lv_disp_get_rotation(lv_disp_t *disp)
- Get the current rotation of this display.
- Parameters
- disp -- pointer to a display (NULL to use the default display)
- Returns
- rotation angle
- Parameters
lv_disp_t *lv_disp_get_next(lv_disp_t *disp)
- Get the next display.
- Parameters
- disp -- pointer to the current display. NULL to initialize.
- Returns
- the next display or NULL if no more. Give the first display when the parameter is NULL
- Parameters
lv_disp_draw_buf_t *lv_disp_get_draw_buf(lv_disp_t *disp)
- Get the internal buffer of a display
- Parameters
- disp -- pointer to a display
- Returns
- pointer to the internal buffers
- Parameters
void lv_disp_drv_use_generic_set_px_cb(lv_disp_drv_t *disp_drv, lv_img_cf_t cf)
struct _lv_disp_draw_buf_t
- #include <lv_hal_disp.h> Structure for holding display buffer information.
- Public Members
- void *buf1
- First display buffer.
- void *buf2
- Second display buffer.
- void *buf_act
- void *buf1
-
- uint32_t size
-
- int flushing
-
- int flushing_last
-
- uint32_t last_area
-
- uint32_t last_part
struct _lv_disp_drv_t
- #include <lv_hal_disp.h> Display Driver structure to be registered by HAL. Only its pointer will be saved in
lv_disp_t
so it should be declared asstatic lv_disp_drv_t my_drv
or allocated dynamically. - Public Members
- lv_coord_t hor_res
- Horizontal resolution.
- lv_coord_t ver_res
- Vertical resolution.
- lv_coord_t physical_hor_res
- Horizontal resolution of the full / physical display. Set to -1 for fullscreen mode.
- lv_coord_t physical_ver_res
- Vertical resolution of the full / physical display. Set to -1 for fullscreen mode.
- lv_coord_t offset_x
- Horizontal offset from the full / physical display. Set to 0 for fullscreen mode.
- lv_coord_t offset_y
- Vertical offset from the full / physical display. Set to 0 for fullscreen mode.
- lv_disp_draw_buf_t *draw_buf
- Pointer to a buffer initialized with
lv_disp_draw_buf_init()
. LVGL will use this buffer(s) to draw the screens contents
- Pointer to a buffer initialized with
- uint32_t direct_mode
- 1: Use screen-sized buffers and draw to absolute coordinates
- uint32_t full_refresh
- 1: Always make the whole screen redrawn
- uint32_t sw_rotate
- 1: use software rotation (slower)
- uint32_t antialiasing
- 1: anti-aliasing is enabled on this display.
- uint32_t rotated
- 1: turn the display by 90 degree.
- Warning: Does not update coordinates for you!
- uint32_t screen_transp
- uint32_t dpi
- Handle if the screen doesn't have a solid (opa == LV_OPA_COVER) background. Use only if required because it's slower.
- void (*flush_cb)(struct _lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_color_t *color_p)
- DPI (dot per inch) of the display. Default value is
LV_DPI_DEF
. MANDATORY: Write the internal buffer (draw_buf) to the display. 'lv_disp_flush_ready()' has to be called when finished
- DPI (dot per inch) of the display. Default value is
- void (*rounder_cb)(struct _lv_disp_drv_t *disp_drv, lv_area_t *area)
- OPTIONAL: Extend the invalidated areas to match with the display drivers requirements E.g. round
y
to, 8, 16 ..) on a monochrome display
- OPTIONAL: Extend the invalidated areas to match with the display drivers requirements E.g. round
- void (*set_px_cb)(struct _lv_disp_drv_t *disp_drv, uint8_t *buf, lv_coord_t buf_w, lv_coord_t x, lv_coord_t y, lv_color_t color, lv_opa_t opa)
- OPTIONAL: Set a pixel in a buffer according to the special requirements of the display Can be used for color format not supported in LittelvGL. E.g. 2 bit -> 4 gray scales
- Note: Much slower then drawing with supported color formats.
- void (*clear_cb)(struct _lv_disp_drv_t *disp_drv, uint8_t *buf, uint32_t size)
- void (*monitor_cb)(struct _lv_disp_drv_t *disp_drv, uint32_t time, uint32_t px)
- OPTIONAL: Called after every refresh cycle to tell the rendering and flushing time + the number of flushed pixels
- void (*wait_cb)(struct _lv_disp_drv_t *disp_drv)
- OPTIONAL: Called periodically while lvgl waits for operation to be completed. For example flushing or GPU User can execute very simple tasks here or yield the task
- void (*clean_dcache_cb)(struct _lv_disp_drv_t *disp_drv)
- OPTIONAL: Called when lvgl needs any CPU cache that affects rendering to be cleaned
- void (*drv_update_cb)(struct _lv_disp_drv_t *disp_drv)
- OPTIONAL: called when driver parameters are updated
- lv_color_t color_chroma_key
- On CHROMA_KEYED images this color will be transparent.
LV_COLOR_CHROMA_KEY
by default. (lv_conf.h)
- On CHROMA_KEYED images this color will be transparent.
- lv_draw_ctx_t *draw_ctx
- void (*draw_ctx_init)(struct _lv_disp_drv_t *disp_drv, lv_draw_ctx_t *draw_ctx)
- void (*draw_ctx_deinit)(struct _lv_disp_drv_t *disp_drv, lv_draw_ctx_t *draw_ctx)
- size_t draw_ctx_size
- void *user_data
- Custom display driver user data
struct _lv_disp_t
- #include <lv_'hal_disp.h> Display structure.
- Note
lv_disp_drv_t
should be the first member of the structure. - Public Members
- struct _lv_disp_drv_t *driver
- < Driver to the display A timer which periodically checks the dirty areas and refreshes them
- lv_timer_t *refr_timer
- The theme assigned to the screen
- struct _lv_theme_t *theme
- struct _lv_obj_t **screens
- Screens of the display Array of screen objects.
- struct _lv_obj_t *act_scr
- Currently active screen on this display
- struct _lv_obj_t *prev_scr
- Previous screen. Used during screen animations
- struct _lv_obj_t *scr_to_load
- The screen prepared to load in lv_scr_load_anim
- struct _lv_obj_t *top_layer
- struct _lv_obj_t *sys_layer
- uint32_t screen_cnt
- uint8_t del_prev
- 1: Automatically delete the previous screen when the screen load animation is ready
- lv_opa_t bg_opa
- Opacity of the background color or wallpaper
- lv_color_t bg_color
- Default display color when screens are transparent
- const void *bg_img
- An image source to display as wallpaper
- lv_area_t inv_areas[LV_INV_BUF_SIZE]
- Invalidated (marked to redraw) areas
- uint8_t inv_area_joined[LV_INV_BUF_SIZE]
- uint16_t inv_p
- uint32_t last_activity_time
- Last time when there was activity on this display
void lv_disp_drv_init(lv_disp_drv_t * driver)- デフォルト値でディスプレイドライバを初期化します。これは、フィールドに既知の値を持ち、メモリにジャンクではないために使用されます。その後、必要なフィールドのみを安全に設定できます。
- パラメーター:
- driver-初期化するドライバー変数へのポインター
- パラメーター:
void lv_disp_draw_buf_init(lv_disp_draw_buf_t * draw_buf、void * buf1、void * buf2、uint32_t size_in_px_cnt)
- 表示バッファを初期化します
- パラメーター
- draw_buf--初期化するポインタ
lv_disp_draw_buf_t
変数 - buf1-画像を描画するためにLVGLによって使用されるバッファー。常に指定する必要があり、NULLにすることはできません。ユーザーが割り当てた配列にすることができます。例:
static lv_color_t disp_buf1[1024 * 10]
または外部SRAMのメモリアドレス - buf2-オプションで、画像のレンダリングと画像のフラッシュ(ディスプレイへの送信)を並行させるための2番目のバッファーを指定します。では、
disp_drv->flush
DMAまたは同様のハードウェアを使用して、画像をバックグラウンドのディスプレイに送信する必要があります。これにより、LVGLは、前のフレームが送信されている間、次のフレームを他のバッファーにレンダリングできます。NULL
未使用の場合はに設定します。 - size_in_px_cnt-およびのサイズ
buf1
とbuf2
ピクセル数。
- draw_buf--初期化するポインタ
- パラメーター
lv_disp_t * lv_disp_drv_register(lv_disp_drv_t * driver)
- 初期化されたディスプレイドライバを登録します。最初のディスプレイを自動的にアクティブに設定します。
- パラメーター
- driver-初期化された'lv_disp_drv_t'変数へのポインター。そのポインタだけが保存されます!
- 戻り値
- 新しい表示へのポインタまたはエラーの場合はNULL
- パラメーター
void lv_disp_drv_update(lv_disp_t * disp、lv_disp_drv_t * new_drv)
- 実行時にドライバーを更新します。
- パラメーター
- disp--ディスプレイへのポインタ。(の戻り値
lv_disp_drv_register
) - new_drv--新しいドライバへのポインタ
- disp--ディスプレイへのポインタ。(の戻り値
- パラメーター
void lv_disp_remove(lv_disp_t * disp)
- ディスプレイを取り外す
- パラメーター
- disp--表示するポインタ
- パラメーター
void lv_disp_set_default(lv_disp_t * disp)
- デフォルトの表示を設定します。デフォルトでは、新しい画面が作成されます。
- パラメーター
- disp--ディスプレイへのポインタ
- パラメーター
lv_disp_t * lv_disp_get_default(void)
- デフォルトの表示を取得する
- 戻り値
- デフォルト表示へのポインタ
- 戻り値
lv_coord_t lv_disp_get_hor_res(lv_disp_t * disp)
- ディスプレイの水平解像度を取得する
- パラメーター
- disp-ディスプレイへのポインタ(デフォルトのディスプレイを使用する場合はNULL)
- 戻り値
- ディスプレイの水平解像度
- パラメーター
lv_coord_t lv_disp_get_ver_res(lv_disp_t * disp)
- ディスプレイの垂直解像度を取得する
- パラメーター
- disp-ディスプレイへのポインタ(デフォルトのディスプレイを使用する場合はNULL)
- 戻り値
- ディスプレイの垂直解像度
- パラメーター
lv_coord_t lv_disp_get_physical_hor_res(lv_disp_t * disp)
- ディスプレイのフル/物理的な水平解像度を取得します
- パラメーター
- disp-ディスプレイへのポインタ(デフォルトのディスプレイを使用する場合はNULL)
- 戻り値
- ディスプレイのフル/物理的な水平解像度
- パラメーター
lv_coord_t lv_disp_get_physical_ver_res(lv_disp_t * disp)
- ディスプレイのフル/物理的な垂直解像度を取得します
- パラメーター
- disp-ディスプレイへのポインタ(デフォルトのディスプレイを使用する場合はNULL)
- 戻り値
- ディスプレイのフル/物理的な垂直解像度
- パラメーター
lv_coord_t lv_disp_get_offset_x(lv_disp_t * disp)
- フル/物理ディスプレイから水平オフセットを取得します
- パラメーター
- disp-ディスプレイへのポインタ(デフォルトのディスプレイを使用する場合はNULL)
- 戻り値
- フル/物理ディスプレイからの水平オフセット
- パラメーター
lv_coord_t lv_disp_get_offset_y(lv_disp_t * disp)
- フル/物理ディスプレイから垂直オフセットを取得します
- パラメーター
- disp-ディスプレイへのポインタ(デフォルトのディスプレイを使用する場合はNULL)
- 戻り値
- フル/物理ディスプレイからの水平オフセット
- パラメーター
bool lv_disp_get_antialiasing(lv_disp_t * disp)
- ディスプレイに対してアンチエイリアシングが有効になっているかどうかを取得します
- パラメーター
- disp-ディスプレイへのポインタ(デフォルトのディスプレイを使用する場合はNULL)
- 戻り値
- true:アンチエイリアシングが有効になっています:false:無効になっています
- パラメーター
lv_coord_t lv_disp_get_dpi(const lv_disp_t * disp)
- ディスプレイのDPIを取得する
- パラメーター
- disp-ディスプレイへのポインタ(デフォルトのディスプレイを使用する場合はNULL)
- 戻り値
- ディスプレイのdpi
- パラメーター
void lv_disp_set_rotation(lv_disp_t * disp、lv_disp_rot_trotation)
- このディスプレイの回転を設定します。
- パラメーター
- disp-ディスプレイへのポインタ(デフォルトのディスプレイを使用する場合はNULL)
- 回転-回転角
- パラメーター
lv_disp_rot_t lv_disp_get_rotation(lv_disp_t * disp)
- このディスプレイの現在の回転を取得します。
- パラメーター
- disp-ディスプレイへのポインタ(デフォルトのディスプレイを使用する場合はNULL)
- 戻り値
- 回転角度
- パラメーター
lv_disp_t * lv_disp_get_next(lv_disp_t * disp)
- 次の表示を取得します。
- パラメーター
- disp--現在の表示へのポインタ。初期化するにはNULL。
- 戻り値
- 次の表示、またはそれ以上ない場合はNULL。パラメータがNULLの場合に最初の表示を行います
- パラメーター
lv_disp_draw_buf_t * lv_disp_get_draw_buf(lv_disp_t * disp)
- ディスプレイの内部バッファを取得する
- パラメーター
- disp--ディスプレイへのポインタ
- 戻り値
- 内部バッファへのポインタ
- パラメーター
void lv_disp_drv_use_generic_set_px_cb(lv_disp_drv_t * disp_drv、lv_img_cf_t cf)
struct _lv_disp_draw_buf_t
- #include<lv_hal_disp.h>ディスプレイバッファ情報を保持するための構造。
- パブリックメンバー
- void * buf1
- 最初の表示バッファ。
- void * buf2
- 2番目の表示バッファ。
- void * buf_act
- uint32_tサイズ
- intフラッシング
- intflashing_last
- uint32_t last_area
- uint32_t last_part
- void * buf1
struct _lv_disp_drv_t
- #include<lv_hal_disp.h> HALによって登録されるドライバー構造を表示します。そのポインタのみが保存される
lv_disp_t
ため、動的に宣言static lv_disp_drv_t my_drv
または割り当てる必要があります。 - パブリックメンバー
- lv_coord_t hor_res
- 水平解像度。
- lv_coord_t ver_res
- 垂直解像度。
- lv_coord_tphysical_hor_res
- フル/物理ディスプレイの水平解像度。フルスクリーンモードの場合は-1に設定します。
- lv_coord_tphysical_ver_res
- フル/物理ディスプレイの垂直解像度。フルスクリーンモードの場合は-1に設定します。
- lv_coord_t offset_x
- フル/物理ディスプレイからの水平オフセット。フルスクリーンモードの場合は0に設定します。
- lv_coord_t offset_y
- フル/物理ディスプレイからの垂直オフセット。フルスクリーンモードの場合は0に設定します。
- lv_disp_draw_buf_t * draw_buf
- で初期化されたバッファへのポインタ
lv_disp_draw_buf_init()
。LVGLは、このバッファーを使用して画面の内容を描画します
- で初期化されたバッファへのポインタ
- uint32_t direct_mode
- 1:画面サイズのバッファを使用し、絶対座標に描画します
- uint32_t full_refresh
- 1:常に画面全体を再描画する
- uint32_t sw_rotate
- 1:ソフトウェアローテーションを使用する(遅い)
- uint32_tアンチエイリアス
- 1:このディスプレイでアンチエイリアシングが有効になっています。
- uint32_tが回転しました
- 1:ディスプレイを90度回転させます。
- 警告:座標は更新されません!
- uint32_t screen_transp
- uint32_t dpi
- 画面に無地(opa == LV_OPA_COVER)の背景がない場合に処理します。速度が遅いため、必要な場合にのみ使用してください。
- void(* flush_cb)(struct _ lv_disp_drv_t * disp_drv、const lv_area_t * area、lv_color_t * color_p)
- ディスプレイのDPI(ドット/インチ)。デフォルト値は
LV_DPI_DEF
です。必須:内部バッファー(draw_buf)をディスプレイに書き込みます。終了時に「lv_disp_flush_ready()」を呼び出す必要があります
- ディスプレイのDPI(ドット/インチ)。デフォルト値は
- void(* rounder_cb)(struct _ lv_disp_drv_t * disp_drv、lv_area_t * area)
- LVGLの表示を登録するには、a
y
オプション:無効化された領域を拡張して、モノクロディスプレイのディスプレイドライバの要件に一致させます。たとえば、8、16 ..)に丸めます。
- LVGLの表示を登録するには、a
- void(* set_px_cb)(struct _ lv_disp_drv_t * disp_drv、uint8_t * buf、lv_coord_t buf_w、lv_coord_t x、lv_coord_t y、lv_color_t color、lv_opa_t opa)
- オプション:ディスプレイの特別な要件に従って、バッファにピクセルを設定します。LittelvGLでサポートされていないカラーフォーマットに使用できます。例:2ビット->4グレースケール
- 注:サポートされているカラー形式で描画するよりもはるかに遅くなります。
- void(* clear_cb)(struct _ lv_disp_drv_t * disp_drv、uint8_t * buf、uint32_t size)
- void(* monitor_cb)(struct _ lv_disp_drv_t * disp_drv、uint32_t time、uint32_t px)
- オプション:更新サイクルごとに呼び出され、レンダリングとフラッシュの時間+フラッシュされたピクセルの数を通知します
- void(* wait_cb)(struct _ lv_disp_drv_t * disp_drv)
- オプション:lvglが操作の完了を待機している間、定期的に呼び出されます。たとえば、フラッシングまたはGPUユーザーは、ここで非常に単純なタスクを実行したり、タスクを生成したりできます
- void(* clean_dcache_cb)(struct _ lv_disp_drv_t * disp_drv)
- オプション:lvglがレンダリングに影響を与えるCPUキャッシュをクリーンアップする必要がある場合に呼び出されます
- void(* drv_update_cb)(struct _ lv_disp_drv_t * disp_drv)
- オプション:ドライバーパラメーターが更新されたときに呼び出されます
- lv_color_t color_chroma_key
- CHROMA_KEYED画像では、この色は透明になります。
LV_COLOR_CHROMA_KEY
デフォルトでは。(lv_conf.h)
- CHROMA_KEYED画像では、この色は透明になります。
- lv_draw_ctx_t * draw_ctx
- void(* draw_ctx_init)(struct _ lv_disp_drv_t * disp_drv、lv_draw_ctx_t * draw_ctx)
- void(* draw_ctx_deinit)(struct _ lv_disp_drv_t * disp_drv、lv_draw_ctx_t * draw_ctx)
- size_t draw_ctx_size
- void * user_data
- カスタムディスプレイドライバーのユーザーデータ
struct _lv_disp_t
- #include<lv_'hal_disp.h>構造を表示します。
- LVGLの表示を登録するには、a
lv_disp_drv_t
構造体の最初のメンバーであることに 注意 してください。 - パブリックメンバー
- struct _ lv_disp_drv_t * driver
- <ディスプレイへのドライバー汚れた部分を定期的にチェックしてリフレッシュするタイマー
- lv_timer_t * refr_timer
- 画面に割り当てられたテーマ
- struct _ lv_theme_t * theme
- struct _lv_obj_t **画面
- 表示の画面画面オブジェクトの配列。
- struct _ lv_obj_t * act_scr
- このディスプレイで現在アクティブな画面
- struct _ lv_obj_t * prev_scr
- 前の画面。画面アニメーション中に使用されます
- struct _ lv_obj_t * scr_to_load
- lv_scr_load_animにロードする準備ができた画面
- struct _ lv_obj_t * top_layer
- 見る
- lv_disp_get_layer_top
- struct _ lv_obj_t * sys_layer
- 見る
- lv_disp_get_layer_sys
- uint32_t screen_cnt
- uint8_t del_prev
- 1:画面読み込みアニメーションの準備ができたら、前の画面を自動的に削除します
- lv_opa_t bg_opa
- 背景色または壁紙の不透明度
- lv_color_t bg_color
- 画面が透明な場合のデフォルトの表示色
- const void * bg_img
- 壁紙として表示する画像ソース
- lv_area_t inv_areas [LV_INV_BUF_SIZE]
- 無効化された(再描画するようにマークされた)領域
- uint8_t inv_area_joined [LV_INV_BUF_SIZE]
- uint16_t inv_p
- uint32_t last_activity_time
- 前回このディスプレイでアクティビティがあったとき
- Initialize a display driver with default values. It is used to have known values in the fields and not junk in memory. After it you can safely set only the fields you need.