emWin driver GUIDRV_FlexColor
Supported hardware
Controllers
This driver works with the following display controllers:
- Epson S1D19122
- FocalTech FT1509
- Himax HX8347, HX8352, HX8353, HX8325A
- Ilitek ILI9320, ILI9325, ILI9328, ILI9340, ILI9342, ILI9481
- LG Electronics LGDP4531, LGDP4551
- Novatek NT39122
- OriseTech SPFD5408, SPFD54124C, SPFD5414D
- Renesas R61505, R61516, R61526, R61580
- Sitronix ST7628, ST7637, ST7735
- Solomon SSD1355, SSD1961, SSD1963, SSD2119
- Syncoam SEPS525
Bits per pixel
Supported color depth is 16 bpp and 18 bpp.
Interfaces
The driver supports 8-bit, 9-bit and 16-bit indirect interface.
Driver selection
To be able to use this driver the following call has to be made:
pDevice = GUI_DEVICE_CreateAndLink(GUIDRV_FLEXCOLOR, COLOR_CONVERSION, 0, Layer);
Display data RAM organization

RAM requirements
This display driver requires app. 500 Bytes to work. It can also be used with and without a display data cache, containing a complete copy of the content of the display data RAM. The amount of memory used by the cache is:
LCD_XSIZE * LCD_YSIZE * BytesPerPixel
BytesPerPixel is 2 for 16bpp mode and 4 for 18bpp mode. Using a cache avoids reading operations from the display controller in case of XOR drawing operations and further it speeds up string output operations.
Configuration routines
| Routine | Description |
|---|---|
| GUIDRV_FlexColor_SetFunc | Configures bus, cache and hardware routines. |
| GUIDRV_FlexColor_Config() | Configures orientation and offset of the SEG- and COM-lines. |
GUIDRV_FlexColor_SetFunc()
Description
Configures bus width, cache usage and hardware routines.
Prototype
void GUIDRV_FlexColor_SetFunc(GUI_DEVICE * pDevice,
GUI_PORT_API * pHW_API,
void (* pfFunc)(GUI_DEVICE * pDevice),
void (* pfMode)(GUI_DEVICE * pDevice));
| Parameter | Description |
|---|---|
| pDevice | Pointer to the driver device structure. |
| pHW_API | Pointer to a GUI_PORT_API structure. See required routines below. |
| pfFunc | Controller selection macro. See table below. |
| pfMode | See table below. |
| Permitted values for parameter pfFunc Supported display controller | |
|---|---|
| GUIDRV_FLEXCOLOR_F66708 | Set up the driver to use one of the following controllers:
|
| GUIDRV_FLEXCOLOR_F66709 | Set up the driver to use one of the following controllers:
|
| GUIDRV_FLEXCOLOR_F66712 | Set up the driver to use one of the following controllers:
|
| GUIDRV_FLEXCOLOR_F66714 | Set up the driver to use the following controller:
|
| GUIDRV_FLEXCOLOR_F66718 | Set up the driver to use the following controller:
|
The display controllers listed in the table above are the currently known controllers compatible to the driver. Please note that the used numbers of the selection macros are compatible to some of the LCD_CONTROLLER macro of the driver GUIDRV_CompactColor_16. This makes it easy to migrate from the compile time configurable GUIDRV_CompactColor_16 to the runtime configurable GUIDRV_FlexColor.
| Permitted values for parameter pfMode | |
|---|---|
| GUIDRV_FLEXCOLOR_M16C0B8 | 16bpp, no cache, 8 bit bus |
| GUIDRV_FLEXCOLOR_M16C1B8 | 16bpp, cache, 8 bit bus |
| GUIDRV_FLEXCOLOR_M16C0B16 | 16bpp, no cache, 16 bit bus |
| GUIDRV_FLEXCOLOR_M16C1B16 | 16bpp, cache, 16 bit bus |
| GUIDRV_FLEXCOLOR_M18C0B9 | 18bpp, no cache, 9 bit bus |
| GUIDRV_FLEXCOLOR_M18C1B9 | 18bpp, cache, 9 bit bus |
Each controller selection supports different operation modes. The table below shows the supported modes for each controller:
| Selection macro | M16C0B8 | M16C1B8 | M16C0B16 | M16C1B16 | M18C0B9 | M18C1B9 |
|---|---|---|---|---|---|---|
| GUIDRV_FLEXCOLOR_F66708 | X | X | X | X | - | - |
| GUIDRV_FLEXCOLOR_F66709 | X | X | X | X | - | - |
| GUIDRV_FLEXCOLOR_F66714 | X | X | X | X | X | X |
| GUIDRV_FLEXCOLOR_F66718 | X | X | X | X | X | X |
Required GUI_PORT_API routines
The required GUI_PORT_API routines depend on the used interface. In case a cache is used the routines for reading data are unnecessary for each interface:
8 bit interface
| Element | Data type |
|---|---|
| pfWrite8_A0 | void (*)(U8 Data) |
| pfWrite8_A1 | void (*)(U8 Data) |
| pfWriteM8_A1 | void (*)(U8 * pData, int NumItems) |
| pfReadM8_A1 | void (*)(U8 * pData, int NumItems) |
16 bit interface
| Element | Data type |
|---|---|
| pfWrite16_A0 | void (*)(U16 Data) |
| pfWrite16_A1 | void (*)(U16 Data) |
| pfWriteM16_A1 | void (*)(U16 * pData, int NumItems) |
| pfReadM16_A1 | void (*)(U16 * pData, int NumItems) |
9 bit interface
When working with a 9 bit interface and a color depth of 18 bpp the display controller uses the lines D10-D17 (8 bit) for passing instructions and D9-D17 (9 bit) for passing data. So in this case the lines D9-D17 are connected to the interface lines of the CPU. In order to be able to process pixel data as fast as possible, the driver uses two 16 bit data values per pixel (0000000R RRRRRGGG and 0000000G GGBBBBBB) in which only the first 9 bits each contain pixel data, which are passed to the hardware routines.
As mentioned above the command and parameter interface use the lines D10-D17 (8 bit) of the display controller. The driver passes 16 bit values to the hardware routines where the bits 1-8 already contain the information for the lines D10-D17 of the display controller (bits 0 and 9-15 are unused). So no shift operation is required in the hardware routines.
| Element | Data type | Description |
|---|---|---|
| pfWrite16_A0 | void (*)(U16 Data) | Register to be set (DB1-DB9) |
| pfWrite16_A1 | void (*)(U16 Data) | Parameter to be set (DB1-DB9) |
| pfWriteM16_A1 | void (*)(U16 * pData, int NumItems) | Data to be written (DB0-DB9) |
| pfReadM16_A1 | void (*)(U16 * pData, int NumItems) | Data read (DB0-DB9) |
GUIDRV_FlexColor_Config()
Description
Configures orientation and offset of the SEG- and COM-lines.
Prototype
void GUIDRV_FlexColor_Config(GUI_DEVICE * pDevice, CONFIG_FLEXCOLOR * pConfig);
| Parameter | Description |
|---|---|
| pDevice | Pointer to the device to configure. |
| pConfig | Pointer to a CONFIG_FLEXCOLOR structure. See element list below. |
Elements of CONFIG_FLEXCOLOR
| Data type | Element | Description |
|---|---|---|
| int | FirstSEG | First segment line. |
| int | FirstCOM | First common line. |
| int | Orientation | One or more "OR" combined values of the table below. |
| U16 | RegEntryMode | Normally the display controller uses 3 bits of one register to define the required display orientation. Normally these are the bits ID0, ID1 and AM. To be able to control the content of the other bits the RegEntryMode element can be used. The driver combines this value with the required orientation bits during the initialization process. |
| Permitted values for parameter Orientation | |
|---|---|
| GUI_MIRROR_X | Mirroring the X-axis. |
| GUI_MIRROR_Y | Mirroring the Y-axis. |
| GUI_SWAP_XY | Swapping X- and Y-axis. |
GUIDRV_FlexColor
