{"id":14922,"date":"2023-06-26T10:32:16","date_gmt":"2023-06-26T05:02:16","guid":{"rendered":"https:\/\/fastbitlab.com\/?p=14922"},"modified":"2023-08-17T16:42:11","modified_gmt":"2023-08-17T11:12:11","slug":"ltdc-layer-initialization-and-windowing-step-by-step-guide","status":"publish","type":"post","link":"https:\/\/fastbitlab.com\/blog\/ltdc-layer-initialization-and-windowing-step-by-step-guide\/","title":{"rendered":"STM32-LTDC, LCD-TFT, LVGL(MCU3) Lecture 39| LTDC Layers initialization coding and windowing explanation"},"content":{"rendered":"<div class=\"boldgrid-section color4-background-color color-4-text-contrast bg-background-color\">\n<div class=\"container\">\n<div class=\"row\">\n<div class=\"col-lg-1 col-md-12 col-sm-12 col-xs-12\"><\/div>\n<div class=\"col-lg-10 col-md-12 col-xs-12 col-sm-12\">\n<p class=\"\">&nbsp;<\/p>\n<h1 class=\"\" style=\"text-align: center; font-size: 35px; line-height: 50px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000080;\"><strong>LTDC Layers initialization coding and windowing explanation<\/strong><\/span><\/h1>\n<div class=\"row bg-editor-hr-wrap\">\n<div class=\"col-lg-12 col-md-12 col-xs-12 col-sm-12\">\n<div>\n<div class=\"bg-hr bg-hr-16 color2-color\" style=\"border-style: solid; border-width: 0px 0px 2px; box-shadow: #cecece 0px 0px 0px 0px;\"><\/div>\n<p>&nbsp;<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p class=\"\" style=\"font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">In the previous article, we explored a few registers of the LTDC layers. In this article, let&#8217;s continue with our coding and create another function called &#8220;LTDC Layer Init&#8221;. This function will be responsible for initializing the LTDC layer according to our application requirements.<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">To initialize the LTDC layer, you need to follow these steps:<\/span><\/p>\n<ol class=\"\" style=\"font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">Configure the pixel format of the layer&#8217;s framebuffer.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">Configure the constant alpha and blending factors, namely BF1 and BF2.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">Configure the layer position (Windowing).<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">Configure the frame buffer address.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">Optionally, configure the default color of the layer (usually black color is used by default).<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">Configure the pitch, line length, and line numbers of the frame buffer.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">Activate immediate reload. This means storing the values from the shadow registers to the real registers. All the configurations mentioned above are stored in the shadow registers, so activating immediate reload is necessary.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">Enable the layer.<\/span><\/li>\n<\/ol>\n<p class=\"\">&nbsp;<\/p>\n<figure id=\"attachment_14925\" aria-describedby=\"caption-attachment-14925\" style=\"width: 716px\" class=\"wp-caption aligncenter\"><img fetchpriority=\"high\" decoding=\"async\" class=\"wp-image-14925 \" src=\"https:\/\/fastbitlab.com\/wp-content\/uploads\/2023\/06\/Figure-1-5.png\" alt=\"Figure 1. LTDC layers initialization steps\" width=\"716\" height=\"282\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/06\/Figure-1-5.png 1731w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/06\/Figure-1-5-300x118.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/06\/Figure-1-5-1024x403.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/06\/Figure-1-5-768x302.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/06\/Figure-1-5-600x236.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/06\/Figure-1-5-1536x604.png 1536w\" sizes=\"(max-width: 716px) 100vw, 716px\" \/><figcaption id=\"caption-attachment-14925\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 1. LTDC layers initialization steps<\/span><\/figcaption><\/figure>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">You can easily code these steps by referring to the reference manual.<\/span><\/p>\n<p class=\"\" style=\"font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Now, I will explain how to configure the position of the layer and how the windowing works.<\/span><\/p>\n<p class=\"\" style=\"font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Let&#8217;s discuss the configuration items for the horizontal position of the layer window.<\/span><\/p>\n<figure id=\"attachment_14926\" aria-describedby=\"caption-attachment-14926\" style=\"width: 738px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" class=\"wp-image-14926\" src=\"https:\/\/fastbitlab.com\/wp-content\/uploads\/2023\/06\/Figure-2-4.png\" alt=\"LTDC Layers initialization coding and windowing\" width=\"738\" height=\"507\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/06\/Figure-2-4.png 1317w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/06\/Figure-2-4-300x206.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/06\/Figure-2-4-1024x704.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/06\/Figure-2-4-768x528.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/06\/Figure-2-4-600x412.png 600w\" sizes=\"(max-width: 738px) 100vw, 738px\" \/><figcaption id=\"caption-attachment-14926\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 2. Layer window horizontal position configuration items<\/span><\/figcaption><\/figure>\n<p class=\"\" style=\"font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">There are 2 configuration items. WHSTOPS(Start) and WHSPPOS(Stop).<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<figure id=\"attachment_14927\" aria-describedby=\"caption-attachment-14927\" style=\"width: 783px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" class=\"wp-image-14927\" src=\"https:\/\/fastbitlab.com\/wp-content\/uploads\/2023\/06\/Figure-3-4.png\" alt=\"LTDC Layers initialization coding and windowing\" width=\"783\" height=\"370\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/06\/Figure-3-4.png 1141w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/06\/Figure-3-4-300x142.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/06\/Figure-3-4-1024x484.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/06\/Figure-3-4-768x363.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/06\/Figure-3-4-600x283.png 600w\" sizes=\"(max-width: 783px) 100vw, 783px\" \/><figcaption id=\"caption-attachment-14927\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 3. LTDC Layerx Window Horizontal Position Configuration Register<\/span><\/figcaption><\/figure>\n<p class=\"\" style=\"font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">In the LTDC Layerx Window Horizontal Position Configuration Register, you can see the start position and the stop position(Figure 3).<\/span><\/p>\n<p class=\"\" style=\"font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">How to calculate the start position and stop position? You can follow the method below.&nbsp;<\/span><\/p>\n<p class=\"\" style=\"font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #993366;\"><b>WHSTOPS(Start) = AHBP+H_start+1<\/b><\/span><\/p>\n<p class=\"\" style=\"font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #993366;\"><b>WHSPPOS(Stop) = AHBP+H_start+Layer_width+1(&lt;=AAW)<\/b><\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<ol class=\"\" style=\"font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"color: #993366;\"><strong><span style=\"text-decoration: underline;\">WHSTOPS (Start):<\/span><\/strong><\/span>\n<ul class=\"\">\n<li style=\"font-weight: 400;\" aria-level=\"2\"><span style=\"font-weight: 400; color: #000000;\">WHSTOPS represents the starting position of the layer window.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"2\"><span style=\"font-weight: 400; color: #000000;\">It is calculated using the following formula: WHSTOPS(Start) = AHBP + H_start + 1<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"2\"><span style=\"font-weight: 400; color: #000000;\">AHBP stands for Accumulated Horizontal Back Porch, which represents the number of horizontal pixels before the active display area starts.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"2\"><span style=\"font-weight: 400; color: #000000;\">H_start represents the horizontal offset for the layer window, indicating the number of pixels from the left edge of the screen where the window should start.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"2\"><span style=\"font-weight: 400; color: #000000;\">By adding AHBP, H_start, and 1, you can determine the starting position of the layer window vertically.<\/span><\/li>\n<\/ul>\n<\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"text-decoration: underline; color: #993366;\"><strong>WHSPPOS (Stop):<\/strong><\/span>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"2\"><span style=\"font-weight: 400; color: #000000;\">WHSPPOS represents the stopping position of the layer window.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"2\"><span style=\"font-weight: 400; color: #000000;\">It is calculated using the following formula: WHSPPOS(Stop) = AHBP + H_start + Layer_width + 1 (&lt;= AAW)<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"2\"><span style=\"font-weight: 400; color: #000000;\">Layer_width represents the width of the layer window in pixels.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"2\"><span style=\"font-weight: 400; color: #000000;\">AAW stands for Accumulated Active Width, which indicates the total width of the active display area.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"2\"><span style=\"font-weight: 400; color: #000000;\">By adding AHBP, H_start, Layer_width, and 1, you can determine the stopping position of the layer window vertically.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"2\"><span style=\"font-weight: 400; color: #000000;\">The condition (&lt;= AAW) ensures that the stopping position does not exceed the width of the active display area.<\/span><\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-family: 'Roboto Slab'; font-weight: 400; font-size: 20px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"text-decoration: underline; color: #de3737;\"><strong>Example:<\/strong><\/span><\/p>\n<p class=\"\" style=\"font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Let&#8217;s assume the following values for the configuration items:<\/span><\/p>\n<ul class=\"\" style=\"font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">AHBP = 20<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">H_start = 10<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">Layer_width = 100<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">AAW = 800<\/span><\/li>\n<\/ul>\n<p class=\"\" style=\"font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">WHSTOPS(Start) = AHBP + H_start + 1<\/span><\/p>\n<p class=\"\" style=\"font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">WHSTOPS(Start) = 20 + 10 + 1<\/span><\/p>\n<ol class=\"\" style=\"font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">\n<li><span style=\"font-weight: 400; color: #000000;\">WHSTOPS(Start) = 31<\/span><\/li>\n<\/ol>\n<p class=\"\" style=\"padding-left: 80px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">WHSPPOS(Stop) = AHBP + H_start + Layer_width + 1 (&lt;= AAW)<\/span><\/p>\n<p class=\"\" style=\"padding-left: 80px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">WHSPPOS(Stop) = 20 + 10 + 100 + 1 (&lt;= 800)<\/span><\/p>\n<p class=\"\" style=\"padding-left: 40px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">2.WHSPPOS(Stop) = 131 (&lt;= 800)<\/span><\/p>\n<p class=\"\" style=\"font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">In this example, the layer window would start at a vertical position of 31 pixels and stop at a position of 131 pixels, within the allowed range of the active display area.<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Similarly, Layer window vertical position configuration items.&nbsp;<\/span><\/p>\n<p class=\"\" style=\"font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">There are 2 configuration items here. I mean, the logic is same. Instead of AHBP you should take&nbsp; AVBP, read that value.<\/span><\/p>\n<figure id=\"attachment_14928\" aria-describedby=\"caption-attachment-14928\" style=\"width: 709px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-14928\" src=\"https:\/\/fastbitlab.com\/wp-content\/uploads\/2023\/06\/Figure-4-3.png\" alt=\"LTDC Layers initialization coding and windowing\" width=\"709\" height=\"417\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/06\/Figure-4-3.png 1543w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/06\/Figure-4-3-300x176.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/06\/Figure-4-3-1024x602.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/06\/Figure-4-3-768x451.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/06\/Figure-4-3-600x353.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/06\/Figure-4-3-1536x903.png 1536w\" sizes=\"(max-width: 709px) 100vw, 709px\" \/><figcaption id=\"caption-attachment-14928\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 4. Layer window vertical position configuration items<\/span><\/figcaption><\/figure>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">In this project, we are displaying VIBGYOR bars&nbsp; as shown in Figure 5. We are utilizing the layer for the entire screen. Our layer window operates as follows: H_start is 0, H_stop is 320, V_start is 0, and V_stop is 240. Based on these values, you need to perform the calculations.&nbsp;<\/span><\/p>\n<figure id=\"attachment_14929\" aria-describedby=\"caption-attachment-14929\" style=\"width: 735px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-14929 \" src=\"https:\/\/fastbitlab.com\/wp-content\/uploads\/2023\/06\/Figure-5-3.png\" alt=\"Figure 5. VIBGYOR bars\" width=\"735\" height=\"377\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/06\/Figure-5-3.png 1779w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/06\/Figure-5-3-300x154.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/06\/Figure-5-3-1024x526.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/06\/Figure-5-3-768x394.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/06\/Figure-5-3-600x308.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/06\/Figure-5-3-1536x788.png 1536w\" sizes=\"(max-width: 735px) 100vw, 735px\" \/><figcaption id=\"caption-attachment-14929\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 5. VIBGYOR bars<\/span><\/figcaption><\/figure>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-family: 'Roboto Slab'; font-weight: 400; font-size: 25px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"text-decoration: underline; color: #ff6600;\"><b>Configure layer position (windowing)<\/b><\/span><\/p>\n<p class=\"\" style=\"font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">The Layer Position (windowing) in the LCD-TFT Display Controller (LTDC) allows you to define the position and size of each layer within the display. This feature enables you to create multi-layered graphics or blend multiple images on the screen.<\/span><\/p>\n<p class=\"\" style=\"font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">To configure the layer position in LTDC, you need to define the Horizontal Start, Horizontal Stop, Vertical Start, and Vertical Stop values for each layer. These values specify the coordinates of the top-left and bottom-right corners of the layer within the display.<\/span><\/p>\n<pre class=\"color-5-text-contrast color5-background-color\" style=\"box-shadow: #cecece 0px 0px 0px 0px inset;\"><span class=\"\" style=\"color: #008000;\">\/\/ Configure layer position (Windowing)<\/span>\r\n\r\n<span class=\"\" style=\"color: #993366;\">uint32_t<\/span> tmp = 0;\r\n\r\n<span class=\"\" style=\"color: #993366;\">uint32_t<\/span> AHBP =&nbsp; REG_READ_VAL(pLTDC-&gt;<span style=\"color: #99ccff;\">BPCR<\/span>,0xFFFU,LTDC_BPCR_AHBP_Pos);\r\n\r\n<span style=\"color: #993366;\">uint32_t<\/span> WHSTART = AHBP+0 +1;\r\n\r\nREG_SET_VAL(tmp,WHSTART,0xFFFU,LTDC_LxWHPCR_WHSTPOS_Pos);\r\n\r\n\r\n\r\n<span class=\"\" style=\"color: #993366;\">uint32_t<\/span> WHSTOP = AHBP+0+BSP_LTDC_LAYER_WIDTH+1;\r\n\r\n<span class=\"\" style=\"color: #993366;\">uint32_t<\/span> AAW =&nbsp; &nbsp;REG_READ_VAL(pLTDC-&gt;<span style=\"color: #99ccff;\">AWCR<\/span>,0xFFFU,LTDC_AWCR_AAW_Pos);\r\n\r\nWHSTOP = (WHSTOP &gt; AAW)?AAW:WHSTOP;\r\n\r\nREG_SET_VAL(tmp,WHSTOP,0xFFFU,LTDC_LxWHPCR_WHSPPOS_Pos);\r\n\r\n\r\nREG_WRITE(tmp, pLayer-&gt;WHPCR);<\/pre>\n<div><\/div>\n<p class=\"\" style=\"font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">First let&#8217;s calculate WHSTART<\/span><span style=\"font-weight: 400;\">. WHSTART = AHBP + the Layer width 0, and +1.&nbsp;<\/span><\/span><\/p>\n<p class=\"\" style=\"font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #7c2a7d;\"><b>uint32_t WHSTART = AHBP + 0 + 1;<\/b><\/span><\/p>\n<p class=\"\" style=\"font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">This line calculates the start position for the horizontal synchronization (window) of the layer. It adds the value of<\/span> <span style=\"color: #333399;\"><b>AHBP<\/b><\/span><span style=\"font-weight: 400;\"> (active horizontal back porch) with 0 (presumably for some additional offset) and 1 to obtain the start position. The result is stored in the variable <\/span><span style=\"color: #333399;\"><b>WHSTART<\/b><\/span><span style=\"font-weight: 400;\">.<\/span><\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #800080;\"><b>uint32_t AHBP = REG_READ_VAL(pLTDC-&gt;BPCR, 0xFFFU, LTDC_BPCR_AHBP_Pos);<\/b><\/span><\/p>\n<p class=\"\" style=\"font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">&nbsp;This line reads a value from the LTDC&#8217;s BPCR (Back Porch Configuration Register) at the bit position specified by<\/span> <span style=\"color: #333399;\"><b>LTDC_BPCR_AHBP_Pos<\/b><\/span><span style=\"font-weight: 400;\"> (presumably a constant defined elsewhere) using the <\/span><span style=\"color: #333399;\"><b>REG_READ_VAL<\/b><\/span><span style=\"font-weight: 400;\"> function. The extracted value is stored in the variable<\/span><span style=\"color: #333399;\"> <b>AHBP<\/b><\/span><span style=\"font-weight: 400;\">, which represents the active horizontal back porch.<\/span><\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">After that, let&#8217;s create one temporary variable.<\/span><\/p>\n<p class=\"\" style=\"font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #800080;\"><b>uint32_t tmp = 0;<\/b><\/span><\/p>\n<p class=\"\" style=\"font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">&nbsp;<\/span><span style=\"font-weight: 400;\">This line initializes a temporary variable <\/span><span style=\"color: #333399;\"><b>tmp<\/b><\/span><span style=\"font-weight: 400;\"> of type <\/span><span style=\"color: #333399;\"><b>uint32_t<\/b><\/span><span style=\"font-weight: 400;\"> and assigns it the value 0.<\/span><\/span><\/p>\n<p class=\"\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #800080;\"><b>REG_SET_VAL(tmp, WHSTART, 0xFFFU, LTDC_LxWHPCR_WHSTPOS_Pos);<\/b><\/span><\/p>\n<p class=\"\" style=\"font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">This line sets the window start position value in the <\/span><span style=\"color: #333399;\"><b>tmp<\/b><\/span> <span style=\"font-weight: 400;\">variable. It uses the <\/span><span style=\"color: #333399;\"><b>REG_SET_VAL<\/b><\/span> <span style=\"font-weight: 400;\">function, passing <\/span><span style=\"color: #333399;\"><b>tmp<\/b><\/span><span style=\"font-weight: 400;\"> as the target variable,<\/span> <span style=\"color: #333399;\"><b>WHSTART<\/b><\/span><span style=\"font-weight: 400;\"> as the value to be set,<\/span> <span style=\"color: #333399;\"><b>0xFFFU<\/b><\/span><span style=\"font-weight: 400;\"> as the mask (to ensure the value fits within 12 bits), and <\/span><span style=\"color: #333399;\"><b>LTDC_LxWHPCR_WHSTPOS_Pos<\/b><\/span><span style=\"font-weight: 400;\"> as the position where the value should be placed within the <\/span><span style=\"color: #333399;\"><b>tmp<\/b><\/span><span style=\"font-weight: 400;\"> variable.<\/span><\/span><\/p>\n<p class=\"\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #800080;\"><b>uint32_t WHSTOP = AHBP + 0 + BSP_LCD_ACTIVE_WIDTH + 1;<\/b><\/span><\/p>\n<p class=\"\" style=\"font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">This line calculates the stop position for the horizontal synchronization (window) of the layer. It adds the value of <\/span><span style=\"color: #333399;\"><b>AHBP<\/b><\/span><span style=\"font-weight: 400;\"> (active horizontal back porch), 0 (presumably for some additional offset), <\/span><span style=\"color: #333399;\"><b>BSP_LCD_ACTIVE_WIDTH<\/b><\/span><span style=\"font-weight: 400;\"> (presumably a constant representing the active width of the LCD screen), and 1 to obtain the stop position. The result is stored in the variable <\/span><span style=\"color: #333399;\"><b>WHSTOP<\/b><\/span><span style=\"font-weight: 400;\">.<\/span><\/span><\/p>\n<p class=\"\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #800080;\"><b>uint32_t AAW = REG_READ_VAL(pLTDC-&gt;AWCR, 0xFFFU, LTDC_AWCR_AWW_Pos);<\/b><\/span><\/p>\n<p class=\"\" style=\"font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">This line reads a value from the LTDC&#8217;s AWCR (Active Width Configuration Register) at the bit position specified by <\/span><span style=\"color: #333399;\"><b>LTDC_AWCR_AWW_Pos<\/b><\/span><span style=\"font-weight: 400;\"> (presumably a constant defined elsewhere) using the <\/span><span style=\"color: #333399;\"><b>REG_READ_VAL<\/b><\/span><span style=\"font-weight: 400;\"> function. The extracted value is stored in the variable <\/span><span style=\"color: #333399;\"><b>AAW<\/b><\/span><span style=\"font-weight: 400;\">, which represents the active area width.<\/span><\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #800080;\"><b>WHSTOP = (WHSTOP &gt; AAW) ? AAW : WHSTOP;<\/b><\/span><\/p>\n<p class=\"\" style=\"font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">This line ensures that the<\/span> <span style=\"color: #333399;\"><b>WHSTOP<\/b><\/span><span style=\"font-weight: 400;\"> value does not exceed the <\/span><span style=\"color: #333399;\"><b>AAW<\/b><\/span><span style=\"font-weight: 400;\"> (active area width) value. If <\/span><span style=\"color: #333399;\"><b>WHSTOP<\/b><\/span><span style=\"font-weight: 400;\"> is greater than <\/span><span style=\"color: #333399;\"><b>AAW<\/b><\/span><span style=\"font-weight: 400;\">, it is set to<\/span> <span style=\"color: #333399;\"><b>AAW<\/b><\/span><span style=\"font-weight: 400;\">; otherwise, it remains unchanged.<\/span><\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #800080;\"><b>REG_SET_VAL(tmp, WHSTOP, 0xFFFU, LTDC_LxWHPCR_WHSPPOS_Pos);<\/b><\/span><\/p>\n<p class=\"\" style=\"font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">This line sets the window stop position value in the<\/span> <span style=\"color: #333399;\"><b>tmp<\/b><\/span><span style=\"font-weight: 400;\"> variable. It uses the <\/span><span style=\"color: #333399;\"><b>REG_SET_VAL<\/b> <\/span><span style=\"font-weight: 400;\">function, passing <\/span><span style=\"color: #333399;\"><b>tmp<\/b><\/span><span style=\"font-weight: 400;\"> as the target variable, <\/span><span style=\"color: #333399;\"><b>WHSTOP<\/b><\/span><span style=\"font-weight: 400;\"> as the value to be set, <\/span><span style=\"color: #333399;\"><b>0xFFFU<\/b><\/span><span style=\"font-weight: 400;\"> as the mask (to ensure the value fits within 12 bits), and <\/span><span style=\"color: #333399;\"><b>LTDC_LxWHPCR_WHSPPOS_Pos<\/b><\/span><span style=\"font-weight: 400;\"> as the position where the value should be placed within the <\/span><span style=\"color: #333399;\"><b>tmp<\/b><\/span><span style=\"font-weight: 400;\"> variable.<\/span><\/span><\/p>\n<p class=\"\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #800080;\"><b>REG_WRITE(tmp, player-&gt;WHPCR);<\/b><\/span><\/p>\n<p class=\"\" style=\"font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">This line writes the final windowing configuration value stored in <\/span><span style=\"color: #333399;\"><b>tmp<\/b><\/span><span style=\"font-weight: 400;\"> to the <\/span><span style=\"color: #333399;\"><b>WHPCR<\/b><\/span><span style=\"font-weight: 400;\"> (Window Horizontal Position Configuration Register) of the specified <\/span>player<span style=\"font-weight: 400;\">.<\/span><\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Overall, this code calculates the start and stop positions for the horizontal synchronization (windowing) of a layer in the LTDC module and writes the configuration to the appropriate register.<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-family: 'Roboto Slab'; font-weight: 400; font-size: 20px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000080;\"><b>FastBit Embedded Brain Academy Courses<\/b><\/span><\/p>\n<p class=\"\" style=\"font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\">Click here:<\/span>&nbsp;<span style=\"color: #0000ff;\"><a style=\"color: #0000ff;\" href=\"https:\/\/fastbitlab.com\/course1\" target=\"_blank\" rel=\"noopener\">https:\/\/fastbitlab.com\/course1<\/a><\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<\/div>\n<div class=\"col-lg-1 col-md-12 col-sm-12 col-xs-12\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; LTDC Layers initialization coding and windowing explanation &nbsp; In the previous article, we explored a few registers of the LTDC layers. In this article, let&#8217;s continue with our coding and create another function called &#8220;LTDC Layer Init&#8221;. This function will be responsible for initializing the LTDC layer according to our application requirements. &nbsp; To [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":14926,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ocean_post_layout":"","ocean_both_sidebars_style":"","ocean_both_sidebars_content_width":0,"ocean_both_sidebars_sidebars_width":0,"ocean_sidebar":"0","ocean_second_sidebar":"0","ocean_disable_margins":"enable","ocean_add_body_class":"","ocean_shortcode_before_top_bar":"","ocean_shortcode_after_top_bar":"","ocean_shortcode_before_header":"","ocean_shortcode_after_header":"","ocean_has_shortcode":"","ocean_shortcode_after_title":"","ocean_shortcode_before_footer_widgets":"","ocean_shortcode_after_footer_widgets":"","ocean_shortcode_before_footer_bottom":"","ocean_shortcode_after_footer_bottom":"","ocean_display_top_bar":"default","ocean_display_header":"default","ocean_header_style":"","ocean_center_header_left_menu":"0","ocean_custom_header_template":"0","ocean_custom_logo":0,"ocean_custom_retina_logo":0,"ocean_custom_logo_max_width":0,"ocean_custom_logo_tablet_max_width":0,"ocean_custom_logo_mobile_max_width":0,"ocean_custom_logo_max_height":0,"ocean_custom_logo_tablet_max_height":0,"ocean_custom_logo_mobile_max_height":0,"ocean_header_custom_menu":"0","ocean_menu_typo_font_family":"0","ocean_menu_typo_font_subset":"","ocean_menu_typo_font_size":0,"ocean_menu_typo_font_size_tablet":0,"ocean_menu_typo_font_size_mobile":0,"ocean_menu_typo_font_size_unit":"px","ocean_menu_typo_font_weight":"","ocean_menu_typo_font_weight_tablet":"","ocean_menu_typo_font_weight_mobile":"","ocean_menu_typo_transform":"","ocean_menu_typo_transform_tablet":"","ocean_menu_typo_transform_mobile":"","ocean_menu_typo_line_height":0,"ocean_menu_typo_line_height_tablet":0,"ocean_menu_typo_line_height_mobile":0,"ocean_menu_typo_line_height_unit":"","ocean_menu_typo_spacing":0,"ocean_menu_typo_spacing_tablet":0,"ocean_menu_typo_spacing_mobile":0,"ocean_menu_typo_spacing_unit":"","ocean_menu_link_color":"","ocean_menu_link_color_hover":"","ocean_menu_link_color_active":"","ocean_menu_link_background":"","ocean_menu_link_hover_background":"","ocean_menu_link_active_background":"","ocean_menu_social_links_bg":"","ocean_menu_social_hover_links_bg":"","ocean_menu_social_links_color":"","ocean_menu_social_hover_links_color":"","ocean_disable_title":"default","ocean_disable_heading":"default","ocean_post_title":"","ocean_post_subheading":"","ocean_post_title_style":"","ocean_post_title_background_color":"","ocean_post_title_background":0,"ocean_post_title_bg_image_position":"","ocean_post_title_bg_image_attachment":"","ocean_post_title_bg_image_repeat":"","ocean_post_title_bg_image_size":"","ocean_post_title_height":0,"ocean_post_title_bg_overlay":0.5,"ocean_post_title_bg_overlay_color":"","ocean_disable_breadcrumbs":"default","ocean_breadcrumbs_color":"","ocean_breadcrumbs_separator_color":"","ocean_breadcrumbs_links_color":"","ocean_breadcrumbs_links_hover_color":"","ocean_display_footer_widgets":"default","ocean_display_footer_bottom":"default","ocean_custom_footer_template":"0","ocean_post_oembed":"","ocean_post_self_hosted_media":"","ocean_post_video_embed":"","ocean_link_format":"","ocean_link_format_target":"self","ocean_quote_format":"","ocean_quote_format_link":"post","ocean_gallery_link_images":"off","ocean_gallery_id":[],"footnotes":""},"categories":[8],"tags":[],"class_list":["post-14922","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","entry","has-media"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>LTDC Layer Initialization and Windowing: Step-by-Step Guide<\/title>\n<meta name=\"description\" content=\"Initialize LTDC layers for graphics display with precise windowing configurations. Follow our coding examples to configure pixel formats,\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/fastbitlab.com\/blog\/ltdc-layer-initialization-and-windowing-step-by-step-guide\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"LTDC Layer Initialization and Windowing: Step-by-Step Guide\" \/>\n<meta property=\"og:description\" content=\"Initialize LTDC layers for graphics display with precise windowing configurations. Follow our coding examples to configure pixel formats,\" \/>\n<meta property=\"og:url\" content=\"https:\/\/fastbitlab.com\/blog\/ltdc-layer-initialization-and-windowing-step-by-step-guide\/\" \/>\n<meta property=\"og:site_name\" content=\"FastBit EBA\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/fastbiteba\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-06-26T05:02:16+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-08-17T11:12:11+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/06\/Figure-2-4.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1317\" \/>\n\t<meta property=\"og:image:height\" content=\"905\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"FastBitLab\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@fastbiteba\" \/>\n<meta name=\"twitter:site\" content=\"@fastbiteba\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"FastBitLab\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/ltdc-layer-initialization-and-windowing-step-by-step-guide\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/ltdc-layer-initialization-and-windowing-step-by-step-guide\\\/\"},\"author\":{\"name\":\"FastBitLab\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/person\\\/e32b38e733a0d76ffa7e6bc998652e5d\"},\"headline\":\"STM32-LTDC, LCD-TFT, LVGL(MCU3) Lecture 39| LTDC Layers initialization coding and windowing explanation\",\"datePublished\":\"2023-06-26T05:02:16+00:00\",\"dateModified\":\"2023-08-17T11:12:11+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/ltdc-layer-initialization-and-windowing-step-by-step-guide\\\/\"},\"wordCount\":1308,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/ltdc-layer-initialization-and-windowing-step-by-step-guide\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/06\\\/Figure-2-4.png\",\"articleSection\":[\"Blog\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/ltdc-layer-initialization-and-windowing-step-by-step-guide\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/ltdc-layer-initialization-and-windowing-step-by-step-guide\\\/\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/ltdc-layer-initialization-and-windowing-step-by-step-guide\\\/\",\"name\":\"LTDC Layer Initialization and Windowing: Step-by-Step Guide\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/ltdc-layer-initialization-and-windowing-step-by-step-guide\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/ltdc-layer-initialization-and-windowing-step-by-step-guide\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/06\\\/Figure-2-4.png\",\"datePublished\":\"2023-06-26T05:02:16+00:00\",\"dateModified\":\"2023-08-17T11:12:11+00:00\",\"description\":\"Initialize LTDC layers for graphics display with precise windowing configurations. Follow our coding examples to configure pixel formats,\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/ltdc-layer-initialization-and-windowing-step-by-step-guide\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/ltdc-layer-initialization-and-windowing-step-by-step-guide\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/ltdc-layer-initialization-and-windowing-step-by-step-guide\\\/#primaryimage\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/06\\\/Figure-2-4.png\",\"contentUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/06\\\/Figure-2-4.png\",\"width\":1317,\"height\":905,\"caption\":\"Figure 2. Layer window horizontal position configuration items\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/ltdc-layer-initialization-and-windowing-step-by-step-guide\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"STM32-LTDC, LCD-TFT, LVGL(MCU3) Lecture 39| LTDC Layers initialization coding and windowing explanation\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/\",\"name\":\"FastBit EBA\",\"description\":\"Your Online Academy of Embedded Systems\",\"publisher\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#organization\",\"name\":\"FastBit EBA\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/logo-EzNrEnyr.png\",\"contentUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/logo-EzNrEnyr.png\",\"width\":640,\"height\":640,\"caption\":\"FastBit EBA\"},\"image\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/fastbiteba\\\/\",\"https:\\\/\\\/x.com\\\/fastbiteba\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/fastbit-embedded-brain-academy-b3167b124\\\/\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCa1REBV9hyrzGp2mjJCagBg\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/person\\\/e32b38e733a0d76ffa7e6bc998652e5d\",\"name\":\"FastBitLab\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g\",\"caption\":\"FastBitLab\"},\"description\":\"The FastBit Embedded Brain Academy uses the power of internet to bring the online courses related to the field of embedded system programming, Real time operating system, Embedded Linux systems, etc at your finger tip with very low cost. Backed with strong experience of industry, we have produced lots of courses with the customer enrolment over 3000+ across 100+ countries.\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"LTDC Layer Initialization and Windowing: Step-by-Step Guide","description":"Initialize LTDC layers for graphics display with precise windowing configurations. Follow our coding examples to configure pixel formats,","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/fastbitlab.com\/blog\/ltdc-layer-initialization-and-windowing-step-by-step-guide\/","og_locale":"en_US","og_type":"article","og_title":"LTDC Layer Initialization and Windowing: Step-by-Step Guide","og_description":"Initialize LTDC layers for graphics display with precise windowing configurations. Follow our coding examples to configure pixel formats,","og_url":"https:\/\/fastbitlab.com\/blog\/ltdc-layer-initialization-and-windowing-step-by-step-guide\/","og_site_name":"FastBit EBA","article_publisher":"https:\/\/www.facebook.com\/fastbiteba\/","article_published_time":"2023-06-26T05:02:16+00:00","article_modified_time":"2023-08-17T11:12:11+00:00","og_image":[{"width":1317,"height":905,"url":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/06\/Figure-2-4.png","type":"image\/png"}],"author":"FastBitLab","twitter_card":"summary_large_image","twitter_creator":"@fastbiteba","twitter_site":"@fastbiteba","twitter_misc":{"Written by":"FastBitLab","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/fastbitlab.com\/blog\/ltdc-layer-initialization-and-windowing-step-by-step-guide\/#article","isPartOf":{"@id":"https:\/\/fastbitlab.com\/blog\/ltdc-layer-initialization-and-windowing-step-by-step-guide\/"},"author":{"name":"FastBitLab","@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/person\/e32b38e733a0d76ffa7e6bc998652e5d"},"headline":"STM32-LTDC, LCD-TFT, LVGL(MCU3) Lecture 39| LTDC Layers initialization coding and windowing explanation","datePublished":"2023-06-26T05:02:16+00:00","dateModified":"2023-08-17T11:12:11+00:00","mainEntityOfPage":{"@id":"https:\/\/fastbitlab.com\/blog\/ltdc-layer-initialization-and-windowing-step-by-step-guide\/"},"wordCount":1308,"commentCount":0,"publisher":{"@id":"https:\/\/fastbitlab.com\/blog\/#organization"},"image":{"@id":"https:\/\/fastbitlab.com\/blog\/ltdc-layer-initialization-and-windowing-step-by-step-guide\/#primaryimage"},"thumbnailUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/06\/Figure-2-4.png","articleSection":["Blog"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/fastbitlab.com\/blog\/ltdc-layer-initialization-and-windowing-step-by-step-guide\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/fastbitlab.com\/blog\/ltdc-layer-initialization-and-windowing-step-by-step-guide\/","url":"https:\/\/fastbitlab.com\/blog\/ltdc-layer-initialization-and-windowing-step-by-step-guide\/","name":"LTDC Layer Initialization and Windowing: Step-by-Step Guide","isPartOf":{"@id":"https:\/\/fastbitlab.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/fastbitlab.com\/blog\/ltdc-layer-initialization-and-windowing-step-by-step-guide\/#primaryimage"},"image":{"@id":"https:\/\/fastbitlab.com\/blog\/ltdc-layer-initialization-and-windowing-step-by-step-guide\/#primaryimage"},"thumbnailUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/06\/Figure-2-4.png","datePublished":"2023-06-26T05:02:16+00:00","dateModified":"2023-08-17T11:12:11+00:00","description":"Initialize LTDC layers for graphics display with precise windowing configurations. Follow our coding examples to configure pixel formats,","breadcrumb":{"@id":"https:\/\/fastbitlab.com\/blog\/ltdc-layer-initialization-and-windowing-step-by-step-guide\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/fastbitlab.com\/blog\/ltdc-layer-initialization-and-windowing-step-by-step-guide\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fastbitlab.com\/blog\/ltdc-layer-initialization-and-windowing-step-by-step-guide\/#primaryimage","url":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/06\/Figure-2-4.png","contentUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/06\/Figure-2-4.png","width":1317,"height":905,"caption":"Figure 2. Layer window horizontal position configuration items"},{"@type":"BreadcrumbList","@id":"https:\/\/fastbitlab.com\/blog\/ltdc-layer-initialization-and-windowing-step-by-step-guide\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/fastbitlab.com\/blog\/"},{"@type":"ListItem","position":2,"name":"STM32-LTDC, LCD-TFT, LVGL(MCU3) Lecture 39| LTDC Layers initialization coding and windowing explanation"}]},{"@type":"WebSite","@id":"https:\/\/fastbitlab.com\/blog\/#website","url":"https:\/\/fastbitlab.com\/blog\/","name":"FastBit EBA","description":"Your Online Academy of Embedded Systems","publisher":{"@id":"https:\/\/fastbitlab.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/fastbitlab.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/fastbitlab.com\/blog\/#organization","name":"FastBit EBA","url":"https:\/\/fastbitlab.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2026\/04\/logo-EzNrEnyr.png","contentUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2026\/04\/logo-EzNrEnyr.png","width":640,"height":640,"caption":"FastBit EBA"},"image":{"@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/fastbiteba\/","https:\/\/x.com\/fastbiteba","https:\/\/www.linkedin.com\/in\/fastbit-embedded-brain-academy-b3167b124\/","https:\/\/www.youtube.com\/channel\/UCa1REBV9hyrzGp2mjJCagBg"]},{"@type":"Person","@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/person\/e32b38e733a0d76ffa7e6bc998652e5d","name":"FastBitLab","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g","caption":"FastBitLab"},"description":"The FastBit Embedded Brain Academy uses the power of internet to bring the online courses related to the field of embedded system programming, Real time operating system, Embedded Linux systems, etc at your finger tip with very low cost. Backed with strong experience of industry, we have produced lots of courses with the customer enrolment over 3000+ across 100+ countries."}]}},"_links":{"self":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts\/14922","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/comments?post=14922"}],"version-history":[{"count":4,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts\/14922\/revisions"}],"predecessor-version":[{"id":15197,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts\/14922\/revisions\/15197"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/media\/14926"}],"wp:attachment":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/media?parent=14922"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/categories?post=14922"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/tags?post=14922"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}