Atmel Software Framework

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DISPLAY - LCD Display - ET024006DHU

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.

Modules

 

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 BLUE   0x001F
#define BLUE_LEV (   level)    ( (level)&BLUE )
#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(), gui_buffer_print_dsp16_bars(), gui_buffer_print_dsp16_signal(), and gui_buffer_set_pixel().

#define ET024006_IFACE_MODE_EBI   0
#define ET024006_IFACE_MODE_SPI   1
#define GRAY_LEV (   level)    ( BLUE_LEV(level) | GREEN_LEV(level) | RED_LEV(level) )
#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().

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.

Parameters
rRed color value
gGreen color value
bBlue color value

Referenced by et024006_CopyPixelsFromScreen(), et024006_GetPixel(), and lodepng_decode_display().

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 
)

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.

Parameters
xX of center.
yY of center.
radiusCircle radius.
colorCircle color.
quadrantMaskBitmask deciding which quadrants to draw.

References error(), et024006_DrawPixel(), et024006_DrawVertLine(), TFT_QUADRANT0, TFT_QUADRANT1, TFT_QUADRANT2, and TFT_QUADRANT3.

void et024006_DrawHorizLine ( uint16_t  x,
uint16_t  y,
uint16_t  length,
et024006_color_t  color 
)

References et024006_DrawFilledRect().

Referenced by display_box(), and main().

void et024006_DrawLine ( uint16_t  x1,
uint16_t  y1,
uint16_t  x2,
uint16_t  y2,
et024006_color_t  color 
)
void et024006_DrawVertLine ( uint16_t  x,
uint16_t  y,
uint16_t  length,
et024006_color_t  color 
)
void et024006_enter_idle ( void  )

Make display enter in an idle mode.

References et024006_AdjustSleepingGamma().

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.

Parameters
cpu_hzCPU speed in Hz. This is needed for power up timings.
hsb_hzHSB 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 gfx_et024006dhu_init(), gui_init(), and 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 
)
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.

Parameters
lcd_stringPointer to string data
font_stylePointer to data lookup table (I.E. Font table)
xX start direction
yY start direction
fcolorFont color RGB565 format
bcolorBackground 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 col, data, et024006_DrawQuickPixel(), ET024006_HEIGHT, et024006_SelectRegister(), et024006_SetLimits(), ET024006_WIDTH, HIMAX_SRAMWRITE, row, and x.

Referenced by et024006_PrintConsole(), gui_print(), gui_print_default_message(), gui_text_print(), is_usb_hid_event(), main(), mmi_activity_display(), and mmi_display().

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.

Parameters
bitmapThe buffer which contains the bits.
map_widthThe width of the map.
xThe horizontal offset where to place the map on the screen.
yThe vertical offset where to place the map on the screen.
widthThe width of the area to print on the screen.
heightThe height of the area to print on the screen.
foreground_colorThe color on the screen of a bit which value equals to 1 on the map.
background_colorThe color on the screen of a bit which value equals to 0 on the map.

References Assert, count, ET024006_BITMAP_WIDTH, et024006_CopyBitsToScreen(), ET024006_HEIGHT, et024006_SelectRegister(), et024006_SetLimits(), ET024006_WIDTH, HIMAX_SRAMWRITE, and NULL.

Referenced by gui_print_fft_box(), and gui_print_signal_box().

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.

Parameters
linesNumber 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.

Parameters
tfaTop fixed area in rows. This is an area that is unaffected from the scrolling and that starts at the top of the display area.
vsaScroll area in rows. This is the actual scroll area.
bfaBottom 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 
)
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.

Returns
0 for a successful test. -1 if test failed.

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

Returns
0 if test was successful
-1 if one of the test pattern that was written to the internal RAM of the display is not read back correctly. This test only applies if the display is connected to the EBI.
-2 if the display id was not read as expected.

References et024006_ReadRegister(), et024006_SelectRegister(), et024006_SetQuickLimits(), HIMAX_ID_CODE, HIMAX_SRAMWRITE, and tmp.

const unsigned char FONT6x8[97][8]
const unsigned char FONT8x16[97][16]

Referenced by main(), and mmi_display().

const unsigned char FONT8x8[97][8]