STM32F7 18 LCD-TFT display controller (LTDC)

Started by tha, December 08, 2022, 08:38:41 AM

Previous topic - Next topic

tha

Layer blending

The blending จะทำงานตลอดเวลาและ the two layers สามารถถูกผสมตาม the blending factors ที่กำหนดค่าผ่านทาง the LTDC_LxBFCR register.

The blending order ถูกคงที่และจากล่างขึ้นบน. ถ้า two layers ถูกเปิดใช้งาน, อันดับแรก the Layer1 ถูกผสมกับ the Background color, จากนั้น the layer2 จะถูกผสมกับผลของ blended color ของ layer1 and the background. ดูที่ Figure 114.


tha

Default color

ทุก layer สามารถมี a default color ใน the format ARGB ซึ่งถูกใช้ภายนอก the defined layer window และเมื่อ a layer ถูกปิดใช้งาน.

The default color ถูกกำหนดค่าผ่านทาง the LTDC_LxDCCR register.

The blending ถูกดำเนินการระหว่าง the two layers เสมอแม้เมื่อ a layer ถูกปิดใช้งาน. เพื่อหลีกเลี่ยงการแสดงผล the default color เมื่อ a layer ถูกปิดใช้งาน, เก็บ the blending factors ของ layer นี้ใน the LTDC_LxBFCR register เป็น their reset value.

tha

Color keying

A color key (RGB) สามารถถูกกำหนดค่าให้เป็นตัวแทนของ a transparent pixel

ถ้า the color keying ถูกเปิดใช้งาน, the current pixels (หลังจาก format conversion และก่อน CLUT การผสมตามลำดับ) จะถูกเปรียบเทียบกับ the color key. ถ้าพวกมันตรงกับ the programmed RGB value, ทุก channels (ARGB) ของ pixel นั้นจะถูกเซ็ตเป็น 0.

The color key value สามารถถูกกำหนดค่าและถูกใช้ในขณะ run-time เพื่อแทนที่ the pixel RGB value.

The color keying ถูกเปิดใช้งานผ่านทาง the LTDC_LxCKCR register.

The color keying ถูกกำหนดค่าผ่านทาง the LTDC_LxCKCR register. ค่าที่โปรแกรมจะขึ้นอยู่กับ the pixel format เนื่องจากมันจะถูกเปรียบเทียบกับ current pixel หลังจาก pixel format conversion เป็น ARGB888.

ตัวอย่าง: ถ้า the a mid-yellow color (50% red + 50% green) ถูกใช้เป็น the transparent color key:
•   ใน RGB565, the mid-yellow color คือ 0x8400. เซ็ต the LTDC_LxCKCR เป็น 0x848200.
•   ใน ARGB8888, the mid-yellow color คือ 0x808000, เซ็ต LTDC_LxCKCR เป็น 0x808000.
•   ในทุก CLUT-based color modes (L8, AL88, AL44), เซ็ตหนึ่งใน the palette entry เป็น the mid-yellow color 0x808000
     และเซ็ต the LTDC_LxCKCR เป็น 0x808000.


tha

18.5 LTDC interrupts

The LTDC จัดให้มี four maskable interrupts ลอจิก OR เป็น two interrupt vectors.

The interrupt sources สามารถถูกเปิดใช้งานหรือถูกปิดใช้งานแยกกันผ่านทาง the LTDC_IER register. การเซ็ต the appropriate mask bit เป็น 1 จะเปิดใช้งาน the corresponding interrupt.

The two interrupts ถูกสร้างบน the following events:
•   Line interrupt: ถูกสร้างเมื่อ a programmed line ถูกถึง. The line interrupt position ถูกโปรแกรมใน the LTDC_LIPCR
     register
•   Register reload interrupt: ถูกสร้างเมื่อ the shadow registers reload ถูกดำเนินการแล้วในระหว่าง the vertical blanking
     period
•   FIFO underrun interrupt: ถูกสร้างเมื่อ a pixel ถูกร้องขอจาก an empty layer FIFO
•   Transfer error interrupt: ถูกสร้างเมื่อ an AHB bus error เกิดขึ้นในระหว่าง data transfer

interrupts events เหล่านี้ถูกต่อกับ the NVIC controller ดังอธิบายใน Figure 115.


tha

18.6 LTDC programming procedure

•   เปิดใช้งาน the LTDC clock ใน the RCC register.
•   กำหนดค่า the required pixel clock ตาม the panel datasheet.
•   กำหนดค่า the synchronous timings: VSYNC, HSYNC, vertical and horizontal back porch, active data area and the
     front porch timings ตาม the panel datasheet ดังที่อธิบายใน the Section 18.4.1: LTDC global configuration
     parameters.
•   กำหนดค่า the synchronous signals และ clock polarity ใน the LTDC_GCR register.
•   ถ้าจำเป็น, กำหนดค่า the background color ใน the LTDC_BCCR register.
•   กำหนดค่า the needed interrupts ใน the LTDC_IER and LTDC_LIPCR register.

tha

•   กำหนดค่า the layer1/2 parameters โดย:
     –   โปรแกรม the layer window horizontal and vertical position ใน the LTDC_LxWHPCR and LTDC_WVPCR
          registers. The layer window ต้องอยู่ใน the active data area.
     –   โปรแกรม the pixel input format ใน the LTDC_LxPFCR register
     –   โปรแกรม the color frame buffer start address ใน the LTDC_LxCFBAR register
     –   โปรแกรม the line length และ pitch of the color frame buffer ใน the LTDC_LxCFBLR register
     –   โปรแกรม the number of lines of the color frame buffer ใน the LTDC_LxCFBLNR register
     –   ถ้าจำเป็น, โหลด the CLUT ด้วย the RGB values และ address ของมันใน the LTDC_LxCLUTWR register
     –   ถ้าจำเป็น, กำหนดค่า the default color และ the blending factors ตามลำดับใน the LTDC_LxDCCR and LTDC_LxBFCR
          registers

tha

•   เปิดใช้งาน layer1/2 และถ้าจำเป็น the CLUT ใน the LTDC_LxCR register.
•   ถ้าจำเป็น, เปิดใช้งาน dithering and color keying ตามลำดับใน the LTDC_GCR and LTDC_LxCKCR registers. พวกมัน
     สามารถถูกเปิดใช้งานกลางทางได้อีกด้วย.
•   โหลดซ้ำ the shadow registers ไปยัง active register ผ่านทาง the LTDC_SRCR register.
•   เปิดใช้งาน the LCD-TFT controller ใน the LTDC_GCR register.
•   ทุก layer parameters สามารถถูกแก้ไขกลางทางได้ยกเว้น the CLUT. The new configuration ต้องอย่างใดอย่างหนึ่ง ถูกโหลดซ้ำ
     โดยทันทีหรือในระหว่าง vertical blanking period โดยการกำหนดค่า the LTDC_SRCR register.

Note: ทุก layer's registers ถูก shadowed. ทันทีที่ a register ถูกเขียน, มันต้องไม่ถูกแก้ไขอีกก่อน the reload ถูกทำ. ดังนั้น, a
          new write ไปยัง the same register จะข้าม the previous configuration ถ้ายังไม่ถูกโหลดซ้ำ.

tha

18.7 LTDC registers

18.7.1 LTDC synchronization size configuration register (LTDC_SSCR)

รีจีสเตอร์นี้กำหนดจำนวนของ horizontal synchronization pixels ลบ 1 และจำนวนของ vertical synchronization lines ลบ 1. ดูที่ Figure 112 and Section 18.4: LTDC programmable parameters สำหรับตัวอย่างของการกำหนดค่า.

Address offset: 0x08
Reset value: 0x0000 0000



Bits 31:28 Reserved, must be kept at reset value.

Bits 27:16 HSW[11:0]: horizontal synchronization width (in units of pixel clock period)
     บิตเหล่านี้กำหนดจำนวนของ Horizontal Synchronization pixel ลบ 1.

Bits 15:11 Reserved, must be kept at reset value.

Bits 10:0 VSH[10:0]: vertical synchronization height (in units of horizontal scan line)
     บิตเหล่านี้กำหนด the vertical Synchronization height ลบ 1. มันแสดงถึงจำนวนของ horizontal synchronization lines.