Difference between revisions of "Unit ST77XX"

From Ultibo.org
Jump to: navigation, search
Line 34: Line 34:
 
----
 
----
  
''To be documented''
+
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''ST77XX specific constants''' <code> ST77XX_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>ST77XX_FRAMEBUFFER_DESCRIPTION = 'ST77XX TFT LCD DRIVER';</code>
 +
| Description of ST77XX device
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''ST77XX SPI''' <code> ST77XX_SPI_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>ST77XX_SPI_RATE = 32000000;</code>
 +
| Default SPI clock rate
 +
|-
 +
| <code>ST_CMD_DELAY = $80;</code>
 +
| Special signifier for command lists
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''ST77XX control command''' <code> ST77XX_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>ST77XX_NOP = $00;</code>
 +
| 8.2.1. NOP: No Operation
 +
|-
 +
| <code>ST77XX_SWRESET = $01;</code>
 +
| 8.2.2. SWRESET: Software Reset
 +
|-
 +
| <code>ST77XX_RDDID = $04;</code>
 +
| new_cmd
 +
|-
 +
| <code>ST77XX_RDDST = $09;</code>
 +
| new_cmd
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>ST77XX_SLPIN = $10;</code>
 +
| new_cmd
 +
|-
 +
| <code>ST77XX_SLPOUT = $11;</code>
 +
| 8.2.12. SLPOUT: Sleep Out (This command turns off sleep mode)
 +
|-
 +
| <code>ST77XX_PTLON = $12;</code>
 +
| new_cmd
 +
|-
 +
| <code>ST77XX_NORON = $13;</code>
 +
| new_cmd
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>ST77XX_INVOFF = $20;</code>
 +
| new_cmd
 +
|-
 +
| <code>ST77XX_INVON = $21;</code>
 +
| new_cmd
 +
|-
 +
| <code>ST77XX_GAMSET = $26;</code>
 +
| 8.2.17. GAMSET: Gamma Set (This command is used to select the desired Gamma curve for the current display)
 +
|-
 +
| <code>ST77XX_DISPOFF = $28;</code>
 +
| 8.2.18. DISPOFF: Display OFF (This command is used to enter into DISPLAY OFF mode. In this mode, the output from Frame Memory is disabled and blank page inserted)
 +
|-
 +
| <code>ST77XX_DISPON = $29;</code>
 +
| 8.2.19. DISPON: Display ON (This command is used to recover from DISPLAY OFF mode. Output from the Frame Memory is enabled)
 +
|-
 +
| <code>ST77XX_CASET = $2A;</code>
 +
| 8.2.20. CASET: Column Address Set (This command is used to define area of frame memory where MCU can access)
 +
|-
 +
| <code>ST77XX_RASET = $2B;</code>
 +
| 8.2.21. PASET: Page Address Set (This command is used to define area of frame memory where MCU can access)
 +
|-
 +
| <code>ST77XX_RAMWR = $2C;</code>
 +
| 8.2.22. Memory Write (This command is used to transfer data from MCU to frame memory)
 +
|-
 +
| <code>ST77XX_RGBSET = $2D;</code>
 +
| Color setting for 4096, 64K and 262K colors
 +
|-
 +
| <code>ST77XX_RAMRD = $2E;</code>
 +
| new_cmd
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>ST77XX_RDDPM = $0A;</code>
 +
| Read display power mode
 +
|-
 +
| <code>ST77XX_RDD_MADCTL = $0B;</code>
 +
| Read display MADCTL
 +
|-
 +
| <code>ST77XX_RDD_COLMOD = $0C;</code>
 +
| Read display pixel format
 +
|-
 +
| <code>ST77XX_RDDIM = $0D;</code>
 +
| Read display image mode
 +
|-
 +
| <code>ST77XX_RDDSM = $0E;</code>
 +
| Read display signal mode
 +
|-
 +
| <code>ST77XX_RDDSR = $0F;</code>
 +
| Read display self-diagnostic result (ST7789V)
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>ST77XX_PTLAR = $30;</code>
 +
| new_cmd
 +
|-
 +
| <code>ST77XX_VSCRDEF = $33;</code>
 +
| Vertical scrolling definition (ST7789V)
 +
|-
 +
| <code>ST77XX_TEOFF = $34;</code>
 +
| Tearing effect line off
 +
|-
 +
| <code>ST77XX_TEON = $35;</code>
 +
| Tearing effect line on
 +
|-
 +
| <code>ST77XX_MADCTL = $36;</code>
 +
| 8.2.29. MADCTL: Memory Access Control (This command defines read/write scanning direction of frame memory)
 +
|-
 +
| <code>ST77XX_IDMOFF = $38;</code>
 +
| Idle mode off
 +
|-
 +
| <code>ST77XX_IDMON = $39;</code>
 +
| Idle mode on
 +
|-
 +
| <code>ST77XX_RAMWRC = $3C;</code>
 +
| Memory write continue (ST7789V)
 +
|-
 +
| <code>ST77XX_RAMRDC = $3E;</code>
 +
| Memory read continue (ST7789V)
 +
|-
 +
| <code>ST77XX_COLMOD = $3A;</code>
 +
| 8.2.33. COLMOD: Pixel Format Set (This command sets the pixel format for the RGB image data used by the interface)
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''ST77XX memory access control''' <code> ST77XX_*CTL_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|''See ST77XX datasheet 8.2.29. Memory Access Control''
 +
|-
 +
| <code>ST77XX_MADCTL_MY = $80;</code>
 +
| Row Address Order
 +
|-
 +
| <code>ST77XX_MADCTL_MX = $40;</code>
 +
| Column Address Order
 +
|-
 +
| <code>ST77XX_MADCTL_MV = $20;</code>
 +
| Row / Column Exchange
 +
|-
 +
| <code>ST77XX_MADCTL_ML = $10;</code>
 +
| Row / Column Exchange
 +
|-
 +
| <code>ST77XX_MADCTL_MH = $04;</code>
 +
| Horizontal Refresh Order
 +
|-
 +
| <code>ST77XX_MADCTL_RGB = $00;</code>
 +
| Colour selector switch control (0=RGB colour filter panel, 1=BGR colour filter panel)
 +
|-
 +
| <code>ST77XX_MADCTL_BGR = $08;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>ST77XX_RAMCTRL = $B0;</code>
 +
| RAM control
 +
|-
 +
| <code>ST77XX_RGBCTRL = $B1;</code>
 +
| RGB control
 +
|-
 +
| <code>ST77XX_PORCTRL = $B2;</code>
 +
| Porch control
 +
|-
 +
| <code>ST77XX_FRCTR1 = $B3;</code>
 +
| 8.3.2. FRCTR1: Frame Rate Control (In Normal Mode/Full Colors)
 +
|-
 +
| <code>ST77XX_PARCTRL = $B5;</code>
 +
| Partial mode control
 +
|-
 +
| <code>ST77XX_GCTRL = $B7;</code>
 +
| Gate control
 +
|-
 +
| <code>ST77XX_GTADJ = $B8;</code>
 +
| Gate on timing adjustment
 +
|-
 +
| <code>ST77XX_DGMEN = $BA;</code>
 +
| Digital gamma enable
 +
|-
 +
| <code>ST77XX_VCOMS = $BB;</code>
 +
| VCOMS setting
 +
|-
 +
| <code>ST77XX_DISCTRL = $B6;</code>
 +
| 8.3.7. DISCTRL: Display Function Control
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>ST77XX_LCMCTRL = $C0;</code>
 +
| LCM control
 +
|-
 +
| <code>ST77XX_IDSET = $C1;</code>
 +
| ID setting
 +
|-
 +
| <code>ST77XX_VDVVRHEN = $C2;</code>
 +
| VDV and VRH command enable
 +
|-
 +
| <code>ST77XX_VRHS = $C3;</code>
 +
| VRH set
 +
|-
 +
| <code>ST77XX_VDVSET = $C4;</code>
 +
| VDV setting
 +
|-
 +
| <code>ST77XX_VCMOFSET = $C5;</code>
 +
| VCOMS offset set
 +
|-
 +
| <code>ST77XX_FRCTR2 = $C6;</code>
 +
| FR Control 2
 +
|-
 +
| <code>ST77XX_CABCCTRL = $C7;</code>
 +
| CABC control
 +
|-
 +
| <code>ST77XX_REGSEL1 = $C8;</code>
 +
| Register value section 1
 +
|-
 +
| <code>ST77XX_REGSEL2 = $CA;</code>
 +
| Register value section 2
 +
|-
 +
| <code>ST77XX_PWMFRSEL = $CC;</code>
 +
| PWM frequency selection
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>ST77XX_PWCTRL1 = $D0;</code>
 +
| 8.3.16. PWCTRL1: Power Control 1
 +
|-
 +
| <code>ST77XX_VAPVANEN = $D2;</code>
 +
| Enable VAP/VAN signal output
 +
|-
 +
| <code>ST77XX_CMD2EN = $DF;</code>
 +
| Command 2 enable
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>ST77XX_VMCTRL1 = $C5;</code>
 +
| 8.3.21. VMCTRL1: VCOM Control 1
 +
|-
 +
| <code>ST77XX_VMCTRL2 = $C7;</code>
 +
| 8.3.22. VMCTRL2: VCOM Control 2
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>ST77XX_PGAMCTRL = $E0;</code>
 +
| Positive voltage gamma control
 +
|-
 +
| <code>ST77XX_NGAMCTRL = $E1;</code>
 +
| Negative voltage gamma control
 +
|-
 +
| <code>ST77XX_DGMLUTR = $E2;</code>
 +
| Digital gamma look-up table for red
 +
|-
 +
| <code>ST77XX_DGMLUTB = $E3;</code>
 +
| Digital gamma look-up table for blue
 +
|-
 +
| <code>ST77XX_GATECTRL = $E4;</code>
 +
| Gate control
 +
|-
 +
| <code>ST77XX_SPI2EN = $E7;</code>
 +
| SPI2 enable
 +
|-
 +
| <code>ST77XX_PWCTRL2 = $E8;</code>
 +
| Power control 2
 +
|-
 +
| <code>ST77XX_EQCTRL = $E9;</code>
 +
| Equalize time control
 +
|-
 +
| <code>ST77XX_PROMCTRL = $EC;</code>
 +
| Program control
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>ST77XX_PROMEN = $FA;</code>
 +
| Program mode enable
 +
|-
 +
| <code>ST77XX_NVMSET = $FC;</code>
 +
| NVM setting
 +
|-
 +
| <code>ST77XX_PROMACT = $FE;</code>
 +
| Program action
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>ST77XX_COLOR_MODE_16bit =$55;</code>
 +
| &nbsp;
 +
|-
 +
| <code>ST77XX_COLOR_MODE_18bit =$66;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
  
 
=== Type definitions ===
 
=== Type definitions ===

Revision as of 05:19, 14 November 2023

Return to Unit Reference


Description


Sitronix ST77XX TFT LCD Driver unit

The ST77XX is a family of single-chip controllers/drivers for color, graphic type TFT-LCD display.

Instantiate the ST77XX driver by calling ST77XXFramebufferCreate() with the required parameters:

SPI: The SPI device that this ST77XX is connected to

ChipSelect: The SPI chip select to use when communicating with this device

Name: The text description of this device which will show in the device list (Optional)

Rotation: The rotation value for the framebuffer device (eg FRAMEBUFFER_ROTATION_180)

Width: The width of the framebuffer in pixels

Height: The height of the framebuffer in pixels

ColStart:

RST: GPIO pin information for the Reset pin (Optional)

DC: GPIO pin information for the Data/Command pin

BL: GPIO pin information for the Backlight pin (Optional)

Constants



ST77XX specific constants ST77XX_*
ST77XX_FRAMEBUFFER_DESCRIPTION = 'ST77XX TFT LCD DRIVER'; Description of ST77XX device


ST77XX SPI ST77XX_SPI_*
ST77XX_SPI_RATE = 32000000; Default SPI clock rate
ST_CMD_DELAY = $80; Special signifier for command lists


ST77XX control command ST77XX_*
ST77XX_NOP = $00; 8.2.1. NOP: No Operation
ST77XX_SWRESET = $01; 8.2.2. SWRESET: Software Reset
ST77XX_RDDID = $04; new_cmd
ST77XX_RDDST = $09; new_cmd
 
ST77XX_SLPIN = $10; new_cmd
ST77XX_SLPOUT = $11; 8.2.12. SLPOUT: Sleep Out (This command turns off sleep mode)
ST77XX_PTLON = $12; new_cmd
ST77XX_NORON = $13; new_cmd
 
ST77XX_INVOFF = $20; new_cmd
ST77XX_INVON = $21; new_cmd
ST77XX_GAMSET = $26; 8.2.17. GAMSET: Gamma Set (This command is used to select the desired Gamma curve for the current display)
ST77XX_DISPOFF = $28; 8.2.18. DISPOFF: Display OFF (This command is used to enter into DISPLAY OFF mode. In this mode, the output from Frame Memory is disabled and blank page inserted)
ST77XX_DISPON = $29; 8.2.19. DISPON: Display ON (This command is used to recover from DISPLAY OFF mode. Output from the Frame Memory is enabled)
ST77XX_CASET = $2A; 8.2.20. CASET: Column Address Set (This command is used to define area of frame memory where MCU can access)
ST77XX_RASET = $2B; 8.2.21. PASET: Page Address Set (This command is used to define area of frame memory where MCU can access)
ST77XX_RAMWR = $2C; 8.2.22. Memory Write (This command is used to transfer data from MCU to frame memory)
ST77XX_RGBSET = $2D; Color setting for 4096, 64K and 262K colors
ST77XX_RAMRD = $2E; new_cmd
 
ST77XX_RDDPM = $0A; Read display power mode
ST77XX_RDD_MADCTL = $0B; Read display MADCTL
ST77XX_RDD_COLMOD = $0C; Read display pixel format
ST77XX_RDDIM = $0D; Read display image mode
ST77XX_RDDSM = $0E; Read display signal mode
ST77XX_RDDSR = $0F; Read display self-diagnostic result (ST7789V)
 
ST77XX_PTLAR = $30; new_cmd
ST77XX_VSCRDEF = $33; Vertical scrolling definition (ST7789V)
ST77XX_TEOFF = $34; Tearing effect line off
ST77XX_TEON = $35; Tearing effect line on
ST77XX_MADCTL = $36; 8.2.29. MADCTL: Memory Access Control (This command defines read/write scanning direction of frame memory)
ST77XX_IDMOFF = $38; Idle mode off
ST77XX_IDMON = $39; Idle mode on
ST77XX_RAMWRC = $3C; Memory write continue (ST7789V)
ST77XX_RAMRDC = $3E; Memory read continue (ST7789V)
ST77XX_COLMOD = $3A; 8.2.33. COLMOD: Pixel Format Set (This command sets the pixel format for the RGB image data used by the interface)


ST77XX memory access control ST77XX_*CTL_*
See ST77XX datasheet 8.2.29. Memory Access Control
ST77XX_MADCTL_MY = $80; Row Address Order
ST77XX_MADCTL_MX = $40; Column Address Order
ST77XX_MADCTL_MV = $20; Row / Column Exchange
ST77XX_MADCTL_ML = $10; Row / Column Exchange
ST77XX_MADCTL_MH = $04; Horizontal Refresh Order
ST77XX_MADCTL_RGB = $00; Colour selector switch control (0=RGB colour filter panel, 1=BGR colour filter panel)
ST77XX_MADCTL_BGR = $08;  
 
ST77XX_RAMCTRL = $B0; RAM control
ST77XX_RGBCTRL = $B1; RGB control
ST77XX_PORCTRL = $B2; Porch control
ST77XX_FRCTR1 = $B3; 8.3.2. FRCTR1: Frame Rate Control (In Normal Mode/Full Colors)
ST77XX_PARCTRL = $B5; Partial mode control
ST77XX_GCTRL = $B7; Gate control
ST77XX_GTADJ = $B8; Gate on timing adjustment
ST77XX_DGMEN = $BA; Digital gamma enable
ST77XX_VCOMS = $BB; VCOMS setting
ST77XX_DISCTRL = $B6; 8.3.7. DISCTRL: Display Function Control
 
ST77XX_LCMCTRL = $C0; LCM control
ST77XX_IDSET = $C1; ID setting
ST77XX_VDVVRHEN = $C2; VDV and VRH command enable
ST77XX_VRHS = $C3; VRH set
ST77XX_VDVSET = $C4; VDV setting
ST77XX_VCMOFSET = $C5; VCOMS offset set
ST77XX_FRCTR2 = $C6; FR Control 2
ST77XX_CABCCTRL = $C7; CABC control
ST77XX_REGSEL1 = $C8; Register value section 1
ST77XX_REGSEL2 = $CA; Register value section 2
ST77XX_PWMFRSEL = $CC; PWM frequency selection
 
ST77XX_PWCTRL1 = $D0; 8.3.16. PWCTRL1: Power Control 1
ST77XX_VAPVANEN = $D2; Enable VAP/VAN signal output
ST77XX_CMD2EN = $DF; Command 2 enable
 
ST77XX_VMCTRL1 = $C5; 8.3.21. VMCTRL1: VCOM Control 1
ST77XX_VMCTRL2 = $C7; 8.3.22. VMCTRL2: VCOM Control 2
 
ST77XX_PGAMCTRL = $E0; Positive voltage gamma control
ST77XX_NGAMCTRL = $E1; Negative voltage gamma control
ST77XX_DGMLUTR = $E2; Digital gamma look-up table for red
ST77XX_DGMLUTB = $E3; Digital gamma look-up table for blue
ST77XX_GATECTRL = $E4; Gate control
ST77XX_SPI2EN = $E7; SPI2 enable
ST77XX_PWCTRL2 = $E8; Power control 2
ST77XX_EQCTRL = $E9; Equalize time control
ST77XX_PROMCTRL = $EC; Program control
 
ST77XX_PROMEN = $FA; Program mode enable
ST77XX_NVMSET = $FC; NVM setting
ST77XX_PROMACT = $FE; Program action
 
ST77XX_COLOR_MODE_16bit =$55;  
ST77XX_COLOR_MODE_18bit =$66;  


Type definitions


To be documented

Public variables


None defined

Function declarations


To be documented


Return to Unit Reference