Use the K2 LCD: Difference between revisions

From F256 Foenix
Jump to navigationJump to search
No edit summary
m (→‎Commands for LCD_CMD_CMD: relabelled a table's column labrl)
Line 34: Line 34:
|+
|+
!Command Name
!Command Name
!Address
!Value
!Description
!Description
|-
|-

Revision as of 06:41, 6 February 2025

The LCD is part of the F256K2 enclosure

The LCD embedded in the enclosure is Sitronix ST7789. The full resolution is 240 pixels wide, 320 pixels high. However, there's a 20 pixel high band at the top and a 20 pixel high band at the bottom which are covered, so the visible usable part is 240x280.

Registers

Register Name Address Description
LCD_CMD_CMD 0xDD40 Write Command Here
LCD_CMD_DTA 0xDD41 Write Data (For Command) Here; Always Write in pairs (to LCD_PIX_LO and LCD_PIX_HI), otherwise the State Machine will Lock
LCD_PIX_LO 0xDD42 {G[2:0], B[4:0]}
LCD_PIX_HI 0xDD43 {R[4:0], G[5:3]}

Commands for LCD_CMD_CMD

Command Name Value Description
LCD_RST 0x10 0 to Reset (RSTn)
LCD_BL 0x20 1 = ON, 0 = OFF
LCD_WIN_X 0x2A define window X
LCD_WIN_Y 0x2B define window Y
LCD_WRI 0x2C {R[4:0], G[5:3]}

Compatible image format

You can send in a .bmp image exported in R5 G6 B5 color palette, converted into a raw 2 byte/per/pixel binary file. The R5 G6 B5 palette expects color information in this format:

High byte__ Low byte

RRRRRGGG GGGBBBBBB


The process goes as:

1) Use gimp (or equivalent alternative) and export your image as 'Windows BMP Image', but go to advanced options

2) select 16 bit, R5 G6 B5 for the color

3) run my python script to convert it to a raw binary found at https://github.com/Mu0n/F256MiscGoodies/tree/main in /tools/

4) for every pixel, send 2 bytes of data to the LCD_PIX_LO and LCD_PIX_HI registers found in the table above

5) you can find some example code from my C github repo here, which sends an image to the LCD screen and then idles.