「App:Library:LVGL:docs:Porting:Display interface」の版間の差分

提供: robot-jp wiki
ナビゲーションに移動検索に移動
 
(同じ利用者による、間の44版が非表示)
1行目: 1行目:
 
https://docs.lvgl.io/8.2/porting/display.html
 
https://docs.lvgl.io/8.2/porting/display.html
__NOTOC__
+
 
{| class="wikitable"
+
= Display interface =
 +
:{| class="wikitable"
 
!英文
 
!英文
 
!自動翻訳
 
!自動翻訳
 
|-
 
|-
 
|
 
|
 +
To set up a display an <code style="color: #bb0000;">lv_disp_buf_t</code> and an <code style="color: #bb0000;">lv_disp_drv_t</code> variable have to be initialized.
 +
 +
*<code style="color: #bb0000;">lv_disp_buf_t</code> contains internal graphic buffer(s).
 +
* <code style="color: #bb0000;">lv_disp_drv_t</code> contains callback functions to interact with the display and manipulate drawing related things.
 
|
 
|
 +
 +
 +
ディスプレイをセットアップするには、<code style="color: #bb0000;">lv_disp_buf_t</code>と<code style="color: #bb0000;">lv_disp_drv_t</code>の変数を初期化する必要があります。
 +
 +
*<code style="color: #bb0000;">lv_disp_buf_t</code>内部グラフィックバッファが含まれています。
 +
* <code style="color: #bb0000;">lv_disp_drv_t</code>ディスプレイと対話し、描画関連のものを操作するためのコールバック関数が含まれています。
 +
|}
 +
:[[App:Library:LVGL:docs:Porting#Display interface|戻る : Previous]]
 +
 +
 +
== [https://docs.lvgl.io/latest/en/html/porting/display.html?highlight=lv_disp_buf_init#display-buffer Display buffer] ==
 +
:{| class="wikitable"
 +
!英文
 +
!自動翻訳
 
|-
 
|-
 
|
 
|
|
+
<code style="color: #bb0000;">lv_disp_buf_t</code> can be initialized like this: <syntaxhighlight lang="c++" style="border: 1px dashed gray;">
 +
/*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_buf_init(&disp_buf, buf_1, buf_2, MY_DISP_HOR_RES*10);
 +
</syntaxhighlight>
 +
 +
|<code style="color: #bb0000;">lv_disp_buf_t</code>は次のように初期化できます。
 +
<syntaxhighlight lang="c++" style="border: 1px dashed gray;">
 +
/*バッファを格納する静的変数またはグローバル変数*/
 +
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_buf_init (&disp_buf 、 buf_1 、 buf_2 、 MY_DISP_HOR_RES * 10 );
 +
</syntaxhighlight>
 
|-
 
|-
|
+
|There are 3 possible configurations regarding the buffer size:
|
+
 
|-
+
 
|
+
1.
|
+
 
|-
+
'''One buffer LVGL''' draws the content of the screen into a buffer and sends it to the display.
|
+
 
|
+
The buffer can be smaller than the screen.
|-
+
 
|
+
In this case, the larger areas will be redrawn in multiple parts.
|
+
 
|-
+
If only small areas changes (e.g. button press) then only those areas will be refreshed.
|
+
 
|
+
 
|-
 
|
 
|
 
|}
 
  
 +
|バッファ サイズに関しては、次の 3 つの構成が可能です。
  
  
= Display interface =
+
1.
To register a display for LVGL, a <code>lv_disp_draw_buf_t</code> and a <code>lv_disp_drv_t</code> variable have to be initialized.
 
  
* <code>lv_disp_draw_buf_t</code> contains internal graphic buffer(s) called draw buffer(s).
+
'''One buffer LVGL''' は、画面のコンテンツをバッファーに描画し、それをディスプレイに送信します。
* <code>lv_disp_drv_t</code> contains callback functions to interact with the display and manipulate low level drawing behavior.
 
  
== 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 <code>flush_cb</code> function set in the display driver (see below).
 
  
A draw buffer can be initialized via a <code>lv_disp_draw_buf_t</code> 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 <code>lv_disp_draw_buf_t</code> 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.
+
小さな領域のみが変更された場合 (ボタンを押すなど)、それらの領域のみが更新されます。
 +
|-
 +
|2.
 +
'''Two non-screen-sized buffers having two buffers LVGL''' can draw into one buffer while the content of the other buffer is sent to display in the background.  
  
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.
+
DMA or other hardware should be used to transfer the data to the display to let the CPU draw meanwhile.  
  
== Buffering modes ==
+
This way the rendering and refreshing of the display become parallel.  
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.
+
Similarly to the '''''One buffer'',''' LVGL will draw the display's content in chunks if the buffer is smaller than the area to refresh.
 +
|2.
 +
'''Two non-screen-sized buffers having two buffers LVGL'''(2つのバッファを持つ非スクリーンサイズのバッファ) は、一方のバッファに描画でき、他方の表示用バッファの内容はバックグラウンドで送信されます。
  
=== One buffer ===
+
DMA またはその他のハードウェアを使用してデータをディスプレイに転送し、その間に CPU が描画できるようにする必要があります。
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.
 
  
=== 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.
 
  
=== Full refresh ===
+
'''''One buffer'''''と同様に、バッファがリフレッシュする領域よりも小さい場合、LVGL はディスプレイのコンテンツをまとめて描画します。
In the display driver (<code>lv_disp_drv_t</code>) enabling the <code>full_refresh</code> bit will force LVGL to always redraw the whole screen. This works in both ''one buffer'' and ''two buffers'' modes. If <code>full_refresh</code> is enabled and two screen sized draw buffers are provided, LVGL's display handling works like "traditional" double buffering. This means the <code>flush_cb</code> callback only has to update the address of the framebuffer (<code>color_p</code> 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.
+
|-
 +
|3.
 +
'''Two screen-sized buffers.'''  
  
=== Direct mode ===
+
In contrast to ''Two non-screen-sized buffers'' LVGL will always provide the whole screen's content not only chunks.  
If the <code>direct_mode</code> 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 case <code>flush_cb</code> will be called only once when all dirty areas are redrawn. With <code>direct_mode</code> 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 in <code>flush_cb</code> like this:
 
  
# Display the frame buffer pointed by <code>color_p</code>
+
This way the driver can simply change the address of the frame buffer to the buffer received from LVGL.  
# Copy the redrawn areas from <code>color_p</code> to the other buffer.
 
  
The get the redrawn areas to copy use the following functions <code>_lv_refr_get_disp_refreshing()</code> returns the display being refreshed <code>disp->inv_areas[LV_INV_BUF_SIZE]</code> contains the invalidated areas <code>disp->inv_area_joined[LV_INV_BUF_SIZE]</code> if 1 that area was joined into another one and should be ignored <code>disp->inv_p</code> number of valid elements in <code>inv_areas</code>
+
Therefore this method works the best when the MCU has an LCD/TFT interface and the frame buffer is just a location in the RAM.
  
== Display driver ==
+
You can measure the performance of your display configuration using the [https://github.com/lvgl/lv_demos/tree/master/src/lv_demo_benchmark <u>benchmark example</u>].
Once the buffer initialization is ready a <code>lv_disp_drv_t</code> display driver needs to be:
+
|3.
 +
'''Two screen-sized buffers.'''
  
# initialized with <code>lv_disp_drv_init(&disp_drv)</code>
+
2 つの非画面サイズのバッファとは対照的に、LVGL はまとまったデータだけでなく画面全体のコンテンツを常に提供します。
# its fields need to be set
 
# it needs to be registered in LVGL with <code>lv_disp_drv_register(&disp_drv)</code>
 
  
Note that <code>lv_disp_drv_t</code> also needs to be a static, global or dynamically allocated variable.
+
このようにして、ドライバはフレーム バッファのアドレスを LVGL から受信したバッファに簡単に変更できます。
  
=== Mandatory fields ===
+
したがって、この方法は、MCU に LCD/TFT インターフェイスがあり、フレーム バッファが RAM 内にある場合に最適です。
In the most simple case only the following fields of <code>lv_disp_drv_t</code> need to be set:
 
  
* <code>draw_buf</code> pointer to an initialized <code>lv_disp_draw_buf_t</code> variable.
+
[https://github.com/lvgl/lv_demos/tree/master/src/lv_demo_benchmark <u>ベンチマークの例</u>]を使用して、ディスプレイ設定のパフォーマンスを測定できます。
* <code>hor_res</code> horizontal resolution of the display in pixels.
+
|}
* <code>ver_res</code> vertical resolution of the display in pixels.
+
:[[App:Library:LVGL:docs:Porting#Display interface|戻る : Previous]]
* <code>flush_cb</code> a callback function to copy a buffer's content to a specific area of the display. <code>lv_disp_flush_ready(&disp_drv)</code> needs to be called when flushing is ready. LVGL might render the screen in multiple chunks and therefore call <code>flush_cb</code> multiple times. To see if the current one is the last chunk of rendering use <code>lv_disp_flush_is_last(&disp_drv)</code>.
 
  
=== Optional fields ===
+
== [https://docs.lvgl.io/latest/en/html/porting/display.html?highlight=lv_disp_buf_init#display-driver Display driver] ==
There are some optional display driver data fields:
+
:{| class="wikitable"
 +
!英文
 +
!自動翻訳
 +
|-
 +
|Once the buffer initialization is ready the display drivers need to be initialized. In the most simple case only the following two fields of <code style="color: #bb0000;">lv_disp_drv_t</code> needs to be set:
  
* <code>physical_hor_res</code> horizontal resolution of the full / physical display in pixels. Only set this when ''not'' using the full screen (defaults to -1 / same as <code>hor_res</code>).
+
* buffer pointer to an initialized <code style="color: #bb0000;">lv_disp_buf_t</code> variable.
* <code>physical_ver_res</code> vertical resolution of the full / physical display in pixels. Only set this when ''not'' using the full screen (defaults to -1 / same as <code>ver_res</code>).
+
* flush_cb a callback function to copy a buffer's content to a specific area of the display. <code style="color: #bb0000;">lv_disp_flush_ready()</code> needs to be called when flushing is ready. LVGL might render the screen in multiple chunks and therefore call <code style="color: #bb0000;">flush_cb</code> multiple times. To see which is the last chunk of rendering use <code style="color: #bb0000;">lv_disp_flush_is_last()</code>.
* <code>offset_x</code> horizontal offset from the full / physical display in pixels. Only set this when ''not'' using the full screen (defaults to 0).
+
|バッファの初期化の準備ができたら、ディスプレイドライバを初期化する必要があります。最も単純なケースでは、lv_disp_drv_t の以下の2つのフィールドを設定するだけでよい。
* <code>offset_y</code> vertical offset from the full / physical display in pixels. Only set this when ''not'' using the full screen (defaults to 0).
 
* <code>color_chroma_key</code> A color which will be drawn as transparent on chrome keyed images. Set to <code>LV_COLOR_CHROMA_KEY</code> from <code>lv_conf.h</code> by default.
 
* <code>anti_aliasing</code> use anti-aliasing (edge smoothing). Enabled by default if <code>LV_COLOR_DEPTH</code> is set to at least 16 in <code>lv_conf.h</code>.
 
* <code>rotated</code> and <code>sw_rotate</code> See the Rotation section below.
 
* <code>screen_transp</code> if <code>1</code> the screen itself can have transparency as well. <code>LV_COLOR_SCREEN_TRANSP</code> must be enabled in <code>lv_conf.h</code> and <code>LV_COLOR_DEPTH</code> must be 32.
 
* <code>user_data</code> A custom <code>void</code> user data for the driver.
 
* <code>full_refresh</code> always redrawn the whole screen (see above)
 
* <code>direct_mode</code> 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:
+
* buffer 初期化された lv_disp_buf_t 変数へのポインタ。
 +
* flush_cb バッファの内容をディスプレイの特定の領域にコピーするためのコールバック関数です。LVGLは画面を複数のチャンクでレンダリングすることがあるので、flush_cbを複数回呼び出すことがあります。どのチャンクが最後のレンダリングであるかを確認するには、lv_disp_flush_is_last() を使用します。
 +
|-
 +
|There are some optional data fields:
  
* <code>rounder_cb</code> 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).
+
* hor_res horizontal resolution of the display. (<code style="color: #bb0000;">LV_HOR_RES_MAX</code> by default from ''lv_conf.h'').
* <code>set_px_cb</code> 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 in <code>lv_disp_draw_buf_t</code> can be smaller to hold only the required number of bits for the given area size. Note that rendering with <code>set_px_cb</code> is slower than normal rendering.
+
* ver_res vertical resolution of the display. (<code style="color: #bb0000;">LV_VER_RES_MAX</code> by default from ''lv_conf.h'').
* <code>monitor_cb</code> 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.
+
* color_chroma_key a color which will be drawn as transparent on chrome keyed images. <code style="color: #bb0000;">LV_COLOR_TRANSP</code> by default from ''lv_conf.h'').
* <code>clean_dcache_cb</code> A callback for cleaning any caches related to the display.
+
* user_data custom user data for the driver. Its type can be modified in lv_conf.h.
 +
* anti-aliasing use anti-aliasing (edge smoothing). <code style="color: #bb0000;">LV_ANTIALIAS</code> by default from ''lv_conf.h''.
 +
* rotated and sw_rotate See the rotation section below.
 +
* screen_transp if <code style="color: #bb0000;">1</code> the screen can have transparent or opaque style. <code style="color: #bb0000;">LV_COLOR_SCREEN_TRANSP</code> needs to enabled in ''lv_conf.h''.
 +
|オプションのデータフィールドがいくつかあります。
  
LVGL has built-in support to several GPUs (see <code>lv_conf.h</code>) but if something else is required these functions can be used to make LVGL use a GPU:
+
* hor_res ディスプレイの水平解像度。(LV_HOR_RES_MAX、デフォルトはlv_conf.h).
 +
* ver_res ディスプレイの垂直解像度。(デフォルトは LV_VER_RES_MAX (lv_conf.h))。
 +
* color_chroma_key クロームキーの画像で透過的に描画される色。LV_COLOR_TRANSP (デフォルト:lv_conf.h)。
 +
* user_data ドライバのカスタムユーザーデータ。このタイプは、lv_conf.hで変更することができます。
 +
* アンチエイリアス アンチエイリアス(エッジスムージング)を使用する。LV_ANTIALIAS は lv_conf.h のデフォルトです。
 +
* rotatedとsw_rotate 以下の回転のセクションを参照してください。
 +
* screen_transp 1の場合、スクリーンは透明または不透明のスタイルを持つことができます。LV_COLOR_SCREEN_TRANSPは、lv_conf.hで有効にする必要があります。
 +
|-
 +
|To use a GPU the following callbacks can be used:
  
* <code>gpu_fill_cb</code> fill an area in the memory with a color.
+
* gpu_fill_cb fill an area in memory with colors.
* <code>gpu_wait_cb</code> 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.
+
* gpu_blend_cb blend two memory buffers using opacity.
 +
* gpu_wait_cb if any GPU function return, while the GPU is still working LVGL, will use this function when required the be sure GPU rendering is ready.
 +
|GPU を使用するために、以下コールバックが使用可能です。
  
 +
* gpu_fill_cb メモリ内の領域を色で塗りつぶします。
 +
* gpu_blend_cb 不透明度を使用して 2 つのメモリバッファをブレンドします。
 +
* gpu_wait_cb GPU がまだ LVGL を使用しているときに GPU 関数が返った場合、GPU レンダリングの準備ができたことを確認するために必要なときに、この関数を使用します。
 +
|-
 +
|Note that, these functions need to draw to the memory (RAM) and not your display directly.
 +
Some other optional callbacks to make easier and more optimal to work with monochrome, grayscale or other non-standard RGB displays:
 +
|これらの関数は、ディスプレイではなくメモリ(RAM)に直接描画する必要があることに注意してください。
  
 +
モノクロ、グレースケール、その他の非標準RGBディスプレイでの作業をより簡単に、より最適にするためのオプションのコールバックもあります。
 +
|-
 +
|
 +
* 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 ''display buffer''. It can be used to store the pixels more compactly if the display has a special color format. (e.g. 1-bit monochrome, 2-bit grayscale etc.) This way the buffers used in <code style="color: #bb0000;">lv_disp_buf_t</code> can be smaller to hold only the required number of bits for the given area size. <code style="color: #bb0000;">set_px_cb</code> is not working with <code style="color: #bb0000;">Two screen-sized buffers</code> display buffer configuration.
 +
* monitor_cb a callback function tells how many pixels were refreshed in how much time.
 +
* clean_dcache_cb a callback for cleaning any caches related to the display
 +
|
 +
* rounder_cb 再描画する領域の座標を丸める。例えば、2x2 px は 2x8 に変換される。これは、ディスプレイコントローラが特定の高さまたは幅の領域のみを更新できる場合に使用できます (通常、モノクロディスプレイの高さは 8 px です)。
 +
* set_px_cb 表示バッファを書き込むためのカスタム関数です。これは、ディスプレイが特殊な色形式である場合に、ピクセルをよりコンパクトに格納するために使用することができます。(set_px_cb は、2画面サイズのバッファを持つディスプレイバッファの構成では動作しません。
 +
* monitor_cb コールバック関数で、どれだけのピクセルがどれだけの時間でリフレッシュされたかを伝えます。
 +
* clean_dcache_cb ディスプレイに関連するあらゆるキャッシュをクリーニングするためのコールバックです。
 +
|-
 +
|To set the fields of ''lv_disp_drv_t'' variable it needs to be initialized with <code style="color: #bb0000;">lv_disp_drv_init(&disp_drv)</code>.
 +
And finally to register a display for LVGL <code style="color: #bb0000;">lv_disp_drv_register(&disp_drv)</code> needs to be called.
 +
|変数lv_disp_drv_tのフィールドを設定するには、lv_disp_drv_init(&disp_drv)で初期化する必要があります。
  
=== Examples ===
+
最後に、LVGLにディスプレイを登録するために、 lv_disp_drv_register(&disp_drv) を呼び出す必要があります。
 +
|-
 +
|
 
All together it looks like this:
 
All together it looks like this:
 +
<syntaxhighlight lang="C++" style="border: 1px dashed gray;">
 
  static lv_disp_drv_t disp_drv;          /*A variable to hold the drivers. Must be static or global.*/
 
  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*/
 
  lv_disp_drv_init(&disp_drv);            /*Basic initialization*/
  disp_drv.draw_buf = &disp_buf;          /*Set an initialized buffer*/
+
  disp_drv.buffer = &disp_buf;          /*Set an initialized buffer*/
 
  disp_drv.flush_cb = my_flush_cb;        /*Set a flush callback to draw to the display*/
 
  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;
 
  lv_disp_t * disp;
 
  disp = lv_disp_drv_register(&disp_drv); /*Register the driver and save the created display objects*/
 
  disp = lv_disp_drv_register(&disp_drv); /*Register the driver and save the created display objects*/
Here are some simple examples of the callbacks:
+
</syntaxhighlight>
 +
 
 +
|
 +
 
 +
 
 +
全体として、次のようになります。
 +
<syntaxhighlight lang="C++" style="border: 1px dashed gray;">
 +
static lv_disp_drv_t disp_drv;          /*ドライバーを保持する変数。静的またはグローバルである必要があります。*/
 +
lv_disp_drv_init(&disp_drv);            /*基本的な初期化*/
 +
disp_drv.buffer = &disp_buf;          /*初期化されたバッファを設定します*/
 +
disp_drv.flush_cb = my_flush_cb;        /*ディスプレイに描画するフラッシュコールバックを設定します*/
 +
lv_disp_t * disp;
 +
disp = lv_disp_drv_register(&disp_drv); /*ドライバーを登録し、作成した表示オ​​ブジェクトを保存します*/
 +
</syntaxhighlight>
 +
|-
 +
|Here are some simple examples of the callbacks:
 +
<syntaxhighlight lang="C++" style="border: 1px dashed gray;">
 
  void my_flush_cb(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p)
 
  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
+
     /*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;
 
     int32_t x, y;
 
     for(y = area->y1; y <= area->y2; y++) {
 
     for(y = area->y1; y <= area->y2; y++) {
154行目: 230行目:
 
  }
 
  }
 
   
 
   
  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);
+
  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*/
 
     /*It's an example code which should be done by your GPU*/
168行目: 245行目:
 
  }
 
  }
 
   
 
   
   
+
  void my_gpu_blend_cb(lv_disp_drv_t * disp_drv, lv_color_t * dest, const lv_color_t * src, uint32_t length, lv_opa_t opa)
 +
{
 +
    /*It's an example code which should be done by your GPU*/
 +
    uint32_t i;
 +
    for(i = 0; i < length; i++) {
 +
        dest[i] = lv_color_mix(dest[i], src[i], opa);
 +
    }
 +
}
 +
 
 
  void my_rounder_cb(lv_disp_drv_t * disp_drv, lv_area_t * area)
 
  void my_rounder_cb(lv_disp_drv_t * disp_drv, lv_area_t * area)
 
  {
 
  {
196行目: 281行目:
 
   SCB_CleanInvalidateDCache();
 
   SCB_CleanInvalidateDCache();
 
  }
 
  }
 +
</syntaxhighlight>
 +
|
 +
コールバックの簡単な例を次に示します。
 +
<syntaxhighlight lang="C++" style="border: 1px dashed gray;">
 +
  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_gpu_blend_cb(lv_disp_drv_t * disp_drv, lv_color_t * dest, const lv_color_t * src, uint32_t length, lv_opa_t opa)
 +
{
 +
    /*これはGPUで実行する必要があるサンプルコードです*/
 +
    uint32_t i;
 +
    for(i = 0; i < length; i++) {
 +
        dest[i] = lv_color_mix(dest[i], src[i], opa);
 +
    }
 +
}
 +
 
 +
  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 ();
 +
  }
 +
</syntaxhighlight>
 +
|}
 +
:[[App:Library:LVGL:docs:Porting#Display interface|戻る : Previous]]
  
== Rotation ==
+
== [https://docs.lvgl.io/latest/en/html/porting/display.html?highlight=lv_disp_buf_init#rotation Rotation] ==
LVGL supports rotation of the display in 90 degree increments. You can select whether you'd like software rotation or hardware rotation.
+
:{| class="wikitable"
 
 
If you select software rotation (<code>sw_rotate</code> 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 your <code>flush_cb</code> 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 <code>rotated</code> flag. The available options are <code>LV_DISP_ROT_NONE</code>, <code>LV_DISP_ROT_90</code>, <code>LV_DISP_ROT_180</code>, or <code>LV_DISP_ROT_270</code>. The rotation values are relative to how you would rotate the physical display in the clockwise direction. Thus, <code>LV_DISP_ROT_90</code> 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 <code>lv_disp_set_rotation(disp, rot)</code> 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.
 
 
 
== 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.
 
 
 
https://docs.lvgl.io/8.2/porting/display.html
 
__NOTOC__
 
{| class="wikitable"
 
 
!英文
 
!英文
 
!自動翻訳
 
!自動翻訳
 
|-
 
|-
|
+
|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 (<code style="color: #bb0000;">sw_rotate</code> 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 your <code style="color: #bb0000;">flush_cb</code> callback.
  
= Display interface =
 
To register a display for LVGL, a <code>lv_disp_draw_buf_t</code> and a <code>lv_disp_drv_t</code> variable have to be initialized.
 
  
* <code>lv_disp_draw_buf_t</code> contains internal graphic buffer(s) called draw buffer(s).
 
* <code>lv_disp_drv_t</code> contains callback functions to interact with the display and manipulate low level drawing behavior.
 
  
== Draw buffer ==
+
There is a noticeable amount of overhead to performing rotation in software, which is why hardware rotation is also available.  
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 <code>flush_cb</code> function set in the display driver (see below).
 
  
A draw buffer can be initialized via a <code>lv_disp_draw_buf_t</code> variable like this:
+
In this mode, LVGL draws into the buffer as though your screen now has the width and height inverted.  
<syntaxhighlight lang="C++" style="background-color: #eeffcc;">
 
/*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);
 
</syntaxhighlight>
 
Note that <code>lv_disp_draw_buf_t</code> 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.
+
You are responsible for rotating the provided pixels yourself.
 +
|LVGLは、90度刻みでのディスプレイの回転をサポートします。ソフトウェアローテーションまたはハードウェアローテーションのどちらを使用するかを選択できます。
 +
ソフトウェアローテーション(<code style="color: #bb0000;">sw_rotate</code>フラグを1に設定)を選択すると、LVGLがローテーションを実行します。ドライバーは、画面の幅と高さが変更されていないと想定できます。通常どおり、ピクセルをディスプレイにフラッシュするだけです。ソフトウェアローテーションでは、<code style="color: #bb0000;">flush_cb</code>コールバックに追加のロジックは必要ありません。
  
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.
 
  
== 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 ===
+
このモードでは、LVGLは、あたかも画面の幅と高さが反転しているようにバッファに描画します。
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.
 
  
=== 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.
+
|-
 +
|
 +
The default rotation of your display when it is initialized can be set using the <code style="color: #bb0000;">rotated</code> flag.
  
=== Full refresh ===
+
The available options are <code style="color: #bb0000;">LV_DISP_ROT_NONE</code>, <code style="color: #bb0000;">LV_DISP_ROT_90</code>, <code style="color: #bb0000;">LV_DISP_ROT_180</code>, or <code style="color: #bb0000;">LV_DISP_ROT_270</code>. The rotation values are relative to how you would rotate the physical display in the clockwise direction.  
In the display driver (<code>lv_disp_drv_t</code>) enabling the <code>full_refresh</code> bit will force LVGL to always redraw the whole screen. This works in both ''one buffer'' and ''two buffers'' modes. If <code>full_refresh</code> is enabled and two screen sized draw buffers are provided, LVGL's display handling works like "traditional" double buffering. This means the <code>flush_cb</code> callback only has to update the address of the framebuffer (<code>color_p</code> 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.
 
  
=== Direct mode ===
+
Thus, <code style="color: #bb0000;">LV_DISP_ROT_90</code> means you rotate the hardware 90 degrees clockwise, and the display rotates 90 degrees counterclockwise to compensate.
If the <code>direct_mode</code> 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 case <code>flush_cb</code> will be called only once when all dirty areas are redrawn. With <code>direct_mode</code> 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 in <code>flush_cb</code> like this:
 
  
# Display the frame buffer pointed by <code>color_p</code>
 
# Copy the redrawn areas from <code>color_p</code> to the other buffer.
 
  
The get the redrawn areas to copy use the following functions <code>_lv_refr_get_disp_refreshing()</code> returns the display being refreshed <code>disp->inv_areas[LV_INV_BUF_SIZE]</code> contains the invalidated areas <code>disp->inv_area_joined[LV_INV_BUF_SIZE]</code> if 1 that area was joined into another one and should be ignored <code>disp->inv_p</code> number of valid elements in <code>inv_areas</code>
+
(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 driver ==
 
Once the buffer initialization is ready a <code>lv_disp_drv_t</code> display driver needs to be:
 
  
# initialized with <code>lv_disp_drv_init(&disp_drv)</code>
+
Display rotation can also be changed at runtime using the <code style="color: #bb0000;">lv_disp_set_rotation(disp, rot)</code> API.
# its fields need to be set
 
# it needs to be registered in LVGL with <code>lv_disp_drv_register(&disp_drv)</code>
 
  
Note that <code>lv_disp_drv_t</code> also needs to be a static, global or dynamically allocated variable.
+
Support for software rotation is a new feature, so there may be some glitches/bugs depending on your configuration.  
  
=== Mandatory fields ===
+
If you encounter a problem please open an issue on GitHub.
In the most simple case only the following fields of <code>lv_disp_drv_t</code> need to be set:
+
|初期化時のディスプレイのデフォルトの回転は、<code style="color: #bb0000;">rotated</code>フラグを使用して設定できます。
  
* <code>draw_buf</code> pointer to an initialized <code>lv_disp_draw_buf_t</code> variable.
+
使用可能なオプションは、<code style="color: #bb0000;">LV_DISP_ROT_NONE</code><code style="color: #bb0000;">LV_DISP_ROT_90</code><code style="color: #bb0000;">LV_DISP_ROT_180</code><code style="color: #bb0000;">LV_DISP_ROT_270</code><code style="color: #bb0000;">LV_DISP_ROT_90</code>です。
* <code>hor_res</code> horizontal resolution of the display in pixels.
 
* <code>ver_res</code> vertical resolution of the display in pixels.
 
* <code>flush_cb</code> a callback function to copy a buffer's content to a specific area of the display. <code>lv_disp_flush_ready(&disp_drv)</code> needs to be called when flushing is ready. LVGL might render the screen in multiple chunks and therefore call <code>flush_cb</code> multiple times. To see if the current one is the last chunk of rendering use <code>lv_disp_flush_is_last(&disp_drv)</code>.
 
  
=== Optional fields ===
+
回転値は、物理ディスプレイを時計回りに回転させる方法を基準にしています。
There are some optional display driver data fields:
 
  
* <code>physical_hor_res</code> horizontal resolution of the full / physical display in pixels. Only set this when ''not'' using the full screen (defaults to -1 / same as <code>hor_res</code>).
+
つまり、ハードウェアを時計回りに90度回転させ、ディスプレイを反時計回りに90度回転させて補正することを意味します。   
* <code>physical_ver_res</code> vertical resolution of the full / physical display in pixels. Only set this when ''not'' using the full screen (defaults to -1 / same as <code>ver_res</code>).
 
* <code>offset_x</code> horizontal offset from the full / physical display in pixels. Only set this when ''not'' using the full screen (defaults to 0).
 
* <code>offset_y</code> vertical offset from the full / physical display in pixels. Only set this when ''not'' using the full screen (defaults to 0).
 
* <code>color_chroma_key</code> A color which will be drawn as transparent on chrome keyed images. Set to <code>LV_COLOR_CHROMA_KEY</code> from <code>lv_conf.h</code> by default.
 
* <code>anti_aliasing</code> use anti-aliasing (edge smoothing). Enabled by default if <code>LV_COLOR_DEPTH</code> is set to at least 16 in <code>lv_conf.h</code>.
 
* <code>rotated</code> and <code>sw_rotate</code> See the Rotation section below.
 
* <code>screen_transp</code> if <code>1</code> the screen itself can have transparency as well. <code>LV_COLOR_SCREEN_TRANSP</code> must be enabled in <code>lv_conf.h</code> and <code>LV_COLOR_DEPTH</code> must be 32.
 
* <code>user_data</code> A custom <code>void</code> user data for the driver.
 
* <code>full_refresh</code> always redrawn the whole screen (see above)
 
* <code>direct_mode</code> 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:
+
(7.10.0以前からアップグレードするユーザーへの注意:これらの新しい回転列挙値は、90度回転する古い0/1システムと一致するため、レガシーコードは引き続き期待どおりに機能するはずです。互換性のために、ソフトウェアの回転もデフォルトで無効になっています。)
  
* <code>rounder_cb</code> 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).
 
* <code>set_px_cb</code> 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 in <code>lv_disp_draw_buf_t</code> can be smaller to hold only the required number of bits for the given area size. Note that rendering with <code>set_px_cb</code> is slower than normal rendering.
 
* <code>monitor_cb</code> 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.
 
* <code>clean_dcache_cb</code> A callback for cleaning any caches related to the display.
 
  
LVGL has built-in support to several GPUs (see <code>lv_conf.h</code>) but if something else is required these functions can be used to make LVGL use a GPU:
+
ディスプレイの回転は、<code style="color: #bb0000;">lv_disp_set_rotation(disp, rot)</code>APIを使用して実行時に変更することもできます。
  
* <code>gpu_fill_cb</code> fill an area in the memory with a color.
 
* <code>gpu_wait_cb</code> 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.
 
  
 +
ソフトウェアローテーションのサポートは新機能であるため、構成によっては不具合やバグが発生する場合があります。
  
 +
問題が発生した場合は、GitHubで問題を開いてください。
 +
|}
 +
:[[App:Library:LVGL:docs:Porting#Display interface|戻る : Previous]]
  
=== Examples ===
 
All together it looks like this:
 
<syntaxhighlight lang="C++" style="background-color: #eeffcc;">
 
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*/
 
</syntaxhighlight>
 
Here are some simple examples of the callbacks:
 
<syntaxhighlight lang="C++" style="background-color: #eeffcc;">
 
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();
 
}
 
 
== 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 (<code>sw_rotate</code> 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 your <code>flush_cb</code> 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 <code>rotated</code> flag. The available options are <code>LV_DISP_ROT_NONE</code>, <code>LV_DISP_ROT_90</code>, <code>LV_DISP_ROT_180</code>, or <code>LV_DISP_ROT_270</code>. The rotation values are relative to how you would rotate the physical display in the clockwise direction. Thus, <code>LV_DISP_ROT_90</code> means you rotate the hardware 90 degrees clockwise, and the display rotates 90 degrees counterclockwise to compensate.
+
== [https://docs.lvgl.io/latest/en/html/porting/display.html?highlight=lv_disp_buf_init#api API] ==
  
(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 <code>lv_disp_set_rotation(disp, rot)</code> 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.
 
 
== 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.
 
 
== API ==
 
 
@description Display Driver HAL interface header file
 
@description Display Driver HAL interface header file
  
 
=== Typedefs ===
 
=== Typedefs ===
 +
:{| class="wikitable"
 +
!英文
 +
!自動翻訳
 +
|-
 +
|<span style="background-color: #e7f2fa; color: #2980b9;">typedef struct _lv_disp_drv_t</span> '''lv_disp_drv_t'''
 +
: Display Driver structure to be registered by HAL.
  
<span style="background-color: #e7f2fa; color: #2980b9;">typedef struct _lv_disp_draw_buf_t lv_disp_draw_buf_t</span>
+
<span style="background-color: #e7f2fa; color: #2980b9;">typedef struct _lv_disp_t</span> '''lv_disp_t'''
: Structure for holding display buffer information.
+
: Display structure.
 +
:<span style="background-color: #e7f2fa; color: #000000;">'''Note''' : <code style="color: #bb0000;">lv_disp_drv_t</code> should be the first member of the structure.</span>
 +
|
  
<span style="background-color: #e7f2fa; color: #2980b9;">typedef struct _lv_disp_drv_t lv_disp_drv_t</span>
+
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 <code style="color: #bb0000;">lv_disp_t</code> so it should be declared as <code style="color: #bb0000;">static lv_disp_drv_t my_drv</code> or allocated dynamically.
 
  
<span style="background-color: #e7f2fa; color: #2980b9;">typedef struct _lv_disp_t lv_disp_t</span>
+
: HALが登録するドライバ構造を表示します。
: Display structure. 
 
:<span style="background-color: #e7f2fa; color: #000000;">Note : <code style="color: #bb0000;">lv_disp_drv_t</code> should be the first member of the structure.</span>
 
  
=== Enums ===
+
typedef struct _lv_disp_t  '''lv_disp_t'''
  
<span style="background-color: #e7f2fa; color: #2980b9;">enum lv_disp_rot_t</span>
+
: 表示構造。
:: ''Values:''
+
: '''注''' <code style="color: #bb0000;">lv_disp_drv_t</code>は構造体の最初のメンバーである必要があります。
::: <span style="background-color: #eeeeee;">enumerator LV_DISP_ROT_NONE </span>
+
|}
::
+
:[[App:Library:LVGL:docs:Porting#Display interface|戻る : Previous]]
::: <span style="background-color: #eeeeee;">enumerator LV_DISP_ROT_90 </span>
 
::
 
::: <span style="background-color: #eeeeee;">enumerator LV_DISP_ROT_180</span>
 
::
 
::: <span style="background-color: #eeeeee;">enumerator LV_DISP_ROT_270</span>
 
  
 +
=== Enums ===
 +
<span style="background-color: #e7f2fa; color: #2980b9;">enum '''lv_disp_size_t'''</span>
 +
::''Values:''
 +
:::<span style="background-color: #eeeeee;">enumerator '''LV_DISP_SIZE_SMALL''' </span>
 +
:::<span style="background-color: #eeeeee;">enumerator '''LV_DISP_SIZE_MEDIUM'''</span>
 +
:::<span style="background-color: #eeeeee;">enumerator '''LV_DISP_SIZE_LARGE'''</span>
 +
:::<span style="background-color: #eeeeee;">enumerator '''LV_DISP_SIZE_EXTRA_LARGE'''</span>
  
 
=== Functions ===
 
=== Functions ===
 
+
:{| class="wikitable"
<span style="background-color: #e7f2fa; color: #2980b9;">void lv_disp_drv_init(lv_disp_drv_t *driver) </span>
+
!英文
 +
!自動翻訳
 +
|-
 +
|<span style="background-color: #e7f2fa; color: #2980b9;">void '''lv_disp_drv_init'''(lv_disp_drv_t *driver) </span>
 
: 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.
 
: 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:'''
 
:: '''Parameters:'''
 
::: '''driver''' -- pointer to driver variable to initialize
 
::: '''driver''' -- pointer to driver variable to initialize
  
<span style="background-color: #e7f2fa; color: #2980b9;">void lv_disp_draw_buf_init(lv_disp_draw_buf_t *draw_buf, void *buf1, void *buf2, uint32_t size_in_px_cnt) </span>
+
<span style="background-color: #e7f2fa; color: #2980b9;">void '''lv_disp_draw_buf_init'''(lv_disp_draw_buf_t *draw_buf, void *buf1, void *buf2, uint32_t size_in_px_cnt) </span>
  
 
: Initialize a display buffer
 
: Initialize a display buffer
486行目: 476行目:
 
::* '''size_in_px_cnt''' -- size of the <code style="color: #bb0000;">buf1</code> and <code style="color: #bb0000;">buf2</code> in pixel count.
 
::* '''size_in_px_cnt''' -- size of the <code style="color: #bb0000;">buf1</code> and <code style="color: #bb0000;">buf2</code> in pixel count.
  
<span style="background-color: #e7f2fa; color: #2980b9;">lv_disp_t *lv_disp_drv_register(lv_disp_drv_t *driver) </span>
+
<span style="background-color: #e7f2fa; color: #2980b9;"> lv_disp_t *'''lv_disp_drv_register'''(lv_disp_drv_t *driver) </span>
 
: Register an initialized display driver. Automatically set the first display as active.
 
: Register an initialized display driver. Automatically set the first display as active.
 
:: '''Parameters'''
 
:: '''Parameters'''
492行目: 482行目:
 
:: '''Returns'''
 
:: '''Returns'''
 
::: pointer to the new display or NULL on error
 
::: pointer to the new display or NULL on error
 +
|<span style="background-color:#e7f2fa;color:#2980b9;">void '''lv_disp_drv_init'''(lv_disp_drv_t * driver)</span>
 +
: デフォルト値でディスプレイドライバを初期化します。これは、フィールドに既知の値を持ち、メモリにジャンクではないために使用されます。その後、必要なフィールドのみを安全に設定できます。
 +
:: '''パラメーター:'''
 +
::: '''driver-初期化するドライバー'''変数へのポインター
  
<span style="background-color: #e7f2fa; color: #2980b9;">void lv_disp_drv_update(lv_disp_t *disp, lv_disp_drv_t *new_drv) </span>
+
<span style="background-color:#e7f2fa;color:#2980b9;">void '''lv_disp_draw_buf_init'''(lv_disp_draw_buf_t * draw_buf、void * buf1、void * buf2、uint32_t size_in_px_cnt)</span>
 +
 
 +
: 表示バッファを初期化します
 +
:: '''パラメーター'''
 +
::* '''draw_buf--'''初期化するポインタ<code style="color: #bb0000;">lv_disp_draw_buf_t</code>変数
 +
::* '''buf1-'''画像を描画するためにLVGLによって使用されるバッファー。常に指定する必要があり、NULLにすることはできません。ユーザーが割り当てた配列にすることができます。例:<code style="color: #bb0000;">static lv_color_t disp_buf1[1024 * 10]</code>または外部SRAMのメモリアドレス
 +
::* '''buf2-'''オプションで、画像のレンダリングと画像のフラッシュ(ディスプレイへの送信)を並行させるための2番目のバッファーを指定します。では、<code style="color: #bb0000;">disp_drv->flush</code>DMAまたは同様のハードウェアを使用して、画像をバックグラウンドのディスプレイに送信する必要があります。これにより、LVGLは、前のフレームが送信されている間、次のフレームを他のバッファーにレンダリングできます。<code style="color: #bb0000;">NULL</code>未使用の場合はに設定します。
 +
::* '''size_in_px_cnt-'''およびのサイズ<code style="color: #bb0000;">buf1</code>と<code style="color: #bb0000;">buf2</code>ピクセル数。
 +
 
 +
<span style="background-color:#e7f2fa;color:#2980b9;">lv_disp_t * '''lv_disp_drv_register'''(lv_disp_drv_t * driver)</span>
 +
 
 +
: 初期化されたディスプレイドライバを登録します。最初のディスプレイを自動的にアクティブに設定します。
 +
:: '''パラメーター'''
 +
::: '''driver-'''初期化された'lv_disp_drv_t'変数へのポインター。そのポインタだけが保存されます!
 +
:: '''戻り値'''
 +
::: 新しい表示へのポインタまたはエラーの場合はNULL
 +
|-
 +
|<span style="background-color: #e7f2fa; color: #2980b9;">void '''lv_disp_drv_update'''(lv_disp_t *disp, lv_disp_drv_t *new_drv) </span>
 
: Update the driver in run time.
 
: Update the driver in run time.
:: '''Parameters'''
+
::'''Parameters'''
::* '''disp''' -- pointer to a display. (return value of <code style="color: #bb0000;">lv_disp_drv_register</code>)
+
::*'''disp''' -- pointer to a display. (return value of <code style="color: #bb0000;">lv_disp_drv_register</code>)
::* '''new_drv''' -- pointer to the new driver
+
::*'''new_drv''' -- pointer to the new driver
  
<span style="background-color: #e7f2fa; color: #2980b9;">void lv_disp_remove(lv_disp_t *disp) </span>
+
<span style="background-color: #e7f2fa; color: #2980b9;">void '''lv_disp_remove'''(lv_disp_t *disp) </span>
 
: Remove a display
 
: Remove a display
:: '''Parameters'''
+
::'''Parameters'''
 
+
:::'''disp''' -- pointer to display
::: '''disp''' -- pointer to display
 
  
<span style="background-color: #e7f2fa; color: #2980b9;">void lv_disp_set_default(lv_disp_t *disp) </span>
+
<span style="background-color: #e7f2fa; color: #2980b9;">void '''lv_disp_set_default'''(lv_disp_t *disp) </span>
 
: Set a default display. The new screens will be created on it by default.
 
: Set a default display. The new screens will be created on it by default.
:: '''Parameters'''
+
::'''Parameters'''
::: '''disp''' -- pointer to a display
+
:::'''disp''' -- pointer to a display
  
<span style="background-color: #e7f2fa; color: #2980b9;">lv_disp_t *lv_disp_get_default(void) </span>
+
<span style="background-color: #e7f2fa; color: #2980b9;">lv_disp_t *'''lv_disp_get_default'''(void) </span>
 
: Get the default display
 
: Get the default display
:: '''Returns'''
+
::'''Returns'''
 
::: pointer to the default display
 
::: pointer to the default display
  
<span style="background-color: #e7f2fa; color: #2980b9;">lv_coord_t lv_disp_get_hor_res(lv_disp_t *disp) </span>
+
<span style="background-color: #e7f2fa; color: #2980b9;">lv_coord_t '''lv_disp_get_hor_res'''(lv_disp_t *disp) </span>
 
: Get the horizontal resolution of a display  
 
: Get the horizontal resolution of a display  
:: '''Parameters'''
+
::'''Parameters'''
::: '''disp''' -- pointer to a display (NULL to use the default display)
+
:::'''disp''' -- pointer to a display (NULL to use the default display)
:: '''Returns'''
+
::'''Returns'''
 
::: the horizontal resolution of the display
 
::: the horizontal resolution of the display
 +
|<span style="background-color:#e7f2fa;color:#2980b9;">void '''lv_disp_drv_update'''(lv_disp_t * disp、lv_disp_drv_t * new_drv)</span>
 +
: 実行時にドライバーを更新します。
 +
::'''パラメーター'''
 +
::*'''disp--'''ディスプレイへのポインタ。(の戻り値<code style="color: #bb0000;">lv_disp_drv_register</code>)
 +
::*'''new_drv--'''新しいドライバへのポインタ
 +
 +
<span style="background-color:#e7f2fa;color:#2980b9;">void '''lv_disp_remove'''(lv_disp_t * disp)</span>
 +
 +
: ディスプレイを取り外す
 +
::'''パラメーター'''
 +
:::'''disp--'''表示するポインタ
 +
 +
<span style="background-color:#e7f2fa;color:#2980b9;">void '''lv_disp_set_default'''(lv_disp_t * disp)</span>
 +
 +
: デフォルトの表示を設定します。デフォルトでは、新しい画面が作成されます。
 +
::'''パラメーター'''
 +
:::'''disp--'''ディスプレイへのポインタ
 +
 +
<span style="background-color:#e7f2fa;color:#2980b9;">lv_disp_t * '''lv_disp_get_default'''(void)</span>
  
<span style="background-color: #e7f2fa; color: #2980b9;">lv_coord_t lv_disp_get_ver_res(lv_disp_t *disp)</span>
+
: デフォルトの表示を取得する
 +
::'''戻り値'''
 +
::: デフォルト表示へのポインタ
 +
 
 +
<span style="background-color:#e7f2fa;color:#2980b9;">lv_coord_t '''lv_disp_get_hor_res'''(lv_disp_t * disp)</span>
 +
 
 +
: ディスプレイの水平解像度を取得する
 +
::'''パラメーター'''
 +
:::'''disp-'''ディスプレイへのポインタ(デフォルトのディスプレイを使用する場合はNULL)
 +
::'''戻り値'''
 +
::: ディスプレイの水平解像度
 +
|-
 +
|<span style="background-color: #e7f2fa; color: #2980b9;">lv_coord_t '''lv_disp_get_ver_res'''(lv_disp_t *disp)</span>
 
: Get the vertical resolution of a display
 
: Get the vertical resolution of a display
:: '''Parameters'''
+
::'''Parameters'''
::: '''disp''' -- pointer to a display (NULL to use the default display)
+
:::'''disp''' -- pointer to a display (NULL to use the default display)
:: '''Returns'''
+
::'''Returns'''
 
::: the vertical resolution of the display
 
::: the vertical resolution of the display
  
<span style="background-color: #e7f2fa; color: #2980b9;">lv_coord_t lv_disp_get_physical_hor_res(lv_disp_t *disp)</span>
+
<span style="background-color: #e7f2fa; color: #2980b9;">lv_coord_t '''lv_disp_get_physical_hor_res'''(lv_disp_t *disp)</span>
 
: Get the full / physical horizontal resolution of a display
 
: Get the full / physical horizontal resolution of a display
:: '''Parameters'''
+
::'''Parameters'''
::: '''disp''' -- pointer to a display (NULL to use the default display)
+
:::'''disp''' -- pointer to a display (NULL to use the default display)
:: '''Returns'''
+
::'''Returns'''
 
::: the full / physical horizontal resolution of the display
 
::: the full / physical horizontal resolution of the display
  
<span style="background-color: #e7f2fa; color: #2980b9;">lv_coord_t lv_disp_get_physical_ver_res(lv_disp_t *disp)</span>
+
<span style="background-color: #e7f2fa; color: #2980b9;">lv_coord_t '''lv_disp_get_physical_ver_res'''(lv_disp_t *disp)</span>
 
: Get the full / physical vertical resolution of a display
 
: Get the full / physical vertical resolution of a display
:: '''Parameters'''
+
::'''Parameters'''
::: '''disp''' -- pointer to a display (NULL to use the default display)
+
:::'''disp''' -- pointer to a display (NULL to use the default display)
:: '''Returns'''
+
::'''Returns'''
 
::: the full / physical vertical resolution of the display
 
::: the full / physical vertical resolution of the display
 +
|<span style="background-color:#e7f2fa;color:#2980b9;">lv_coord_t '''lv_disp_get_ver_res'''(lv_disp_t * disp)</span>
 +
: ディスプレイの垂直解像度を取得する
 +
::'''パラメーター'''
 +
:::'''disp-'''ディスプレイへのポインタ(デフォルトのディスプレイを使用する場合はNULL)
 +
::'''戻り値'''
 +
::: ディスプレイの垂直解像度
  
<span style="background-color: #e7f2fa; color: #2980b9;">lv_coord_t lv_disp_get_offset_x(lv_disp_t *disp) </span>
+
<span style="background-color:#e7f2fa;color:#2980b9;">lv_coord_t '''lv_disp_get_physical_hor_res'''(lv_disp_t * disp)</span>
 +
 
 +
: ディスプレイのフル/物理的な水平解像度を取得します
 +
::'''パラメーター'''
 +
:::'''disp-'''ディスプレイへのポインタ(デフォルトのディスプレイを使用する場合はNULL)
 +
::'''戻り値'''
 +
::: ディスプレイのフル/物理的な水平解像度
 +
 
 +
<span style="background-color:#e7f2fa;color:#2980b9;">lv_coord_t '''lv_disp_get_physical_ver_res'''(lv_disp_t * disp)</span>
 +
 
 +
: ディスプレイのフル/物理的な垂直解像度を取得します
 +
::'''パラメーター'''
 +
:::'''disp-'''ディスプレイへのポインタ(デフォルトのディスプレイを使用する場合はNULL)
 +
::'''戻り値'''
 +
::: ディスプレイのフル/物理的な垂直解像度
 +
|-
 +
|<span style="background-color: #e7f2fa; color: #2980b9;">lv_coord_t '''lv_disp_get_offset_x'''(lv_disp_t *disp) </span>
 
: Get the horizontal offset from the full / physical display
 
: Get the horizontal offset from the full / physical display
:: '''Parameters'''
+
::'''Parameters'''
::: '''disp''' -- pointer to a display (NULL to use the default display)
+
:::'''disp''' -- pointer to a display (NULL to use the default display)
:: '''Returns'''
+
::'''Returns'''
 
::: the horizontal offset from the full / physical display
 
::: the horizontal offset from the full / physical display
  
<span style="background-color: #e7f2fa; color: #2980b9;">lv_coord_t lv_disp_get_offset_y(lv_disp_t *disp) </span>
+
<span style="background-color: #e7f2fa; color: #2980b9;">lv_coord_t '''lv_disp_get_offset_y'''(lv_disp_t *disp) </span>
 
: Get the vertical offset from the full / physical display
 
: Get the vertical offset from the full / physical display
:: '''Parameters'''
+
::'''Parameters'''
::: '''disp''' -- pointer to a display (NULL to use the default display)
+
:::'''disp''' -- pointer to a display (NULL to use the default display)
:: '''Returns'''
+
::'''Returns'''
 
::: the horizontal offset from the full / physical display
 
::: the horizontal offset from the full / physical display
 +
|<span style="background-color:#e7f2fa;color:#2980b9;">lv_coord_t '''lv_disp_get_offset_x'''(lv_disp_t * disp)</span>
 +
: フル/物理ディスプレイから水平オフセットを取得します
 +
::'''パラメーター'''
 +
:::'''disp-'''ディスプレイへのポインタ(デフォルトのディスプレイを使用する場合はNULL)
 +
::'''戻り値'''
 +
::: フル/物理ディスプレイからの水平オフセット
 +
 +
<span style="background-color:#e7f2fa;color:#2980b9;">lv_coord_t '''lv_disp_get_offset_y'''(lv_disp_t * disp)</span>
  
<span style="background-color: #e7f2fa; color: #2980b9;">bool lv_disp_get_antialiasing(lv_disp_t *disp)</span>
+
: フル/物理ディスプレイから垂直オフセットを取得します
 +
::'''パラメーター'''
 +
:::'''disp-'''ディスプレイへのポインタ(デフォルトのディスプレイを使用する場合はNULL)
 +
::'''戻り値'''
 +
::: フル/物理ディスプレイからの水平オフセット
 +
|-
 +
|<span style="background-color: #e7f2fa; color: #2980b9;">bool '''lv_disp_get_antialiasing'''(lv_disp_t *disp)</span>
 
: Get if anti-aliasing is enabled for a display or not
 
: Get if anti-aliasing is enabled for a display or not
:: '''Parameters'''
+
::'''Parameters'''
::: '''disp''' -- pointer to a display (NULL to use the default display)
+
:::'''disp''' -- pointer to a display (NULL to use the default display)
:: '''Returns'''
+
::'''Returns'''
 
::: true: anti-aliasing is enabled: false: disabled
 
::: true: anti-aliasing is enabled: false: disabled
  
<span style="background-color: #e7f2fa; color: #2980b9;">lv_coord_t lv_disp_get_dpi(const lv_disp_t *disp) </span>
+
<span style="background-color: #e7f2fa; color: #2980b9;">lv_coord_t '''lv_disp_get_dpi'''(const lv_disp_t *disp) </span>
 
: Get the DPI of the display
 
: Get the DPI of the display
:: '''Parameters'''
+
::'''Parameters'''
::: '''disp''' -- pointer to a display (NULL to use the default display)
+
:::'''disp''' -- pointer to a display (NULL to use the default display)
:: '''Returns'''
+
::'''Returns'''
 
::: dpi of the display
 
::: dpi of the display
  
<span style="background-color: #e7f2fa; color: #2980b9;">void lv_disp_set_rotation(lv_disp_t *disp, lv_disp_rot_t rotation) </span>
+
<span style="background-color: #e7f2fa; color: #2980b9;">void '''lv_disp_set_rotation'''(lv_disp_t *disp, lv_disp_rot_t rotation) </span>
 
: Set the rotation of this display.
 
: Set the rotation of this display.
:: '''Parameters'''
+
::'''Parameters'''
::* '''disp''' -- pointer to a display (NULL to use the default display)
+
::*'''disp''' -- pointer to a display (NULL to use the default display)
::* '''rotation''' -- rotation angle
+
::*'''rotation''' -- rotation angle
 +
|<span style="background-color:#e7f2fa;color:#2980b9;">bool '''lv_disp_get_antialiasing'''(lv_disp_t * disp)</span>
 +
: ディスプレイに対してアンチエイリアシングが有効になっているかどうかを取得します
 +
::'''パラメーター'''
 +
:::'''disp-'''ディスプレイへのポインタ(デフォルトのディスプレイを使用する場合はNULL)
 +
::'''戻り値'''
 +
::: true:アンチエイリアシングが有効:false:無効
 +
 
 +
<span style="background-color:#e7f2fa;color:#2980b9;">lv_coord_t '''lv_disp_get_dpi'''(con​​st lv_disp_t * disp)</span>
 +
 
 +
: ディスプレイのDPIを取得する
 +
::'''パラメーター'''
 +
:::'''disp-'''ディスプレイへのポインタ(デフォルトのディスプレイを使用する場合はNULL)
 +
::'''戻り値'''
 +
::: ディスプレイのdpi
 +
 
 +
<span style="background-color:#e7f2fa;color:#2980b9;">void '''lv_disp_set_rotation'''(lv_disp_t * disp、lv_disp_rot_trotation)</span>
  
<span style="background-color: #e7f2fa; color: #2980b9;">lv_disp_rot_t lv_disp_get_rotation(lv_disp_t *disp) </span>
+
: このディスプレイの回転を設定します。
 +
::'''パラメーター'''
 +
::*'''disp-'''ディスプレイへのポインタ(デフォルトのディスプレイを使用する場合はNULL)
 +
::*'''回転'''-回転角
 +
|-
 +
|<span style="background-color: #e7f2fa; color: #2980b9;">lv_disp_rot_t '''lv_disp_get_rotation'''(lv_disp_t *disp) </span>
 
: Get the current rotation of this display.
 
: Get the current rotation of this display.
:: '''Parameters'''
+
::'''Parameters'''
::: '''disp''' -- pointer to a display (NULL to use the default display)
+
:::'''disp''' -- pointer to a display (NULL to use the default display)
:: '''Returns'''
+
::'''Returns'''
 
::: rotation angle
 
::: rotation angle
  
<span style="background-color: #e7f2fa; color: #2980b9;">lv_disp_t *lv_disp_get_next(lv_disp_t *disp) </span>
+
<span style="background-color: #e7f2fa; color: #2980b9;">lv_disp_t *'''lv_disp_get_next'''(lv_disp_t *disp) </span>
 
: Get the next display.
 
: Get the next display.
:: '''Parameters'''
+
::'''Parameters'''
::: '''disp''' -- pointer to the current display. NULL to initialize.
+
:::'''disp''' -- pointer to the current display. NULL to initialize.
:: '''Returns'''
+
::'''Returns'''
 
::: the next display or NULL if no more. Give the first display when the parameter is NULL
 
::: the next display or NULL if no more. Give the first display when the parameter is NULL
 
:  
 
:  
<span style="background-color: #e7f2fa; color: #2980b9;">lv_disp_draw_buf_t *lv_disp_get_draw_buf(lv_disp_t *disp) </span>
+
<span style="background-color: #e7f2fa; color: #2980b9;">lv_disp_draw_buf_t *'''lv_disp_get_draw_buf'''(lv_disp_t *disp) </span>
 
: Get the internal buffer of a display
 
: Get the internal buffer of a display
:: '''Parameters'''
+
::'''Parameters'''
::: '''disp''' -- pointer to a display
+
:::'''disp''' -- pointer to a display
:: '''Returns'''
+
::'''Returns'''
 
::: pointer to the internal buffers
 
::: pointer to the internal buffers
 +
|<span style="background-color:#e7f2fa;color:#2980b9;">lv_disp_rot_t '''lv_disp_get_rotation'''(lv_disp_t * disp)</span>
 +
: このディスプレイの現在の回転を取得します。
 +
::'''パラメーター'''
 +
:::'''disp-'''ディスプレイへのポインタ(デフォルトのディスプレイを使用する場合はNULL)
 +
::'''戻り値'''
 +
::: 回転角度
 +
 +
<span style="background-color:#e7f2fa;color:#2980b9;">lv_disp_t * '''lv_disp_get_next'''(lv_disp_t * disp)</span>
 +
 +
: 次の表示を取得します。
 +
::'''パラメーター'''
 +
:::'''disp--'''現在の表示へのポインタ。初期化するにはNULL。
 +
::'''戻り値'''
 +
::: 次の表示、またはそれ以上ない場合はNULL。パラメータがNULLの場合に最初の表示を行います
 +
:
  
<span style="background-color: #e7f2fa; color: #2980b9;">void lv_disp_drv_use_generic_set_px_cb(lv_disp_drv_t *disp_drv, lv_img_cf_t cf)</span>
+
<span style="background-color:#e7f2fa;color:#2980b9;">lv_disp_draw_buf_t * '''lv_disp_get_draw_buf'''(lv_disp_t * disp)</span>
  
<span style="background-color: #e7f2fa; color: #2980b9;">struct _lv_disp_draw_buf_t</span>
+
: ディスプレイの内部バッファを取得する
: ''#include <lv_hal_disp.h>'' Structure for holding display buffer information.  
+
::'''パラメーター'''
: '''Public Members'''
+
:::'''disp--'''ディスプレイへのポインタ
:: <span style="background-color: #eeeeee;">void *buf1</span>
+
::'''戻り値'''
 +
::: 内部バッファへのポインタ
 +
 
 +
::
 +
|-
 +
|<span style="background-color: #e7f2fa; color: #2980b9;">void '''lv_disp_drv_use_generic_set_px_cb'''(lv_disp_drv_t *disp_drv, lv_img_cf_t cf)</span><span style="background-color: #e7f2fa; color: #2980b9;">struct _lv_disp_draw_buf_t</span>
 +
:''#include <lv_hal_disp.h>'' Structure for holding display buffer information.
 +
:'''Public Members'''
 +
::<span style="background-color: #eeeeee;">void *'''buf1'''</span>
 
::: First display buffer.
 
::: First display buffer.
:: <span style="background-color: #eeeeee;">void *buf2</span>
+
::<span style="background-color: #eeeeee;">void *'''buf2'''</span>
 
::: Second display buffer.
 
::: Second display buffer.
:: <span style="background-color: #eeeeee;">void *buf_act</span>
+
::<span style="background-color: #eeeeee;">void * '''buf_act'''</span>
:
+
::<span style="background-color: #eeeeee;">uint32_t '''size'''</span>
:: <span style="background-color: #eeeeee;">uint32_t size</span>
+
::<span style="background-color: #eeeeee;">lv_area_t '''area'''</span>
:  
+
::<span style="background-color: #eeeeee;">int '''flushing'''</span>
:: <span style="background-color: #eeeeee;">int flushing</span>
+
::<span style="background-color: #eeeeee;">int '''flashing_last'''</span>
:
+
::<span style="background-color: #eeeeee;">uint32_t '''last_area'''</span>
:: <span style="background-color: #eeeeee;">int flushing_last</span>
+
::<span style="background-color: #eeeeee;">uint32_t '''last_part'''</span>
:
+
|<span style="background-color:#e7f2fa;color:#2980b9;">void '''lv_disp_drv_use_generic_set_px_cb'''(lv_disp_drv_t * disp_drv、lv_img_cf_t cf)</span>
:: <span style="background-color: #eeeeee;">uint32_t last_area</span>
+
 
:
+
<span style="background-color:#e7f2fa;color:#2980b9;">struct '''lv_disp_draw_buf_t'''</span>
:: <span style="background-color: #eeeeee;">uint32_t last_part</span>
 
  
<span style="background-color: #e7f2fa; color: #2980b9;">struct _lv_disp_drv_t </span>
+
:''#include<lv_hal_disp.h>''ディスプレイバッファ情報を保持するための構造。
: ''#include <lv_hal_disp.h>'' Display Driver structure to be registered by HAL. Only its pointer will be saved in <code style="color: #bb0000;">lv_disp_t</code> so it should be declared as <code style="color: #bb0000;">static lv_disp_drv_t my_drv</code> or allocated dynamically.
+
:'''パブリックメンバー'''
: '''Public Members'''
+
::<span style="background-color: #eeeeee;">void * '''buf1'''</span>
: <span style="background-color: #eeeeee;">lv_coord_t hor_res</span>
+
::: 最初の表示バッファ。
 +
::<span style="background-color: #eeeeee;">void * '''buf2'''</span>
 +
::: 2番目の表示バッファ。
 +
::<span style="background-color: #eeeeee;">void * '''buf_act'''</span>
 +
::<span style="background-color: #eeeeee;">uint32_t '''size'''
 +
::<span style="background-color: #eeeeee;">lv_area_t '''area'''
 +
::<span style="background-color: #eeeeee;">int '''flushing'''</span>
 +
::<span style="background-color: #eeeeee;">int '''flashing_last'''</span>
 +
::<span style="background-color: #eeeeee;">uint32_t '''last_area'''</span>
 +
::<span style="background-color: #eeeeee;">uint32_t '''last_part'''</span>
 +
|-
 +
|<span style="background-color: #e7f2fa; color: #2980b9;">struct _lv_disp_drv_t </span>
 +
:''#include <lv_hal_disp.h>'' Display Driver structure to be registered by HAL. Only its pointer will be saved in <code style="color: #bb0000;">lv_disp_t</code> so it should be declared as <code style="color: #bb0000;">static lv_disp_drv_t my_drv</code> or allocated dynamically.
 +
:'''Public Members'''
 +
:<span style="background-color: #eeeeee;">lv_coord_t '''hor_res'''</span>
 
:: Horizontal resolution.
 
:: Horizontal resolution.
: <span style="background-color: #eeeeee;">lv_coord_t ver_res</span>
+
:<span style="background-color: #eeeeee;">lv_coord_t '''ver_res'''</span>
 
:: Vertical resolution.
 
:: Vertical resolution.
: <span style="background-color: #eeeeee;">lv_coord_t physical_hor_res</span>
+
:<span style="background-color: #eeeeee;">lv_coord_t '''hysical_hor_res'''</span>
 
:: Horizontal resolution of the full / physical display. Set to -1 for fullscreen mode.
 
:: Horizontal resolution of the full / physical display. Set to -1 for fullscreen mode.
: <span style="background-color: #eeeeee;">lv_coord_t physical_ver_res</span>
+
:<span style="background-color: #eeeeee;">lv_coord_t '''physical_ver_res'''</span>
 
:: Vertical resolution of the full / physical display. Set to -1 for fullscreen mode.
 
:: Vertical resolution of the full / physical display. Set to -1 for fullscreen mode.
: <span style="background-color: #eeeeee;">lv_coord_t offset_x</span>
+
:<span style="background-color: #eeeeee;">lv_coord_t '''offset_x'''</span>
 
:: Horizontal offset from the full / physical display. Set to 0 for fullscreen mode.
 
:: Horizontal offset from the full / physical display. Set to 0 for fullscreen mode.
: <span style="background-color: #eeeeee;">lv_coord_t offset_y</span>
+
:<span style="background-color: #eeeeee;">lv_coord_t '''offset_y'''</span>
 
:: Vertical offset from the full / physical display. Set to 0 for fullscreen mode.
 
:: Vertical offset from the full / physical display. Set to 0 for fullscreen mode.
: <span style="background-color: #eeeeee;">lv_disp_draw_buf_t *draw_buf</span>
+
:<span style="background-color: #eeeeee;">[https://docs.lvgl.io/8.2/porting/display.html#_CPPv418lv_disp_draw_buf_t '''lv_disp_draw_buf_t'''] *'''draw_buf'''</span>
:: Pointer to a buffer initialized with <code style="color: #0000bb;">lv_disp_draw_buf_init()</code>. LVGL will use this buffer(s) to draw the screens contents
+
:: Pointer to a buffer initialized with <code style="color: #0000bb;">[https://docs.lvgl.io/8.2/porting/display.html#lv__hal__disp_8h_1a06fe2e658c41b550e6ede53f1a267a0a '''lv_disp_draw_buf_init()''']</code>. LVGL will use this buffer(s) to draw the screens contents
: <span style="background-color: #eeeeee;">uint32_t direct_mode</span>
+
:<span style="background-color: #eeeeee;">uint32_t '''direct_mode'''</span>
 
:: 1: Use screen-sized buffers and draw to absolute coordinates
 
:: 1: Use screen-sized buffers and draw to absolute coordinates
: <span style="background-color: #eeeeee;">uint32_t full_refresh</span>
+
:<span style="background-color: #eeeeee;">uint32_t '''full_refresh'''</span>
 
:: 1: Always make the whole screen redrawn
 
:: 1: Always make the whole screen redrawn
: <span style="background-color: #eeeeee;">uint32_t sw_rotate</span>
+
:<span style="background-color: #eeeeee;">uint32_t '''sw_rotate'''</span>
 
:: 1: use software rotation (slower)
 
:: 1: use software rotation (slower)
: <span style="background-color: #eeeeee;">uint32_t antialiasing</span>
+
:<span style="background-color: #eeeeee;">uint32_t '''antialiasing'''</span>
 
:: 1: anti-aliasing is enabled on this display.
 
:: 1: anti-aliasing is enabled on this display.
: <span style="background-color: #eeeeee;">uint32_t rotated</span>
+
:<span style="background-color: #eeeeee;">uint32_t '''rotated'''</span>
:: 1: turn the display by 90 degree.
+
:: 1: turn the display by 90 degree.
::<span style="background-color: #ffedcc;">Warning:  Does not update coordinates for you!</span>
+
::<span style="background-color: #ffedcc;">'''Warning''':  Does not update coordinates for you!</span>
: <span style="background-color: #eeeeee;">uint32_t screen_transp</span>
+
:<span style="background-color: #eeeeee;">uint32_t '''screen_transp'''</span>
 
:
 
:
: <span style="background-color: #eeeeee;">uint32_t dpi</span>
+
:<span style="background-color: #eeeeee;">uint32_t '''dpi'''</span>
 
:: Handle if the screen doesn't have a solid (opa == LV_OPA_COVER) background. Use only if required because it's slower.
 
:: Handle if the screen doesn't have a solid (opa == LV_OPA_COVER) background. Use only if required because it's slower.
: <span style="background-color: #eeeeee;">void (*flush_cb)(struct _lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_color_t *color_p)</span>
+
:<span style="background-color: #eeeeee;">void (*flush_cb)(struct _[https://docs.lvgl.io/8.2/porting/display.html#_CPPv414_lv_disp_drv_t '''lv_disp_drv_t'''] *disp_drv, const lv_area_t *area, lv_color_t *color_p)</span>
 
:: DPI (dot per inch) of the display. Default value is <code style="color: #bb0000;">LV_DPI_DEF</code>. 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 <code style="color: #bb0000;">LV_DPI_DEF</code>. MANDATORY: Write the internal buffer (draw_buf) to the display. 'lv_disp_flush_ready()' has to be called when finished
: <span style="background-color: #eeeeee;">void (*rounder_cb)(struct _lv_disp_drv_t *disp_drv, lv_area_t *area)</span>
+
:<span style="background-color: #eeeeee;">void (*rounder_cb)(struct _[https://docs.lvgl.io/8.2/porting/display.html#_CPPv414_lv_disp_drv_t '''lv_disp_drv_t'''] *disp_drv, lv_area_t *area)</span>
 
:: OPTIONAL: Extend the invalidated areas to match with the display drivers requirements E.g. round <code style="color: #bb0000;">y</code> to, 8, 16 ..) on a monochrome display
 
:: OPTIONAL: Extend the invalidated areas to match with the display drivers requirements E.g. round <code style="color: #bb0000;">y</code> to, 8, 16 ..) on a monochrome display
: <span style="background-color: #eeeeee;">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)</span>
+
:<span style="background-color: #eeeeee;">void (*set_px_cb)(struct _[https://docs.lvgl.io/8.2/porting/display.html#_CPPv414_lv_disp_drv_t '''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)</span>
:: 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
+
:: 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
:: <span style="background-color: #e7f2fa;">Note:  Much slower then drawing with supported color formats.</span>
+
::<span style="background-color: #e7f2fa;">'''Note''':  Much slower then drawing with supported color formats.</span>
: <span style="background-color: #eeeeee;">void (*clear_cb)(struct _lv_disp_drv_t *disp_drv, uint8_t *buf, uint32_t size)</span>
+
:<span style="background-color: #eeeeee;">void (*clear_cb)(struct _[https://docs.lvgl.io/8.2/porting/display.html#_CPPv414_lv_disp_drv_t '''lv_disp_drv_t'''] *disp_drv, uint8_t *buf, uint32_t size)</span>
 
::
 
::
: <span style="background-color: #eeeeee;">void (*monitor_cb)(struct _lv_disp_drv_t *disp_drv, uint32_t time, uint32_t px)</span>
+
:<span style="background-color: #eeeeee;">void (*monitor_cb)(struct _[https://docs.lvgl.io/8.2/porting/display.html#_CPPv414_lv_disp_drv_t '''lv_disp_drv_t'''] *disp_drv, uint32_t time, uint32_t px)</span>
 
:: OPTIONAL: Called after every refresh cycle to tell the rendering and flushing time + the number of flushed pixels
 
:: OPTIONAL: Called after every refresh cycle to tell the rendering and flushing time + the number of flushed pixels
: <span style="background-color: #eeeeee;">void (*wait_cb)(struct _lv_disp_drv_t *disp_drv)</span>
+
:<span style="background-color: #eeeeee;">void (*wait_cb)(struct _[https://docs.lvgl.io/8.2/porting/display.html#_CPPv414_lv_disp_drv_t '''lv_disp_drv_t'''] *disp_drv)</span>
 
:: 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
 
:: 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
: <span style="background-color: #eeeeee;">void (*clean_dcache_cb)(struct _lv_disp_drv_t *disp_drv)</span>
+
:<span style="background-color: #eeeeee;">void (*clean_dcache_cb)(struct _[https://docs.lvgl.io/8.2/porting/display.html#_CPPv414_lv_disp_drv_t '''lv_disp_drv_t'''] *disp_drv)</span>
 
:: OPTIONAL: Called when lvgl needs any CPU cache that affects rendering to be cleaned
 
:: OPTIONAL: Called when lvgl needs any CPU cache that affects rendering to be cleaned
: <span style="background-color: #eeeeee;">void (*drv_update_cb)(struct _lv_disp_drv_t *disp_drv)</span>
+
:<span style="background-color: #eeeeee;">void (*drv_update_cb)(struct _[https://docs.lvgl.io/8.2/porting/display.html#_CPPv414_lv_disp_drv_t '''lv_disp_drv_t'''] *disp_drv)</span>
 
:: OPTIONAL: called when driver parameters are updated
 
:: OPTIONAL: called when driver parameters are updated
: <span style="background-color: #eeeeee;">lv_color_t color_chroma_key</span>
+
:<span style="background-color: #eeeeee;">lv_color_t '''color_chroma_key'''</span>
:: On CHROMA_KEYED images this color will be transparent. <code style="color: #bb0000;">LV_COLOR_CHROMA_KEY</code> by default. (lv_conf.h)
+
:: On CHROMA_KEYED images this color will be transparent. <code style="color: #bb0000;">LV_COLOR_TRANSP</code> by default. (lv_conf.h)
: <span style="background-color: #eeeeee;">lv_draw_ctx_t *draw_ctx</span>
+
:<span style="background-color: #eeeeee;">lv_draw_ctx_t *'''draw_ctx'''</span>
 
::
 
::
: <span style="background-color: #eeeeee;">void (*draw_ctx_init)(struct _lv_disp_drv_t *disp_drv, lv_draw_ctx_t *draw_ctx)</span>
+
:<span style="background-color: #eeeeee;">void (*draw_ctx_init)(struct _[https://docs.lvgl.io/8.2/porting/display.html#_CPPv414_lv_disp_drv_t '''lv_disp_drv_t'''] *disp_drv, lv_draw_ctx_t *draw_ctx)</span>
 
::
 
::
: <span style="background-color: #eeeeee;">void (*draw_ctx_deinit)(struct _lv_disp_drv_t *disp_drv, lv_draw_ctx_t *draw_ctx)</span>
+
:<span style="background-color: #eeeeee;">void (*draw_ctx_deinit)(struct _[https://docs.lvgl.io/8.2/porting/display.html#_CPPv414_lv_disp_drv_t '''lv_disp_drv_t'''] *disp_drv, lv_draw_ctx_t *draw_ctx)</span>
 
::
 
::
: <span style="background-color: #eeeeee;">size_t draw_ctx_size</span>
+
:<span style="background-color: #eeeeee;">size_t '''draw_ctx_size'''</span>
 
::
 
::
: <span style="background-color: #eeeeee;">void *user_data</span>
+
:<span style="background-color: #eeeeee;">void *'''user_data'''</span>
 
:: Custom display driver user data
 
:: Custom display driver user data
 
+
|<span style="background-color:#e7f2fa;color:#2980b9;">struct '''_lv_disp_drv_t'''</span>
<span style="background-color: #e7f2fa; color: #2980b9;">struct _lv_disp_t </span>
+
:''#include<lv_hal_disp.h>'' HALによって登録されるドライバー構造を表示します。そのポインタのみが保存される<code style="color: #bb0000;">lv_disp_t</code>ため、動的に宣言<code style="color: #bb0000;">static lv_disp_drv_t my_drv</code>または割り当てる必要があります。
: ''#include <lv_'hal_disp.h>'' Display structure. Note  <code style="color: #bb0000;">lv_disp_drv_t</code> should be the first member of the structure.   
+
:'''パブリックメンバー'''
: '''Public Members'''
+
:<span style="background-color: #eeeeee;">lv_coord_t '''hor_res'''</span>
:: struct _lv_disp_drv_t *driver
+
:: 水平解像度。
 +
:<span style="background-color: #eeeeee;">lv_coord_t '''ver_res'''</span>
 +
:: 垂直解像度。
 +
:<span style="background-color: #eeeeee;">lv_coord_t '''physical_hor_res'''</span>
 +
:: フル/物理ディスプレイの水平解像度。フルスクリーンモードの場合は-1に設定します。
 +
:<span style="background-color: #eeeeee;">lv_coord_t '''physical_ver_res'''</span>
 +
:: フル/物理ディスプレイの垂直解像度。フルスクリーンモードの場合は-1に設定します。
 +
:<span style="background-color: #eeeeee;">lv_coord_t '''offset_x'''</span>
 +
:: フル/物理ディスプレイからの水平オフセット。フルスクリーンモードの場合は0に設定します。
 +
:<span style="background-color: #eeeeee;">lv_coord_t '''offset_y'''</span>
 +
:: フル/物理ディスプレイからの垂直オフセット。フルスクリーンモードの場合は0に設定します。
 +
:<span style="background-color: #eeeeee;">[https://docs.lvgl.io/8.2/porting/display.html#_CPPv418lv_disp_draw_buf_t lv_disp_draw_buf_t] * '''draw_buf'''</span>
 +
:: で初期化されたバッファへのポインタ '''[https://docs.lvgl.io/8.2/porting/display.html#lv__hal__disp_8h_1a06fe2e658c41b550e6ede53f1a267a0a lv_disp_draw_buf_init()]'''。LVGLは、このバッファーを使用して画面の内容を描画します
 +
:<span style="background-color: #eeeeee;">uint32_t '''direct_mode'''</span>
 +
:: 1:画面サイズのバッファを使用し、絶対座標に描画します
 +
:<span style="background-color: #eeeeee;">uint32_t '''full_refresh'''</span>
 +
:: 1:常に画面全体を再描画する
 +
:<span style="background-color: #eeeeee;">uint32_t '''sw_rotate'''</span>
 +
:: 1:ソフトウェアローテーションを使用する(遅い)
 +
:<span style="background-color: #eeeeee;">uint32_t '''antialiasing''''</span>
 +
:: 1:このディスプレイでアンチエイリアシングが有効になっています。
 +
:<span style="background-color: #eeeeee;">uint32_t '''rotated'''</span>
 +
:: 1:ディスプレイを90度回転させます。
 +
::<span style="background-color: #ffedcc;">'''警告''':座標は更新されません!</span>
 +
:<span style="background-color: #eeeeee;">uint32_t '''screen_transp'''</span>
 +
:
 +
:<span style="background-color: #eeeeee;">uint32_t '''dpi'''</span>
 +
:: 画面に無地(opa == LV_OPA_COVER)の背景がない場合に処理します。速度が遅いため、必要な場合にのみ使用してください。
 +
:<span style="background-color: #eeeeee;">void(* flush_cb)(struct _ '''lv_disp_drv_t''' * disp_drv、const lv_area_t * area、lv_color_t * color_p)</span>
 +
:: ディスプレイのDPI(ドット/インチ)。デフォルト値は<code style="color: #bb0000;">LV_DPI_DEF</code>です。必須:内部バッファー(draw_buf)をディスプレイに書き込みます。終了時に「lv_disp_flush_ready()」を呼び出す必要があります
 +
:<span style="background-color: #eeeeee;">void(* rounder_cb)(struct _ '''lv_disp_drv_t''' * disp_drv、lv_area_t * area)</span>
 +
:: LVGLの表示を登録するには、a<code style="color: #bb0000;">y</code>オプション:無効化された領域を拡張して、モノクロディスプレイのディスプレイドライバの要件に一致させます。たとえば、8、16 ..)に丸めます。
 +
:<span style="background-color: #eeeeee;">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)</span>
 +
:: オプション:ディスプレイの特別な要件に従って、バッファにピクセルを設定します。LittelvGLでサポートされていないカラーフォーマットに使用できます。例:2ビット->4グレースケール
 +
::'''注''':サポートされているカラー形式で描画するよりもはるかに遅くなります。
 +
:<span style="background-color: #eeeeee;">void(* clear_cb)(struct _ '''lv_disp_drv_t''' * disp_drv、uint8_t * buf、uint32_t size)</span>
 +
::
 +
:<span style="background-color: #eeeeee;">void(* monitor_cb)(struct _ '''lv_disp_drv_t''' * disp_drv、uint32_t time、uint32_t px)</span>
 +
:: オプション:更新サイクルごとに呼び出され、レンダリングとフラッシュの時間+フラッシュされたピクセルの数を通知します
 +
:<span style="background-color: #eeeeee;">void(* wait_cb)(struct _ '''lv_disp_drv_t''' * disp_drv)</span>
 +
:: オプション:lvglが操作の完了を待機している間、定期的に呼び出されます。たとえば、フラッシングまたはGPUユーザーは、ここで非常に単純なタスクを実行したり、タスクを生成したりできます
 +
:<span style="background-color: #eeeeee;">void(* clean_dcache_cb)(struct _ '''lv_disp_drv_t''' * disp_drv)</span>
 +
:: オプション:lvglがレンダリングに影響を与えるCPUキャッシュをクリーンアップする必要がある場合に呼び出されます
 +
:<span style="background-color: #eeeeee;">void(* drv_update_cb)(struct _ '''lv_disp_drv_t''' * disp_drv)</span>
 +
:: オプション:ドライバーパラメーターが更新されたときに呼び出されます
 +
:<span style="background-color: #eeeeee;">lv_color_t color_chroma_key</span>
 +
:: CHROMA_KEYED画像では、この色は透明になります。デフォルトは<code style="color: #bb0000;">LV_COLOR_TRANSP</code>。(lv_conf.h)
 +
:<span style="background-color: #eeeeee;">lv_draw_ctx_t * draw_ctx</span>
 +
::
 +
:<span style="background-color: #eeeeee;">void(* draw_ctx_init)(struct _ '''lv_disp_drv_t''' * disp_drv、lv_draw_ctx_t * draw_ctx)</span>
 +
::
 +
:<span style="background-color: #eeeeee;">void(* draw_ctx_deinit)(struct _ '''lv_disp_drv_t''' * disp_drv、lv_draw_ctx_t * draw_ctx)</span>
 +
::
 +
:<span style="background-color: #eeeeee;">size_t '''draw_ctx_size'''</span>
 +
::
 +
:<span style="background-color: #eeeeee;">void * '''user_data'''</span>
 +
:: カスタムディスプレイドライバーのユーザーデータ
 +
|-
 +
|
 +
<span style="background-color: #e7f2fa; color: #2980b9;">struct '''_lv_disp_t''' </span>
 +
:''#include <lv_'hal_disp.h>'' Display structure.
 +
:<span style="background-color: #e7f2fa; color: #2980b9;">Note  <code style="color: #bb0000;">lv_disp_drv_t</code> should be the first member of the structure.  </span>
 +
:'''Public Members'''
 +
:: struct _[https://docs.lvgl.io/8.2/porting/display.html#_CPPv414_lv_disp_drv_t '''lv_disp_drv_t'''] *driver
 
:: < Driver to the display A timer which periodically checks the dirty areas and refreshes them
 
:: < Driver to the display A timer which periodically checks the dirty areas and refreshes them
: <span style="background-color: #eeeeee;">lv_timer_t *refr_timer</span>
+
:<span style="background-color: #eeeeee;">[https://docs.lvgl.io/8.2/overview/timer.html#_CPPv410lv_timer_t '''lv_timer_t'''] *refr_timer</span>
 
:: The theme assigned to the screen
 
:: The theme assigned to the screen
: <span style="background-color: #eeeeee;">struct _lv_theme_t *theme</span>
+
:<span style="background-color: #eeeeee;">struct _[https://docs.lvgl.io/8.2/overview/style.html#_CPPv411_lv_theme_t '''lv_theme_t'''] *theme</span>
 
::
 
::
: <span style="background-color: #eeeeee;">struct _lv_obj_t **screens</span>
+
:<span style="background-color: #eeeeee;">struct _[https://docs.lvgl.io/8.2/widgets/obj.html#_CPPv49_lv_obj_t '''lv_obj_t'''] **screens</span>
 
:: Screens of the display Array of screen objects.
 
:: Screens of the display Array of screen objects.
: <span style="background-color: #eeeeee;">struct _lv_obj_t *act_scr</span>
+
:<span style="background-color: #eeeeee;">struct _[https://docs.lvgl.io/8.2/widgets/obj.html#_CPPv49_lv_obj_t '''lv_obj_t'''] *act_scr</span>
 
:: Currently active screen on this display
 
:: Currently active screen on this display
: <span style="background-color: #eeeeee;">struct _lv_obj_t *prev_scr</span>
+
:<span style="background-color: #eeeeee;">struct _[https://docs.lvgl.io/8.2/widgets/obj.html#_CPPv49_lv_obj_t '''lv_obj_t'''] *prev_scr</span>
 
:: Previous screen. Used during screen animations
 
:: Previous screen. Used during screen animations
: <span style="background-color: #eeeeee;">struct _lv_obj_t *scr_to_load</span>
+
:<span style="background-color: #eeeeee;">struct _[https://docs.lvgl.io/8.2/widgets/obj.html#_CPPv49_lv_obj_t '''lv_obj_t'''] *scr_to_load</span>
 
:: The screen prepared to load in lv_scr_load_anim
 
:: The screen prepared to load in lv_scr_load_anim
: <span style="background-color: #eeeeee;">struct _lv_obj_t *top_layer </span>
+
:<span style="background-color: #eeeeee;">struct _[https://docs.lvgl.io/8.2/widgets/obj.html#_CPPv49_lv_obj_t '''lv_obj_t'''] *top_layer </span>
 
::: See
 
::: See
::: lv_disp_get_layer_top
+
:::[https://docs.lvgl.io/8.2/overview/display.html#lv__disp_8h_1abb96745c10c7d8b5d7acc93e70584145 '''lv_disp_get_layer_top''']
:: <span style="background-color: #eeeeee;">struct _lv_obj_t *sys_layer </span>
+
::<span style="background-color: #eeeeee;">struct _[https://docs.lvgl.io/8.2/widgets/obj.html#_CPPv49_lv_obj_t '''lv_obj_t'''] *sys_layer </span>
::: <span style="background-color: #eeeeee;">See</span>
+
:::<span style="background-color: #eeeeee;">See</span>
::: lv_disp_get_layer_sys
+
:::[https://docs.lvgl.io/8.2/overview/display.html#lv__disp_8h_1ae9a48f536aab873d71c07c313c4e433e '''lv_disp_get_layer_sys''']
: <span style="background-color: #eeeeee;">uint32_t screen_cnt</span>
+
:<span style="background-color: #eeeeee;">uint32_t '''screen_cnt'''</span>
 
::
 
::
: <span style="background-color: #eeeeee;">uint8_t del_prev</span>
+
:<span style="background-color: #eeeeee;">uint8_t '''del_prev'''</span>
 
:: 1: Automatically delete the previous screen when the screen load animation is ready
 
:: 1: Automatically delete the previous screen when the screen load animation is ready
: <span style="background-color: #eeeeee;">lv_opa_t bg_opa</span>
+
:<span style="background-color: #eeeeee;">lv_opa_t '''bg_opa'''</span>
 
:: Opacity of the background color or wallpaper
 
:: Opacity of the background color or wallpaper
: <span style="background-color: #eeeeee;">lv_color_t bg_color</span>
+
:<span style="background-color: #eeeeee;">lv_color_t '''bg_color'''</span>
 
:: Default display color when screens are transparent
 
:: Default display color when screens are transparent
: <span style="background-color: #eeeeee;">const void *bg_img</span>
+
:<span style="background-color: #eeeeee;">const void *'''bg_img'''</span>
 
:: An image source to display as wallpaper
 
:: An image source to display as wallpaper
: <span style="background-color: #eeeeee;">lv_area_t inv_areas[LV_INV_BUF_SIZE]</span>
+
:<span style="background-color: #eeeeee;">lv_area_t '''inv_areas'''[LV_INV_BUF_SIZE]</span>
 
:: Invalidated (marked to redraw) areas
 
:: Invalidated (marked to redraw) areas
: <span style="background-color: #eeeeee;">uint8_t inv_area_joined[LV_INV_BUF_SIZE]</span>
+
:<span style="background-color: #eeeeee;">uint8_t '''inv_area_joined'''[LV_INV_BUF_SIZE]</span>
 
:
 
:
: <span style="background-color: #eeeeee;">uint16_t inv_p</span>
+
:<span style="background-color: #eeeeee;">uint16_t '''inv_p'''</span>
 
:
 
:
: <span style="background-color: #eeeeee;">uint32_t last_activity_time</span>
+
:<span style="background-color: #eeeeee;">uint32_t '''last_activity_time'''</span>
 
:: Last time when there was activity on this display
 
:: Last time when there was activity on this display
 +
|
 +
<span style="background-color:#e7f2fa;color:#2980b9;">struct '''_lv_disp_t'''</span>
  
 
+
:''#include<lv_'hal_disp.h>''構造を表示します。
----
+
:<span style="background-color:#e7f2fa;">LVGLの表示を登録するには、a<code style="color: #bb0000;">lv_disp_drv_t</code>構造体の最初のメンバーであることに 注意 してください。</span>
[[App:Library:LVGL:docs:Porting|戻る : Previous]]
+
:'''パブリックメンバー'''
 +
:: struct _ '''lv_disp_drv_t''' * driver
 +
:: <ディスプレイへのドライバー汚れた部分を定期的にチェックしてリフレッシュするタイマー
 +
:<span style="background-color: #eeeeee;">'''lv_timer_t''' * '''refr_timer'''</span>
 +
:: 画面に割り当てられたテーマ
 +
:<span style="background-color: #eeeeee;">struct _ '''lv_theme_t''' * '''theme'''</span>
 +
::
 +
:<span style="background-color: #eeeeee;">struct '''_lv_obj_t''' **'''画面'''</span>
 +
:: 表示の画面画面オブジェクトの配列。
 +
:<span style="background-color: #eeeeee;">struct _ '''lv_obj_t''' * '''act_scr'''</span>
 +
:: このディスプレイで現在アクティブな画面
 +
:<span style="background-color: #eeeeee;">struct _ '''lv_obj_t''' * '''prev_scr'''</span>
 +
:: 前の画面。画面アニメーション中に使用されます
 +
:<span style="background-color: #eeeeee;">struct _ '''lv_obj_t''' * '''scr_to_load'''</span>
 +
:: lv_scr_load_animにロードする準備ができた画面
 +
:<span style="background-color: #eeeeee;">struct _ '''lv_obj_t''' * '''top_layer'''</span>
 +
::: 見る
 +
:::'''lv_disp_get_layer_top'''
 +
::<span style="background-color: #eeeeee;">struct _ '''lv_obj_t''' * '''sys_layer'''</span>
 +
::: 見る
 +
:::'''lv_disp_get_layer_sys'''
 +
:<span style="background-color: #eeeeee;">uint32_t '''screen_cnt'''</span>
 +
::
 +
:<span style="background-color: #eeeeee;">uint8_t '''del_prev'''</span>
 +
:: 1:画面読み込みアニメーションの準備ができたら、前の画面を自動的に削除します
 +
:<span style="background-color: #eeeeee;">lv_opa_t '''bg_opa'''</span>
 +
:: 背景色または壁紙の不透明度
 +
:<span style="background-color: #eeeeee;">lv_color_t '''bg_c​​olor'''</span>
 +
:: 画面が透明な場合のデフォルトの表示色
 +
:<span style="background-color: #eeeeee;">const void * '''bg_img'''</span>
 +
:: 壁紙として表示する画像ソース
 +
:<span style="background-color: #eeeeee;">lv_area_t '''inv_areas''' [LV_INV_BUF_SIZE]</span>
 +
:: 無効化された(再描画するようにマークされた)領域
 +
:<span style="background-color: #eeeeee;">uint8_t '''inv_area_joined''' [LV_INV_BUF_SIZE]</span>
 +
:
 +
:<span style="background-color: #eeeeee;">uint16_t '''inv_p'''</span>
 +
:
 +
:<span style="background-color: #eeeeee;">uint32_t '''last_activity_time'''</span>
 +
:: 前回このディスプレイでアクティビティがあったとき
 +
|}
 +
:[[App:Library:LVGL:docs:Porting#Display interface|戻る : Previous]]

2022年8月30日 (火) 23:27時点における最新版

https://docs.lvgl.io/8.2/porting/display.html

Display interface

英文 自動翻訳

To set up a display an lv_disp_buf_t and an lv_disp_drv_t variable have to be initialized.

  • lv_disp_buf_t contains internal graphic buffer(s).
  • lv_disp_drv_t contains callback functions to interact with the display and manipulate drawing related things.


ディスプレイをセットアップするには、lv_disp_buf_tlv_disp_drv_tの変数を初期化する必要があります。

  • lv_disp_buf_t内部グラフィックバッファが含まれています。
  • lv_disp_drv_tディスプレイと対話し、描画関連のものを操作するためのコールバック関数が含まれています。
戻る : Previous


Display buffer

英文 自動翻訳
lv_disp_buf_t can be initialized 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_buf_init(&disp_buf, buf_1, buf_2, MY_DISP_HOR_RES*10);
lv_disp_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_buf_init (&disp_buf  buf_1  buf_2  MY_DISP_HOR_RES * 10 ;
There are 3 possible configurations regarding the buffer size:


1.

One buffer LVGL draws the content of the screen into a buffer and sends it to the display.

The buffer can be smaller than the screen.

In this case, the larger areas will be redrawn in multiple parts.

If only small areas changes (e.g. button press) then only those areas will be refreshed.


バッファ サイズに関しては、次の 3 つの構成が可能です。


1.

One buffer LVGL は、画面のコンテンツをバッファーに描画し、それをディスプレイに送信します。

バッファは画面よりも小さい場合があります。

この場合、より大きな領域が複数の部分に再描画されます。

小さな領域のみが変更された場合 (ボタンを押すなど)、それらの領域のみが更新されます。

2.

Two non-screen-sized buffers having two buffers LVGL can draw into one buffer while the content of the other buffer is sent to display in the background.

DMA or other hardware should be used to transfer the data to the display to let the CPU draw meanwhile.

This way the rendering and refreshing of the display become parallel.

Similarly to the One buffer, LVGL will draw the display's content in chunks if the buffer is smaller than the area to refresh.

2.

Two non-screen-sized buffers having two buffers LVGL(2つのバッファを持つ非スクリーンサイズのバッファ) は、一方のバッファに描画でき、他方の表示用バッファの内容はバックグラウンドで送信されます。

DMA またはその他のハードウェアを使用してデータをディスプレイに転送し、その間に CPU が描画できるようにする必要があります。

このようにして、ディスプレイのレンダリングとリフレッシュが並行して行われます。

One bufferと同様に、バッファがリフレッシュする領域よりも小さい場合、LVGL はディスプレイのコンテンツをまとめて描画します。

3.

Two screen-sized buffers.

In contrast to Two non-screen-sized buffers LVGL will always provide the whole screen's content not only chunks.

This way the driver can simply change the address of the frame buffer to the buffer received from LVGL.

Therefore this method works the best when the MCU has an LCD/TFT interface and the frame buffer is just a location in the RAM.

You can measure the performance of your display configuration using the benchmark example.

3.

Two screen-sized buffers.

2 つの非画面サイズのバッファとは対照的に、LVGL はまとまったデータだけでなく画面全体のコンテンツを常に提供します。

このようにして、ドライバはフレーム バッファのアドレスを LVGL から受信したバッファに簡単に変更できます。

したがって、この方法は、MCU に LCD/TFT インターフェイスがあり、フレーム バッファが RAM 内にある場合に最適です。

ベンチマークの例を使用して、ディスプレイ設定のパフォーマンスを測定できます。

戻る : Previous

Display driver

英文 自動翻訳
Once the buffer initialization is ready the display drivers need to be initialized. In the most simple case only the following two fields of lv_disp_drv_t needs to be set:
  • buffer pointer to an initialized lv_disp_buf_t variable.
  • flush_cb a callback function to copy a buffer's content to a specific area of the display. lv_disp_flush_ready() needs to be called when flushing is ready. LVGL might render the screen in multiple chunks and therefore call flush_cb multiple times. To see which is the last chunk of rendering use lv_disp_flush_is_last().
バッファの初期化の準備ができたら、ディスプレイドライバを初期化する必要があります。最も単純なケースでは、lv_disp_drv_t の以下の2つのフィールドを設定するだけでよい。
  • buffer 初期化された lv_disp_buf_t 変数へのポインタ。
  • flush_cb バッファの内容をディスプレイの特定の領域にコピーするためのコールバック関数です。LVGLは画面を複数のチャンクでレンダリングすることがあるので、flush_cbを複数回呼び出すことがあります。どのチャンクが最後のレンダリングであるかを確認するには、lv_disp_flush_is_last() を使用します。
There are some optional data fields:
  • hor_res horizontal resolution of the display. (LV_HOR_RES_MAX by default from lv_conf.h).
  • ver_res vertical resolution of the display. (LV_VER_RES_MAX by default from lv_conf.h).
  • color_chroma_key a color which will be drawn as transparent on chrome keyed images. LV_COLOR_TRANSP by default from lv_conf.h).
  • user_data custom user data for the driver. Its type can be modified in lv_conf.h.
  • anti-aliasing use anti-aliasing (edge smoothing). LV_ANTIALIAS by default from lv_conf.h.
  • rotated and sw_rotate See the rotation section below.
  • screen_transp if 1 the screen can have transparent or opaque style. LV_COLOR_SCREEN_TRANSP needs to enabled in lv_conf.h.
オプションのデータフィールドがいくつかあります。
  • hor_res ディスプレイの水平解像度。(LV_HOR_RES_MAX、デフォルトはlv_conf.h).
  • ver_res ディスプレイの垂直解像度。(デフォルトは LV_VER_RES_MAX (lv_conf.h))。
  • color_chroma_key クロームキーの画像で透過的に描画される色。LV_COLOR_TRANSP (デフォルト:lv_conf.h)。
  • user_data ドライバのカスタムユーザーデータ。このタイプは、lv_conf.hで変更することができます。
  • アンチエイリアス アンチエイリアス(エッジスムージング)を使用する。LV_ANTIALIAS は lv_conf.h のデフォルトです。
  • rotatedとsw_rotate 以下の回転のセクションを参照してください。
  • screen_transp 1の場合、スクリーンは透明または不透明のスタイルを持つことができます。LV_COLOR_SCREEN_TRANSPは、lv_conf.hで有効にする必要があります。
To use a GPU the following callbacks can be used:
  • gpu_fill_cb fill an area in memory with colors.
  • gpu_blend_cb blend two memory buffers using opacity.
  • gpu_wait_cb if any GPU function return, while the GPU is still working LVGL, will use this function when required the be sure GPU rendering is ready.
GPU を使用するために、以下コールバックが使用可能です。
  • gpu_fill_cb メモリ内の領域を色で塗りつぶします。
  • gpu_blend_cb 不透明度を使用して 2 つのメモリバッファをブレンドします。
  • gpu_wait_cb GPU がまだ LVGL を使用しているときに GPU 関数が返った場合、GPU レンダリングの準備ができたことを確認するために必要なときに、この関数を使用します。
Note that, these functions need to draw to the memory (RAM) and not your display directly.

Some other optional callbacks to make easier and more optimal to work with monochrome, grayscale or other non-standard RGB displays:

これらの関数は、ディスプレイではなくメモリ(RAM)に直接描画する必要があることに注意してください。

モノクロ、グレースケール、その他の非標準RGBディスプレイでの作業をより簡単に、より最適にするためのオプションのコールバックもあります。

  • 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 display buffer. It can be used to store the pixels more compactly if the display has a special color format. (e.g. 1-bit monochrome, 2-bit grayscale etc.) This way the buffers used in lv_disp_buf_t can be smaller to hold only the required number of bits for the given area size. set_px_cb is not working with Two screen-sized buffers display buffer configuration.
  • monitor_cb a callback function tells how many pixels were refreshed in how much time.
  • clean_dcache_cb a callback for cleaning any caches related to the display
  • rounder_cb 再描画する領域の座標を丸める。例えば、2x2 px は 2x8 に変換される。これは、ディスプレイコントローラが特定の高さまたは幅の領域のみを更新できる場合に使用できます (通常、モノクロディスプレイの高さは 8 px です)。
  • set_px_cb 表示バッファを書き込むためのカスタム関数です。これは、ディスプレイが特殊な色形式である場合に、ピクセルをよりコンパクトに格納するために使用することができます。(set_px_cb は、2画面サイズのバッファを持つディスプレイバッファの構成では動作しません。
  • monitor_cb コールバック関数で、どれだけのピクセルがどれだけの時間でリフレッシュされたかを伝えます。
  • clean_dcache_cb ディスプレイに関連するあらゆるキャッシュをクリーニングするためのコールバックです。
To set the fields of lv_disp_drv_t variable it needs to be initialized with lv_disp_drv_init(&disp_drv).

And finally to register a display for LVGL lv_disp_drv_register(&disp_drv) needs to be called.

変数lv_disp_drv_tのフィールドを設定するには、lv_disp_drv_init(&disp_drv)で初期化する必要があります。

最後に、LVGLにディスプレイを登録するために、 lv_disp_drv_register(&disp_drv) を呼び出す必要があります。

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.buffer = &disp_buf;          /*Set an initialized buffer*/
 disp_drv.flush_cb = my_flush_cb;        /*Set a flush callback to draw to the display*/
 lv_disp_t * disp;
 disp = lv_disp_drv_register(&disp_drv); /*Register the driver and save the created display objects*/


全体として、次のようになります。

 static lv_disp_drv_t disp_drv;          /*ドライバーを保持する変数。静的またはグローバルである必要があります。*/ 
 lv_disp_drv_init(&disp_drv);            /*基本的な初期化*/ 
 disp_drv.buffer = &disp_buf;          /*初期化されたバッファを設定します*/ 
 disp_drv.flush_cb = my_flush_cb;        /*ディスプレイに描画するフラッシュコールバックを設定します*/ 
 lv_disp_t * disp;
 disp = lv_disp_drv_register(&disp_drv); /*ドライバーを登録し、作成した表示オ​​ブジェクトを保存します*/
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*/
     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_gpu_blend_cb(lv_disp_drv_t * disp_drv, lv_color_t * dest, const lv_color_t * src, uint32_t length, lv_opa_t opa)
 {
     /*It's an example code which should be done by your GPU*/
     uint32_t i;
     for(i = 0; i < length; i++) {
         dest[i] = lv_color_mix(dest[i], src[i], opa);
     }
 } 

 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();
 }

コールバックの簡単な例を次に示します。

  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_gpu_blend_cb(lv_disp_drv_t * disp_drv, lv_color_t * dest, const lv_color_t * src, uint32_t length, lv_opa_t opa)
 {
     /*これはGPUで実行する必要があるサンプルコードです*/
     uint32_t i;
     for(i = 0; i < length; i++) {
         dest[i] = lv_color_mix(dest[i], src[i], opa);
     }
 }
  
  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 (); 
  }
戻る : Previous

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 your flush_cb callback.


There is a noticeable amount of overhead to performing rotation in software, which is why hardware rotation is also available.

In this mode, LVGL draws into the buffer as though your screen now has the width and height inverted.

You are responsible for rotating the provided pixels yourself.

LVGLは、90度刻みでのディスプレイの回転をサポートします。ソフトウェアローテーションまたはハードウェアローテーションのどちらを使用するかを選択できます。

ソフトウェアローテーション(sw_rotateフラグを1に設定)を選択すると、LVGLがローテーションを実行します。ドライバーは、画面の幅と高さが変更されていないと想定できます。通常どおり、ピクセルをディスプレイにフラッシュするだけです。ソフトウェアローテーションでは、flush_cbコールバックに追加のロジックは必要ありません。


ソフトウェアで回転を行うにはかなりのオーバーヘッドがあるため、ハードウェアでの回転も可能になっています。

このモードでは、LVGLは、あたかも画面の幅と高さが反転しているようにバッファに描画します。

提供されたピクセルを回転させるのはあなた自身の責任です。

The default rotation of your display when it is initialized can be set using the rotated flag.

The available options are LV_DISP_ROT_NONE, LV_DISP_ROT_90, LV_DISP_ROT_180, or LV_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.

初期化時のディスプレイのデフォルトの回転は、rotatedフラグを使用して設定できます。

使用可能なオプションは、LV_DISP_ROT_NONELV_DISP_ROT_90LV_DISP_ROT_180LV_DISP_ROT_270LV_DISP_ROT_90です。

回転値は、物理ディスプレイを時計回りに回転させる方法を基準にしています。

つまり、ハードウェアを時計回りに90度回転させ、ディスプレイを反時計回りに90度回転させて補正することを意味します。

(7.10.0以前からアップグレードするユーザーへの注意:これらの新しい回転列挙値は、90度回転する古い0/1システムと一致するため、レガシーコードは引き続き期待どおりに機能するはずです。互換性のために、ソフトウェアの回転もデフォルトで無効になっています。)


ディスプレイの回転は、lv_disp_set_rotation(disp, rot)APIを使用して実行時に変更することもできます。


ソフトウェアローテーションのサポートは新機能であるため、構成によっては不具合やバグが発生する場合があります。

問題が発生した場合は、GitHubで問題を開いてください。

戻る : Previous


API

@description Display Driver HAL interface header file

Typedefs

英文 自動翻訳
typedef struct _lv_disp_drv_t lv_disp_drv_t
Display Driver structure to be registered by HAL.

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_drv_t lv_disp_drv_t

HALが登録するドライバ構造を表示します。

typedef struct _lv_disp_t lv_disp_t

表示構造。
lv_disp_drv_tは構造体の最初のメンバーである必要があります。
戻る : Previous

Enums

enum lv_disp_size_t

Values:
enumerator LV_DISP_SIZE_SMALL
enumerator LV_DISP_SIZE_MEDIUM
enumerator LV_DISP_SIZE_LARGE
enumerator LV_DISP_SIZE_EXTRA_LARGE

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

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 to NULL if unused.
  • size_in_px_cnt -- size of the buf1 and buf2 in pixel count.

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
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->flushDMAまたは同様のハードウェアを使用して、画像をバックグラウンドのディスプレイに送信する必要があります。これにより、LVGLは、前のフレームが送信されている間、次のフレームを他のバッファーにレンダリングできます。NULL未使用の場合はに設定します。
  • size_in_px_cnt-およびのサイズbuf1buf2ピクセル数。

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)
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

void lv_disp_remove(lv_disp_t *disp)

Remove a display
Parameters
disp -- pointer to display

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

lv_disp_t *lv_disp_get_default(void)

Get the default display
Returns
pointer to the default display

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
void lv_disp_drv_update(lv_disp_t * disp、lv_disp_drv_t * new_drv)
実行時にドライバーを更新します。
パラメーター
  • disp--ディスプレイへのポインタ。(の戻り値lv_disp_drv_register
  • new_drv--新しいドライバへのポインタ

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)
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

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

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
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)
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

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
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)
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

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

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
bool lv_disp_get_antialiasing(lv_disp_t * disp)
ディスプレイに対してアンチエイリアシングが有効になっているかどうかを取得します
パラメーター
disp-ディスプレイへのポインタ(デフォルトのディスプレイを使用する場合はNULL)
戻り値
true:アンチエイリアシングが有効:false:無効

lv_coord_t lv_disp_get_dpi(con​​st 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)
Get the current rotation of this display.
Parameters
disp -- pointer to a display (NULL to use the default display)
Returns
rotation angle

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

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
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> Structure for holding display buffer information.
Public Members
void *buf1
First display buffer.
void *buf2
Second display buffer.
void * buf_act
uint32_t size
lv_area_t area
int flushing
int flashing_last
uint32_t last_area
uint32_t last_part
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 size
lv_area_t area
int flushing
int flashing_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 as static 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 hysical_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
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
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
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_TRANSP by default. (lv_conf.h)
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_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_t physical_hor_res
フル/物理ディスプレイの水平解像度。フルスクリーンモードの場合は-1に設定します。
lv_coord_t physical_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 antialiasing'
1:このディスプレイでアンチエイリアシングが有効になっています。
uint32_t rotated
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()」を呼び出す必要があります
void(* rounder_cb)(struct _ lv_disp_drv_t * disp_drv、lv_area_t * area)
LVGLの表示を登録するには、ayオプション:無効化された領域を拡張して、モノクロディスプレイのディスプレイドライバの要件に一致させます。たとえば、8、16 ..)に丸めます。
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_TRANSP。(lv_conf.h)
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> 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
See
lv_disp_get_layer_top
struct _lv_obj_t *sys_layer
See
lv_disp_get_layer_sys
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

struct _lv_disp_t

#include<lv_'hal_disp.h>構造を表示します。
LVGLの表示を登録するには、alv_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_c​​olor
画面が透明な場合のデフォルトの表示色
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
前回このディスプレイでアクティビティがあったとき
戻る : Previous