The ET024006DHU is a RGB LCD display from EDT and it offers a resolution of 240x320 pixels.
The driver uses the display in a 16-bit mode however each pixel has a resolution of 18 bits (6 bits for each color). In 16-bit mode red and blue have 5-bit while green has 6-bit resolution. The display offers a parallel and a serial interface currently only the parallel mode is implemented in the driver.
Macros | |
#define | BLACK 0x0000 |
#define | BLUE 0x001F |
#define | BLUE_LEV(level) ( (level)&BLUE ) |
#define | ET024006_BITMAP_WIDTH(width) Align_up(width/8, 8) |
#define | ET024006_HEIGHT 240 |
#define | ET024006_IFACE_MODE_EBI 0 |
#define | ET024006_IFACE_MODE_SPI 1 |
#define | ET024006_WIDTH 320 |
#define | GRAY_LEV(level) ( BLUE_LEV(level) | GREEN_LEV(level) | RED_LEV(level) ) |
#define | GREEN 0x07E0 |
#define | GREEN_LEV(level) ( (((level)*2)<<5)&GREEN ) |
#define | RED 0xF800 |
#define | RED_LEV(level) ( ((level)<<(5+6))&RED ) |
#define | WHITE 0xFFFF |
Typedefs | |
typedef uint16_t | et024006_color_t |
Datatype color information. More... | |
Functions | |
et024006_color_t | et024006_Color (uint8_t r, uint8_t g, uint8_t b) |
Converts a RGB 8:8:8 color to RGB 5:6:5. More... | |
void | et024006_CopyPixelsFromScreen (et024006_color_t *pixels, uint32_t count) |
void | et024006_CopyPixelsToScreen (et024006_color_t const *pixels, uint32_t count) |
void | et024006_DrawBitmap (const uint16_t data[], uint16_t columnOffset, uint16_t rowOffset) |
void | et024006_DrawFilledCircle (uint16_t x, uint16_t y, uint16_t radius, uint16_t color, uint8_t quadrantMask) |
void | et024006_DrawFilledRect (uint16_t x, uint16_t y, uint16_t width, uint16_t height, et024006_color_t color) |
void | et024006_DrawHorizLine (uint16_t x, uint16_t y, uint16_t length, et024006_color_t color) |
void | et024006_DrawLine (uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, et024006_color_t color) |
void | et024006_DrawPixel (uint16_t x, uint16_t y, et024006_color_t color) |
void | et024006_DrawQuickPixel (uint16_t x, uint16_t y, et024006_color_t color) |
void | et024006_DrawVertLine (uint16_t x, uint16_t y, uint16_t length, et024006_color_t color) |
void | et024006_DuplicatePixel (et024006_color_t color, uint32_t count) |
void | et024006_enter_idle (void) |
Make display enter in an idle mode. More... | |
et024006_color_t | et024006_GetPixel (uint16_t x, uint16_t y) |
void | et024006_GetPixmap (et024006_color_t *pixmap, uint16_t map_width, uint16_t map_x, uint16_t map_y, uint16_t x, uint16_t y, uint16_t width, uint16_t height) |
void | et024006_Init (unsigned long cpu_hz, unsigned long hsb_hz) |
Initialize the TFT display. More... | |
void | et024006_leave_idle (void) |
Make display leave the idle mode. More... | |
void | et024006_PrintConsole (char *lcd_string, uint16_t fcolor, int bcolor) |
void | et024006_PrintString (char *lcd_string, const unsigned char *font_style, uint16_t x, uint16_t y, uint16_t fcolor, int bcolor) |
Writes a string to the display. More... | |
void | et024006_PutBitmap (void *bitmap, uint16_t map_width, uint16_t x, uint16_t y, uint16_t width, uint16_t height, et024006_color_t foreground_color, et024006_color_t background_color) |
void | et024006_PutPixmap (et024006_color_t const *pixmap, uint16_t map_width, uint16_t map_x, uint16_t map_y, uint16_t x, uint16_t y, uint16_t width, uint16_t height) |
void | et024006_Scroll (int16_t lines) |
Scroll the scroll area down/up some lines. More... | |
void | et024006_ScrollAreaSetup (uint16_t tfa, uint16_t vsa, uint16_t bfa) |
Configures a scroll area on the display. More... | |
void | et024006_ScrollDisable (void) |
Disables the scrolling. More... | |
void | et024006_ScrollEnable (void) |
Enables the scrolling feature. More... | |
void | et024006_SetLimits (uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2) |
Sets the display limits according to the corner coordinates. Writing to the display will result in writing to the area specified through this function. More... | |
void | et024006_SetQuickLimits (uint16_t x, uint16_t y) |
Set the starting point of the next read/write from/to RAM. This sets only the start point of the RAM window. More... | |
void | et024006_SetQuickLimits2 (uint16_t x, uint16_t y) |
Set the ending point of the next read/write from/to RAM. This sets only the end point of the RAM window. More... | |
int | et024006_TestDisplay (void) |
Tests if a valid display is attached. For EBI connection it tests also the data lines. More... | |
Variables | |
const unsigned char | FONT6x8 [97][8] |
const unsigned char | FONT8x16 [97][16] |
const unsigned char | FONT8x8 [97][8] |
#define BLACK 0x0000 |
Referenced by draw_mandel(), and main().
#define BLUE 0x001F |
#define BLUE_LEV | ( | level | ) | ( (level)&BLUE ) |
Referenced by draw_mandel().
#define ET024006_BITMAP_WIDTH | ( | width | ) | Align_up(width/8, 8) |
Compute the actual width of the bit map. The actual width of a bit map is aligned on 8 since 1 bit corresponds to 1 pixel.
Referenced by et024006_PutBitmap().
#define ET024006_HEIGHT 240 |
#define ET024006_IFACE_MODE_EBI 0 |
#define ET024006_IFACE_MODE_SPI 1 |
#define ET024006_WIDTH 320 |
#define GREEN 0x07E0 |
#define GREEN_LEV | ( | level | ) | ( (((level)*2)<<5)&GREEN ) |
Referenced by draw_mandel(), and draw_plasma().
#define RED 0xF800 |
#define RED_LEV | ( | level | ) | ( ((level)<<(5+6))&RED ) |
Referenced by draw_mandel(), and draw_plasma().
#define WHITE 0xFFFF |
Referenced by et024006_PrintConsole().
typedef uint16_t et024006_color_t |
Datatype color information.
Use this for portability between displays. bits: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 R R R R R G G G G G G B B B B B
et024006_color_t et024006_Color | ( | uint8_t | r, |
uint8_t | g, | ||
uint8_t | b | ||
) |
Converts a RGB 8:8:8 color to RGB 5:6:5.
r | Red color value |
g | Green color value |
b | Blue color value |
Referenced by et024006_CopyPixelsFromScreen(), and et024006_GetPixel().
void et024006_CopyPixelsFromScreen | ( | et024006_color_t * | pixels, |
uint32_t | count | ||
) |
void et024006_CopyPixelsToScreen | ( | et024006_color_t const * | pixels, |
uint32_t | count | ||
) |
References Assert, ET024006_BS0, et024006_DeselectSPI, ET024006_ID, ET024006_PARAM_ADDR, ET024006_RS, et024006_SelectRegister(), et024006_SelectSPI, et024006_SendSPI, and HIMAX_SRAMWRITE.
Referenced by et024006_PutPixmap().
void et024006_DrawBitmap | ( | const uint16_t | data[], |
uint16_t | columnOffset, | ||
uint16_t | rowOffset | ||
) |
References ET024006_PARAM_ADDR, et024006_SelectRegister(), et024006_SetLimits(), and HIMAX_SRAMWRITE.
void et024006_DrawFilledCircle | ( | uint16_t | x, |
uint16_t | y, | ||
uint16_t | radius, | ||
uint16_t | color, | ||
uint8_t | quadrantMask | ||
) |
This function draws a filled circle, or parts of it. The radius is the distance from the center to the arc itself, which means that the total width or height of a circle will be (radius*2+1). The quadrantMask parameter is a bitmask that decides which quadrants of the circle to draw. Use the QUADRANT, HALF and WHOLE constants from the header file and OR them together if required. Radius equal to zero gives a single pixel.
x | X of center. |
y | Y of center. |
radius | Circle radius. |
color | Circle color. |
quadrantMask | Bitmask deciding which quadrants to draw. |
References et024006_DrawPixel(), et024006_DrawVertLine(), TFT_QUADRANT0, TFT_QUADRANT1, TFT_QUADRANT2, and TFT_QUADRANT3.
void et024006_DrawFilledRect | ( | uint16_t | x, |
uint16_t | y, | ||
uint16_t | width, | ||
uint16_t | height, | ||
et024006_color_t | color | ||
) |
References Assert, et024006_DuplicatePixel(), ET024006_HEIGHT, et024006_SetLimits(), and ET024006_WIDTH.
Referenced by et024006_DrawHorizLine(), et024006_DrawVertLine(), et024006_PrintConsole(), and main().
void et024006_DrawHorizLine | ( | uint16_t | x, |
uint16_t | y, | ||
uint16_t | length, | ||
et024006_color_t | color | ||
) |
References et024006_DrawFilledRect().
void et024006_DrawLine | ( | uint16_t | x1, |
uint16_t | y1, | ||
uint16_t | x2, | ||
uint16_t | y2, | ||
et024006_color_t | color | ||
) |
References Assert, et024006_DrawQuickPixel(), ET024006_HEIGHT, et024006_SetLimits(), and ET024006_WIDTH.
void et024006_DrawPixel | ( | uint16_t | x, |
uint16_t | y, | ||
et024006_color_t | color | ||
) |
References Assert, ET024006_BS0, et024006_DeselectSPI, ET024006_HEIGHT, ET024006_ID, ET024006_PARAM_ADDR, ET024006_RS, et024006_SelectRegister(), et024006_SelectSPI, et024006_SendSPI, et024006_SetLimits(), ET024006_WIDTH, and HIMAX_SRAMWRITE.
Referenced by draw_mandel(), draw_plasma(), and et024006_DrawFilledCircle().
void et024006_DrawQuickPixel | ( | uint16_t | x, |
uint16_t | y, | ||
et024006_color_t | color | ||
) |
References Assert, ET024006_BS0, et024006_DeselectSPI, ET024006_HEIGHT, ET024006_ID, ET024006_PARAM_ADDR, ET024006_RS, et024006_SelectRegister(), et024006_SelectSPI, et024006_SendSPI, et024006_SetQuickLimits(), ET024006_WIDTH, and HIMAX_SRAMWRITE.
Referenced by et024006_DrawLine(), and et024006_PrintString().
void et024006_DrawVertLine | ( | uint16_t | x, |
uint16_t | y, | ||
uint16_t | length, | ||
et024006_color_t | color | ||
) |
References et024006_DrawFilledRect().
Referenced by et024006_DrawFilledCircle().
void et024006_DuplicatePixel | ( | et024006_color_t | color, |
uint32_t | count | ||
) |
References Assert, ET024006_BS0, et024006_DeselectSPI, ET024006_DMA_USAGE_LIMIT, ET024006_ID, ET024006_PARAM_ADDR, ET024006_RS, et024006_SelectRegister(), et024006_SelectSPI, et024006_SendSPI, and HIMAX_SRAMWRITE.
Referenced by et024006_DrawFilledRect().
void et024006_enter_idle | ( | void | ) |
Make display enter in an idle mode.
References et024006_AdjustSleepingGamma().
et024006_color_t et024006_GetPixel | ( | uint16_t | x, |
uint16_t | y | ||
) |
References Assert, ET024006_BS0, et024006_Color(), et024006_DeselectSPI, ET024006_HEIGHT, ET024006_ID, ET024006_PARAM_ADDR, et024006_ReadSPI, ET024006_RS, ET024006_RW, et024006_SelectRegister(), et024006_SelectSPI, et024006_SendDummySPI, et024006_SendSPI, et024006_SetLimits(), ET024006_WIDTH, and HIMAX_SRAMWRITE.
void et024006_GetPixmap | ( | et024006_color_t * | pixmap, |
uint16_t | map_width, | ||
uint16_t | map_x, | ||
uint16_t | map_y, | ||
uint16_t | x, | ||
uint16_t | y, | ||
uint16_t | width, | ||
uint16_t | height | ||
) |
References Assert, et024006_CopyPixelsFromScreen(), ET024006_HEIGHT, et024006_SetLimits(), and ET024006_WIDTH.
void et024006_Init | ( | unsigned long | cpu_hz, |
unsigned long | hsb_hz | ||
) |
Initialize the TFT display.
cpu_hz | CPU speed in Hz. This is needed for power up timings. |
hsb_hz | HSB bus speed in Hz. This parameter is needed to set up the SMC. If SPI mode is used then this parameter is ignored. |
References cpu_hz, et024006_AdjustGamma(), et024006_GeneralSettings(), et024006_InterfaceSettings(), et024006_PowerOn(), et024006_PowerSettings(), et024006_PowerUp(), et024006_ResetDisplay(), et024006_SetupInterface(), hsb_hz, smc_init(), and tft_data.
Referenced by main().
void et024006_leave_idle | ( | void | ) |
Make display leave the idle mode.
References et024006_AdjustGamma().
void et024006_PrintConsole | ( | char * | lcd_string, |
uint16_t | fcolor, | ||
int | bcolor | ||
) |
References et024006_DrawFilledRect(), ET024006_HEIGHT, et024006_PrintString(), ET024006_WIDTH, FONT6x8, and WHITE.
void et024006_PrintString | ( | char * | lcd_string, |
const unsigned char * | font_style, | ||
uint16_t | x, | ||
uint16_t | y, | ||
uint16_t | fcolor, | ||
int | bcolor | ||
) |
Writes a string to the display.
lcd_string | Pointer to string data |
font_style | Pointer to data lookup table (I.E. Font table) |
x | X start direction |
y | Y start direction |
fcolor | Font color RGB565 format |
bcolor | Background color RGB565 format use -1 to indicate transparency Example: sprintf(thestring,"Hello World"); et024006_PrintString(thestring,FONT6x8,52,25,White,Black); print "Hello World" in white text on a black background |
Notes: the first line in the font table must contain 3 variables in this order Loc[0][0] = font x width Loc[0][1] = font y height Loc[0][2] = total data bytes per individual font
No bounds checking
References et024006_DrawQuickPixel(), ET024006_HEIGHT, ET024006_PARAM_ADDR, et024006_SelectRegister(), et024006_SetLimits(), ET024006_WIDTH, and HIMAX_SRAMWRITE.
Referenced by et024006_PrintConsole().
void et024006_PutBitmap | ( | void * | bitmap, |
uint16_t | map_width, | ||
uint16_t | x, | ||
uint16_t | y, | ||
uint16_t | width, | ||
uint16_t | height, | ||
et024006_color_t | foreground_color, | ||
et024006_color_t | background_color | ||
) |
This function print a buffer filled with bits which corresponds to a pixel on the screen. A 1 will be displayed with the foreground_color color, while a 0 with a background_color.
bitmap | The buffer which contains the bits. |
map_width | The width of the map. |
x | The horizontal offset where to place the map on the screen. |
y | The vertical offset where to place the map on the screen. |
width | The width of the area to print on the screen. |
height | The height of the area to print on the screen. |
foreground_color | The color on the screen of a bit which value equals to 1 on the map. |
background_color | The color on the screen of a bit which value equals to 0 on the map. |
References Assert, ET024006_BITMAP_WIDTH, et024006_CopyBitsToScreen(), ET024006_HEIGHT, et024006_SelectRegister(), et024006_SetLimits(), ET024006_WIDTH, and HIMAX_SRAMWRITE.
void et024006_PutPixmap | ( | et024006_color_t const * | pixmap, |
uint16_t | map_width, | ||
uint16_t | map_x, | ||
uint16_t | map_y, | ||
uint16_t | x, | ||
uint16_t | y, | ||
uint16_t | width, | ||
uint16_t | height | ||
) |
void et024006_Scroll | ( | int16_t | lines | ) |
Scroll the scroll area down/up some lines.
lines | Number of lines the scroll are should be scrolled. A positive lines value means lines down. A negative value means lines up. |
References Assert, ET024006_HEIGHT, et024006_ReadRegister(), et024006_WriteRegister(), HIMAX_VS_VSA_HB, HIMAX_VS_VSA_LB, HIMAX_VS_VSP_HB, and HIMAX_VS_VSP_LB.
void et024006_ScrollAreaSetup | ( | uint16_t | tfa, |
uint16_t | vsa, | ||
uint16_t | bfa | ||
) |
Configures a scroll area on the display.
tfa | Top fixed area in rows. This is an area that is unaffected from the scrolling and that starts at the top of the display area. |
vsa | Scroll area in rows. This is the actual scroll area. |
bfa | Bottom fixed area in rows. This is a section at the bottom of the display area that will not be used for scrolling. |
References et024006_WriteRegister(), HIMAX_VS_BFA_HB, HIMAX_VS_BFA_LB, HIMAX_VS_TFA_HB, HIMAX_VS_TFA_LB, HIMAX_VS_VSA_HB, and HIMAX_VS_VSA_LB.
void et024006_ScrollDisable | ( | void | ) |
Disables the scrolling.
References et024006_WriteRegister(), and HIMAX_GATE_SCAN_CTRL.
void et024006_ScrollEnable | ( | void | ) |
Enables the scrolling feature.
References et024006_WriteRegister(), HIMAX_GATE_SCAN_CTRL, and HIMAX_SCROLL_ON.
void et024006_SetLimits | ( | uint16_t | x1, |
uint16_t | y1, | ||
uint16_t | x2, | ||
uint16_t | y2 | ||
) |
Sets the display limits according to the corner coordinates. Writing to the display will result in writing to the area specified through this function.
References et024006_WriteRegister(), HIMAX_COL_ADDR_END1, HIMAX_COL_ADDR_END2, HIMAX_COL_ADDR_START1, HIMAX_COL_ADDR_START2, HIMAX_ROW_ADDR_END1, HIMAX_ROW_ADDR_END2, HIMAX_ROW_ADDR_START1, and HIMAX_ROW_ADDR_START2.
Referenced by et024006_DrawBitmap(), et024006_DrawFilledRect(), et024006_DrawLine(), et024006_DrawPixel(), et024006_GetPixel(), et024006_GetPixmap(), et024006_PrintString(), et024006_PutBitmap(), and et024006_PutPixmap().
void et024006_SetQuickLimits | ( | uint16_t | x, |
uint16_t | y | ||
) |
Set the starting point of the next read/write from/to RAM. This sets only the start point of the RAM window.
References et024006_WriteRegister(), HIMAX_COL_ADDR_START1, HIMAX_COL_ADDR_START2, HIMAX_ROW_ADDR_START1, and HIMAX_ROW_ADDR_START2.
Referenced by et024006_DrawQuickPixel(), and et024006_TestDisplay().
void et024006_SetQuickLimits2 | ( | uint16_t | x, |
uint16_t | y | ||
) |
Set the ending point of the next read/write from/to RAM. This sets only the end point of the RAM window.
References et024006_WriteRegister(), HIMAX_COL_ADDR_END1, HIMAX_COL_ADDR_END2, HIMAX_ROW_ADDR_END1, and HIMAX_ROW_ADDR_END2.
int et024006_TestDisplay | ( | void | ) |
Tests if a valid display is attached. For EBI connection it tests also the data lines.
Tests if a valid display is attached. For EBI connection it tests also the data lines.
Test for 16-bit 65k colors:
Test value 16-bit 0xAAAA -> R=0b10101, G=0b010101, B=0b01010 Internal values are 18-bit -> R=0b101011, G=0b010101, B=0b010100 Upon read 8-bit values are returned R=0xAC, G=0x54, B=0x50
Test value 16-bit 0x5555 -> R=0b01010, G=0b101010, B=0b10101 Internal values are 18-bit -> R=0b010100, G=0b101010, B=0b101011 Upon read 8-bit values are returned R=0x50, G=0xA8, B=0xAC
References ET024006_PARAM_ADDR, et024006_ReadRegister(), et024006_SelectRegister(), et024006_SetQuickLimits(), HIMAX_ID_CODE, and HIMAX_SRAMWRITE.
const unsigned char FONT6x8[97][8] |
Referenced by et024006_PrintConsole().
const unsigned char FONT8x16[97][16] |
const unsigned char FONT8x8[97][8] |