Definition in file et024006dhu.h.
#include <stdint.h>
#include <stdbool.h>
Go to the source code of this file.
Defines | |
#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. | |
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. | |
void | et024006_DrawBitmap (const uint16_t data[], U16 columnOffset, U16 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_DrawVertLine (uint16_t x, uint16_t y, uint16_t length, et024006_color_t color) |
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. | |
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. | |
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. | |
void | et024006_ScrollAreaSetup (uint16_t tfa, uint16_t vsa, uint16_t bfa) |
Configures a scroll area on the display. | |
void | et024006_ScrollDisable (void) |
Disables the scrolling. | |
void | et024006_ScrollEnable (void) |
Enables the scrolling feature. | |
int | et024006_TestDisplay (void) |
Tests if a valid display is attached. For EBI connection it tests also the data lines. | |
Variables | |
const unsigned char | FONT6x8 [97][8] |
const unsigned char | FONT8x16 [97][16] |
const unsigned char | FONT8x8 [97][8] |
#define BLACK 0x0000 |
#define BLUE 0x001F |
#define BLUE_LEV | ( | level | ) | ( (level)&BLUE ) |
Definition at line 72 of file et024006dhu.h.
#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.
Definition at line 174 of file et024006dhu.h.
Referenced by et024006_PutBitmap().
#define ET024006_HEIGHT 240 |
Definition at line 61 of file et024006dhu.h.
Referenced by et024006_DrawFilledRect(), et024006_DrawLine(), et024006_DrawPixel(), et024006_DrawQuickPixel(), et024006_GetPixel(), et024006_GetPixmap(), et024006_PrintString(), et024006_PutBitmap(), et024006_PutPixmap(), et024006_Scroll(), and main().
#define ET024006_IFACE_MODE_EBI 0 |
Definition at line 63 of file et024006dhu.h.
#define ET024006_IFACE_MODE_SPI 1 |
Definition at line 64 of file et024006dhu.h.
#define ET024006_WIDTH 320 |
Definition at line 60 of file et024006dhu.h.
Referenced by et024006_DrawFilledRect(), et024006_DrawLine(), et024006_DrawPixel(), et024006_DrawQuickPixel(), et024006_GetPixel(), et024006_GetPixmap(), et024006_PrintString(), et024006_PutBitmap(), et024006_PutPixmap(), and main().
#define GRAY_LEV | ( | level | ) | ( BLUE_LEV(level) | GREEN_LEV(level) | RED_LEV(level) ) |
Definition at line 75 of file et024006dhu.h.
#define GREEN 0x07E0 |
#define GREEN_LEV | ( | level | ) | ( (((level)*2)<<5)&GREEN ) |
Definition at line 73 of file et024006dhu.h.
#define RED 0xF800 |
#define RED_LEV | ( | level | ) | ( ((level)<<(5+6))&RED ) |
Definition at line 74 of file et024006dhu.h.
#define WHITE 0xFFFF |
Definition at line 70 of file et024006dhu.h.
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
Definition at line 82 of file et024006dhu.h.
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 |
Definition at line 644 of file et024006dhu.c.
Referenced by et024006_CopyPixelsFromScreen(), and et024006_GetPixel().
00645 { 00646 uint16_t red = r >> 3; 00647 uint16_t green = g >> 2; 00648 uint16_t blue = b >> 3; 00649 00650 red <<= (5 + 6); 00651 green <<= 5; 00652 00653 et024006_color_t color = red | green | blue; 00654 color = (color >> 8) | (color << 8); // Convert endianness. 00655 return color; 00656 }
void et024006_DrawBitmap | ( | const uint16_t | data[], | |
U16 | columnOffset, | |||
U16 | rowOffset | |||
) |
Definition at line 1425 of file et024006dhu.c.
References ET024006_PARAM_ADDR, et024006_SelectRegister(), et024006_SetLimits(), and HIMAX_SRAMWRITE.
01426 { 01427 int col, row; 01428 U16 columns = data[1]; 01429 U16 rows = data[0]; 01430 et024006_SetLimits( 0 + rowOffset, 0 + columnOffset, rows - 1 + rowOffset, columns - 1 + columnOffset ); 01431 data += 2; 01432 et024006_SelectRegister( HIMAX_SRAMWRITE ); 01433 U16 *pData = (U16 *)(&data[2]); 01434 for (col=columns;col>0;col--) 01435 { 01436 pData = (U16 *)(&data[2+col]); 01437 for (row=0;row<rows;row++) 01438 { 01439 *ET024006_PARAM_ADDR = *pData; 01440 pData = pData+columns; 01441 } 01442 } 01443 }
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 totalt 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 contants 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. |
Definition at line 834 of file et024006dhu.c.
References et024006_DrawPixel(), et024006_DrawVertLine(), TFT_QUADRANT0, TFT_QUADRANT1, TFT_QUADRANT2, and TFT_QUADRANT3.
00840 { 00841 // Draw only a pixel if radius is zero. 00842 if (radius == 0) { 00843 et024006_DrawPixel( x, y, color ); 00844 return; 00845 } 00846 00847 // Set up start iterators. 00848 uint16_t offsetX = 0; 00849 uint16_t offsetY = radius; 00850 int16_t error = 3 - 2 * radius; 00851 00852 // Iterate offsetX from 0 to radius. 00853 while (offsetX <= offsetY) { 00854 // Draw vertical lines tracking each quadrant. 00855 if (quadrantMask & TFT_QUADRANT0) { 00856 et024006_DrawVertLine( x + offsetY, y - offsetX, 00857 offsetX + 1, color ); 00858 et024006_DrawVertLine( x + offsetX, y - offsetY, 00859 offsetY + 1, color ); 00860 } 00861 if (quadrantMask & TFT_QUADRANT1) { 00862 et024006_DrawVertLine( x - offsetY, y - offsetX, 00863 offsetX + 1, color ); 00864 et024006_DrawVertLine( x - offsetX, y - offsetY, 00865 offsetY + 1, color ); 00866 } 00867 if (quadrantMask & TFT_QUADRANT2) { 00868 et024006_DrawVertLine( x - offsetY, y, offsetX + 1, 00869 color ); 00870 et024006_DrawVertLine( x - offsetX, y, offsetY + 1, 00871 color ); 00872 } 00873 if (quadrantMask & TFT_QUADRANT3) { 00874 et024006_DrawVertLine( x + offsetY, y, offsetX + 1, 00875 color ); 00876 et024006_DrawVertLine( x + offsetX, y, offsetY + 1, 00877 color ); 00878 } 00879 00880 // Update error value and step offsetY when required. 00881 if (error < 0) { 00882 error += ((offsetX << 2) + 6); 00883 } else { 00884 error += (((offsetX - offsetY) << 2) + 10); 00885 --offsetY; 00886 } 00887 00888 // Next X. 00889 ++offsetX; 00890 } 00891 }
void et024006_DrawFilledRect | ( | uint16_t | x, | |
uint16_t | y, | |||
uint16_t | width, | |||
uint16_t | height, | |||
et024006_color_t | color | |||
) |
Definition at line 792 of file et024006dhu.c.
References et024006_DuplicatePixel(), ET024006_HEIGHT, et024006_SetLimits(), and ET024006_WIDTH.
Referenced by et024006_DrawHorizLine(), et024006_DrawVertLine(), and main().
00793 { 00794 // Sanity check on parameters. 00795 Assert( x < ET024006_WIDTH ); 00796 Assert( y < ET024006_HEIGHT ); 00797 Assert( width > 0 ); 00798 Assert( height > 0 ); 00799 00800 // Compute bottom right point. 00801 uint16_t x2 = x + width - 1; 00802 uint16_t y2 = y + height - 1; 00803 00804 // More sanity check. 00805 Assert( x2 < ET024006_WIDTH ); 00806 Assert( y2 < ET024006_HEIGHT ); 00807 00808 // Set up draw area and copy pixel color until area is full. 00809 et024006_SetLimits( x, y, x2, y2 ); 00810 uint32_t count = (uint32_t) width * height; 00811 et024006_DuplicatePixel( color, count ); 00812 }
void et024006_DrawHorizLine | ( | uint16_t | x, | |
uint16_t | y, | |||
uint16_t | length, | |||
et024006_color_t | color | |||
) |
Definition at line 718 of file et024006dhu.c.
References et024006_DrawFilledRect().
Referenced by main().
00719 { 00720 et024006_DrawFilledRect( x, y, length, 1, color ); 00721 }
void et024006_DrawLine | ( | uint16_t | x1, | |
uint16_t | y1, | |||
uint16_t | x2, | |||
uint16_t | y2, | |||
et024006_color_t | color | |||
) |
Definition at line 730 of file et024006dhu.c.
References et024006_DrawQuickPixel(), ET024006_HEIGHT, et024006_SetLimits(), and ET024006_WIDTH.
Referenced by main().
00731 { 00732 et024006_SetLimits( 0, 0, ET024006_WIDTH - 1, ET024006_HEIGHT - 1 ); 00733 00734 // Sanity check on parameters. 00735 Assert( x1 < ET024006_WIDTH ); 00736 Assert( y1 < ET024006_HEIGHT ); 00737 Assert( x2 < ET024006_WIDTH ); 00738 Assert( y2 < ET024006_HEIGHT ); 00739 00740 // Compute deltas, ie. "width" and "height" of line, then 00741 // compute x and y direction, and make deltas positive for later use. 00742 int16_t xinc = 1; // Start off assuming direction is positive, ie. right. 00743 int16_t dx = x2 - x1; 00744 if (dx < 0){ 00745 xinc = -1; 00746 dx = -dx; 00747 } 00748 int16_t yinc = 1; // Start off assuming direction is positive, ie. down. 00749 int16_t dy = y2 - y1; 00750 if (dy < 0){ 00751 yinc = -1; 00752 dy = -dy; 00753 } 00754 00755 // Set up current point. 00756 uint16_t x = x1; 00757 uint16_t y = y1; 00758 uint16_t i; 00759 // A "flat" line (dx>dy) is handled differently from a "steep" line (dx<dy). 00760 if (dx > dy) { 00761 // Walk along X, draw pixel, and step Y when required. 00762 int16_t e = dx >> 1; 00763 for ( i = 0; i <= dx; ++i) { 00764 et024006_DrawQuickPixel(x,y,color); 00765 // Sub-pixel "error" overflowed, so we step Y and reset the "error". 00766 if (e <= 0){ 00767 e += dx; 00768 y += yinc; 00769 } 00770 // Walk one step along X. 00771 e -= dy; 00772 x += xinc; 00773 } 00774 } else { 00775 // Walk along Y, draw pixel, and step X when required. 00776 int16_t e = dy >> 1; 00777 for (i = 0; i <= dy; ++i) { 00778 et024006_DrawQuickPixel(x,y,color); 00779 // Sub-pixel "error" overflowed, so we step X and reset the "error". 00780 if (e <= 0){ 00781 e += dy; 00782 x += xinc; 00783 } 00784 // Walk one step along Y. 00785 e -= dx; 00786 y += yinc; 00787 } 00788 } 00789 }
void et024006_DrawPixel | ( | uint16_t | x, | |
uint16_t | y, | |||
et024006_color_t | color | |||
) |
Definition at line 659 of file et024006dhu.c.
References 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 et024006_DrawFilledCircle().
00660 { 00661 // Sanity check on parameters. 00662 Assert( x < ET024006_WIDTH ); 00663 Assert( y < ET024006_HEIGHT ); 00664 00665 // Set up draw area and write the two bytes of pixel data. 00666 et024006_SetLimits( x, y, x, y ); 00667 et024006_SelectRegister( HIMAX_SRAMWRITE ); 00668 00669 #if(ET024006_IFACE_MODE == ET024006_IFACE_MODE_SPI) 00670 et024006_SelectSPI(); 00671 et024006_SendSPI( ET024006_ID | ET024006_BS0 | ET024006_RS ); 00672 et024006_SendSPI( color & 0xff ); 00673 et024006_SendSPI( color >> 8 ); 00674 et024006_DeselectSPI(); 00675 #else 00676 *ET024006_PARAM_ADDR = color; 00677 #endif 00678 }
void et024006_DrawVertLine | ( | uint16_t | x, | |
uint16_t | y, | |||
uint16_t | length, | |||
et024006_color_t | color | |||
) |
Definition at line 724 of file et024006dhu.c.
References et024006_DrawFilledRect().
Referenced by et024006_DrawFilledCircle(), and main().
00725 { 00726 et024006_DrawFilledRect( x, y, 1, length, color ); 00727 }
et024006_color_t et024006_GetPixel | ( | uint16_t | x, | |
uint16_t | y | |||
) |
Definition at line 681 of file et024006dhu.c.
References 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.
00682 { 00683 et024006_color_t color; 00684 00685 // Sanity check on parameters. 00686 Assert( x < ET024006_WIDTH ); 00687 Assert( y < ET024006_HEIGHT ); 00688 00689 // Set up draw area and read the three bytes of pixel data. 00690 et024006_SetLimits( x, y, x, y ); 00691 et024006_SelectRegister( HIMAX_SRAMWRITE ); 00692 00693 #if(ET024006_IFACE_MODE == ET024006_IFACE_MODE_EBI) 00694 color = *ET024006_PARAM_ADDR; 00695 #endif 00696 00697 #if(ET024006_IFACE_MODE == ET024006_IFACE_MODE_SPI) 00698 et024006_SelectSPI(); 00699 et024006_SendSPI( ET024006_ID | ET024006_BS0 | ET024006_RS | ET024006_RW ); 00700 et024006_SendDummySPI(); // First return byte is useless. 00701 00702 et024006_SendDummySPI(); 00703 uint8_t red = et024006_ReadSPI(); 00704 et024006_SendDummySPI(); 00705 uint8_t green = et024006_ReadSPI(); 00706 et024006_SendDummySPI(); 00707 uint8_t blue = et024006_ReadSPI(); 00708 00709 et024006_DeselectSPI(); 00710 00711 // Convert to 16-bit color format. 00712 color = et024006_Color( red, green, blue ); 00713 #endif 00714 return color; 00715 }
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 | |||
) |
Definition at line 1033 of file et024006dhu.c.
References et024006_CopyPixelsFromScreen(), ET024006_HEIGHT, et024006_SetLimits(), and ET024006_WIDTH.
01042 { 01043 // Sanity check on parameters. 01044 Assert( pixmap != NULL ); 01045 Assert( width <= map_width ); 01046 Assert( x < ET024006_WIDTH ); 01047 Assert( y < ET024006_HEIGHT ); 01048 Assert( width > 0 ); 01049 Assert( height > 0 ); 01050 01051 // Compute bottom right point. 01052 uint16_t x2 = x + width - 1; 01053 uint16_t y2 = y + height - 1; 01054 01055 // More sanity check. 01056 Assert( x2 < ET024006_WIDTH ); 01057 Assert( y2 < ET024006_HEIGHT ); 01058 01059 // Set up read area. 01060 et024006_SetLimits( x, y, x2, y2 ); 01061 01062 // Offset into pixmap. 01063 pixmap += map_x; 01064 if (map_y > 0) { 01065 pixmap += (uint32_t) map_y * map_width; 01066 } 01067 01068 // In case of no horizontal pixmap clipping, easier handling is possible. 01069 if ((map_width == width) && (map_x == 0)) { 01070 // Compute pixel count and copy pixels from screen. 01071 uint32_t count = (uint32_t) width * height; 01072 et024006_CopyPixelsFromScreen( pixmap, count ); 01073 } else { 01074 // Copy line by line from screen. 01075 uint16_t lines_left = height; 01076 while (lines_left > 0) { 01077 et024006_CopyPixelsFromScreen( pixmap, width ); 01078 pixmap += map_width; 01079 --lines_left; 01080 } 01081 } 01082 }
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. |
Definition at line 556 of file et024006dhu.c.
References et024006_AdjustGamma(), et024006_GeneralSettings(), et024006_InterfaceSettings(), et024006_PowerOn(), et024006_PowerSettings(), et024006_PowerUp(), et024006_ResetDisplay(), et024006_SetupInterface(), and tft_data.
Referenced by main().
00557 { 00558 tft_data.cpu_hz = cpu_hz; 00559 tft_data.hsb_hz = hsb_hz; 00560 00561 #if(ET024006_IFACE_MODE == ET024006_IFACE_MODE_SPI) 00562 et024006_InitSPI(); 00563 #endif 00564 #if(ET024006_IFACE_MODE == ET024006_IFACE_MODE_EBI) 00565 smc_init(tft_data.hsb_hz); 00566 #endif 00567 et024006_SetupInterface(); 00568 et024006_ResetDisplay(); 00569 et024006_AdjustGamma(); 00570 et024006_GeneralSettings(); 00571 et024006_InterfaceSettings(); 00572 et024006_PowerSettings(); 00573 et024006_PowerUp(); 00574 et024006_PowerOn(); 00575 }
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"); lcd_nokia_string(thestring,FONT6x8,52,25,White,Black); print "Hello World" in white text on a black background |
No bounds checking
Definition at line 1101 of file et024006dhu.c.
References et024006_DrawQuickPixel(), ET024006_HEIGHT, ET024006_PARAM_ADDR, et024006_SelectRegister(), et024006_SetLimits(), ET024006_WIDTH, and HIMAX_SRAMWRITE.
Referenced by main().
01106 { 01107 uint16_t row, col; 01108 unsigned char mask = 0, xfont, yfont, font_size; 01109 const unsigned char *data; 01110 01111 // if string is empty there is nothing to do 01112 if( *lcd_string == '\0') 01113 return; 01114 01115 data = font_style; // point to the start of the font table 01116 xfont = *data; // get font x width 01117 data++; 01118 yfont = *data; // get font y length 01119 data++; 01120 font_size = *data; // get data bytes per font 01121 01122 // If transparent mode 01123 if(bcolor == -1) 01124 { 01125 // set window to display size 01126 et024006_SetLimits( 0, 0, ET024006_WIDTH - 1, ET024006_HEIGHT - 1 ); 01127 01128 do 01129 { 01130 // point to character data in font table 01131 data = (font_style + font_size) + // header offset 01132 (font_size * (int)(*lcd_string - 32)); // character select 01133 01134 for (row = y; row < (y + yfont); row++) 01135 { 01136 mask = 0x80; 01137 for (col = x; col < (x + xfont); col++) 01138 { 01139 if (*data & mask) // if pixel data then put dot 01140 { 01141 et024006_DrawQuickPixel( col, row, fcolor ); 01142 } 01143 mask >>= 1; 01144 } 01145 // Next row data 01146 data++; 01147 } 01148 // move to next character start pixel 01149 x += xfont; 01150 lcd_string++; // next character in string 01151 01152 }while(*lcd_string !='\0'); // keep spitting chars out until end of string 01153 } 01154 else 01155 { 01156 do 01157 { 01158 // point to character data in font table 01159 data = (font_style + font_size) + // header offset 01160 (font_size * (int)(*lcd_string - 32)); // character select 01161 01162 // set a window for the character 01163 et024006_SetLimits( x, y, x + xfont - 1, y + yfont - 1 ); 01164 et024006_SelectRegister( HIMAX_SRAMWRITE ); 01165 01166 for (row=0; row < yfont;row++) 01167 { 01168 mask = 0x80; 01169 for (col = 0; col < xfont; col++) 01170 { 01171 if (*data & mask) // if pixel data then put dot 01172 { 01173 *ET024006_PARAM_ADDR = fcolor; 01174 } 01175 else // else use background color 01176 { 01177 *ET024006_PARAM_ADDR = bcolor; 01178 } 01179 mask >>= 1; 01180 } 01181 01182 // Next row data 01183 data++; 01184 } 01185 // move to next character start pixel 01186 x += xfont; 01187 lcd_string++; // next character in string 01188 }while(*lcd_string !='\0'); 01189 } 01190 }
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 whcih 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. |
Definition at line 925 of file et024006dhu.c.
References ET024006_BITMAP_WIDTH, et024006_CopyBitsToScreen(), ET024006_HEIGHT, et024006_SelectRegister(), et024006_SetLimits(), ET024006_WIDTH, and HIMAX_SRAMWRITE.
00934 { 00935 uint8_t *u8_bitmap = (uint8_t *) bitmap; 00936 00937 // Sanity check on parameters. 00938 Assert( bitmap != NULL ); 00939 Assert( width <= map_width ); 00940 Assert( x < ET024006_WIDTH ); 00941 Assert( y < ET024006_HEIGHT ); 00942 Assert( width > 0 ); 00943 Assert( height > 0 ); 00944 00945 // Compute bottom right point. 00946 uint16_t x2 = x + width - 1; 00947 uint16_t y2 = y + height - 1; 00948 00949 // More sanity check. 00950 Assert( x2 < ET024006_WIDTH ); 00951 Assert( y2 < ET024006_HEIGHT ); 00952 00953 // Set up draw area. 00954 et024006_SetLimits(x, y, x2, y2); 00955 00956 // we need access to the display SRAM now 00957 et024006_SelectRegister( HIMAX_SRAMWRITE ); 00958 00959 // In case of no horizontal pixmap clipping, easier handling is possible. 00960 if (ET024006_BITMAP_WIDTH(map_width) == map_width) 00961 { 00962 // Compute pixel count and copy pixels to screen. 00963 uint32_t count = (uint32_t) width * height; 00964 et024006_CopyBitsToScreen(u8_bitmap, count, foreground_color, background_color); 00965 } 00966 else 00967 { 00968 // Copy line by line to screen. 00969 uint16_t lines_left = height; 00970 while (lines_left > 0) 00971 { 00972 et024006_CopyBitsToScreen(u8_bitmap, width, foreground_color, background_color); 00973 u8_bitmap += ET024006_BITMAP_WIDTH(map_width); 00974 --lines_left; 00975 } 00976 } 00977 }
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 | |||
) |
Definition at line 979 of file et024006dhu.c.
References et024006_CopyPixelsToScreen(), ET024006_HEIGHT, et024006_SelectRegister(), et024006_SetLimits(), ET024006_WIDTH, and HIMAX_SRAMWRITE.
Referenced by main().
00988 { 00989 // Sanity check on parameters. 00990 Assert( pixmap != NULL ); 00991 Assert( width <= map_width ); 00992 Assert( x < ET024006_WIDTH ); 00993 Assert( y < ET024006_HEIGHT ); 00994 Assert( width > 0 ); 00995 Assert( height > 0 ); 00996 00997 // Compute bottom right point. 00998 uint16_t x2 = x + width - 1; 00999 uint16_t y2 = y + height - 1; 01000 01001 // More sanity check. 01002 Assert( x2 < ET024006_WIDTH ); 01003 Assert( y2 < ET024006_HEIGHT ); 01004 01005 // Set up draw area. 01006 et024006_SetLimits( x, y, x2, y2 ); 01007 01008 // Offset into pixmap. 01009 pixmap += map_x; 01010 if (map_y > 0) { 01011 pixmap += (uint32_t) map_y * map_width; 01012 } 01013 // we need access to the display SRAM now 01014 et024006_SelectRegister( HIMAX_SRAMWRITE ); 01015 01016 // In case of no horizontal pixmap clipping, easier handling is possible. 01017 if ((map_width == width) && (map_x == 0)) { 01018 // Compute pixel count and copy pixels to screen. 01019 uint32_t count = (uint32_t) width * height; 01020 et024006_CopyPixelsToScreen( pixmap, count ); 01021 } else { 01022 // Copy line by line to screen. 01023 uint16_t lines_left = height; 01024 while (lines_left > 0) { 01025 et024006_CopyPixelsToScreen( pixmap, width ); 01026 pixmap += map_width; 01027 --lines_left; 01028 } 01029 } 01030 }
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. |
Definition at line 602 of file et024006dhu.c.
References ET024006_HEIGHT, et024006_ReadRegister(), et024006_WriteRegister(), HIMAX_VS_VSA_HB, HIMAX_VS_VSA_LB, HIMAX_VS_VSP_HB, and HIMAX_VS_VSP_LB.
00603 { 00604 uint16_t current_vsp; 00605 uint16_t current_vsa; 00606 Assert(lines > ET024006_HEIGHT); 00607 Assert(lines < -ET024006_HEIGHT); 00608 00609 current_vsp = ((uint16_t) et024006_ReadRegister(HIMAX_VS_VSP_HB)) << 8; 00610 current_vsp |= et024006_ReadRegister(HIMAX_VS_VSP_LB); 00611 00612 current_vsa = ((uint16_t) et024006_ReadRegister(HIMAX_VS_VSA_HB)) << 8; 00613 current_vsa |= et024006_ReadRegister(HIMAX_VS_VSA_LB); 00614 00615 lines += current_vsp; 00616 if(lines < 0) 00617 lines = ET024006_HEIGHT + lines; 00618 else if ( lines > ET024006_HEIGHT) 00619 lines -= ET024006_HEIGHT; 00620 00621 et024006_WriteRegister(HIMAX_VS_VSP_HB,((uint16_t) lines) >> 8); 00622 et024006_WriteRegister(HIMAX_VS_VSP_LB,(uint16_t) lines); 00623 }
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 dispaly area that will not be used for scrolling. |
Definition at line 585 of file et024006dhu.c.
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.
00586 { 00587 et024006_WriteRegister(HIMAX_VS_TFA_HB, tfa >> 8); 00588 et024006_WriteRegister(HIMAX_VS_TFA_LB, tfa); 00589 00590 et024006_WriteRegister(HIMAX_VS_VSA_HB, vsa >> 8); 00591 et024006_WriteRegister(HIMAX_VS_VSA_LB, vsa); 00592 00593 et024006_WriteRegister(HIMAX_VS_BFA_HB, bfa >> 8); 00594 et024006_WriteRegister(HIMAX_VS_BFA_LB, bfa); 00595 }
void et024006_ScrollDisable | ( | void | ) |
Disables the scrolling.
Definition at line 634 of file et024006dhu.c.
References et024006_WriteRegister(), and HIMAX_GATE_SCAN_CTRL.
00635 { 00636 et024006_WriteRegister(HIMAX_GATE_SCAN_CTRL, 0x0); 00637 }
void et024006_ScrollEnable | ( | void | ) |
Enables the scrolling feature.
Definition at line 627 of file et024006dhu.c.
References et024006_WriteRegister(), HIMAX_GATE_SCAN_CTRL, and HIMAX_SCROLL_ON.
00628 { 00629 et024006_WriteRegister(HIMAX_GATE_SCAN_CTRL, HIMAX_SCROLL_ON); 00630 }
int et024006_TestDisplay | ( | void | ) |
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 Opon 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
-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.
Definition at line 1693 of file et024006dhu.c.
References ET024006_PARAM_ADDR, et024006_ReadRegister(), et024006_SelectRegister(), et024006_SetQuickLimits(), HIMAX_ID_CODE, and HIMAX_SRAMWRITE.
01694 { 01695 U16 tmp; 01696 int ret_value = 0; 01697 01698 #if 0 01699 U16 display_id; 01700 // test if this is a valid display 01701 display_id = et024006_ReadRegister(HIMAX_ID_CODE); // 0x47 01702 if((display_id & 0x00FF) != 0x0047) 01703 { 01704 ret_value = -2; 01705 } 01706 #endif 01707 01708 #if( ET024006_IFACE_MODE == ET024006_IFACE_MODE_EBI) 01709 01710 // If the display is connected to the EBI we test if all 01711 // data lines are connected by writing a test pattern to 01712 // the display. 01713 //else 01714 { 01715 // write test pattern at first position in display RAM 01716 et024006_SetQuickLimits( 0, 0 ); 01717 et024006_SelectRegister( HIMAX_SRAMWRITE ); 01718 *ET024006_PARAM_ADDR = 0xAAAA; 01719 01720 // set to read access at the first RAM position 01721 et024006_SetQuickLimits( 0, 0 ); 01722 et024006_SelectRegister( HIMAX_SRAMWRITE ); 01723 01724 // dummy read as described in the datasheet 01725 tmp = *ET024006_PARAM_ADDR; 01726 01727 // read 8-bit R value and compare with expected result 01728 tmp = *ET024006_PARAM_ADDR; 01729 if(tmp != 0x00AC) 01730 { 01731 ret_value = -1; 01732 } 01733 // read 8-bit G value and compare with expected result 01734 tmp = *ET024006_PARAM_ADDR; 01735 if(tmp != 0x0054) 01736 { 01737 ret_value = -1; 01738 } 01739 // read 8-bit B value and compare with expected result 01740 tmp = *ET024006_PARAM_ADDR; 01741 if(tmp != 0x0050) 01742 { 01743 ret_value = -1; 01744 } 01745 01746 // write next test pattern to display RAM 01747 et024006_SetQuickLimits( 0, 0 ); 01748 et024006_SelectRegister( HIMAX_SRAMWRITE ); 01749 *ET024006_PARAM_ADDR = 0x5555; 01750 01751 // set access to first RAM location 01752 et024006_SetQuickLimits( 0, 0 ); 01753 et024006_SelectRegister( HIMAX_SRAMWRITE ); 01754 01755 // we need to do a dummy read as described in the datasheet 01756 tmp = *ET024006_PARAM_ADDR; 01757 // read 8-bit R value and compare with expected result 01758 tmp = *ET024006_PARAM_ADDR; 01759 if(tmp != 0x0050) 01760 { 01761 ret_value = -1; 01762 } 01763 // read 8-bit G value and compare with expected result 01764 tmp = *ET024006_PARAM_ADDR; 01765 if(tmp != 0x00A8) 01766 { 01767 ret_value = -1; 01768 } 01769 // read 8-bit B value and compare with expected result 01770 tmp = *ET024006_PARAM_ADDR; 01771 if(tmp != 0x00AC) 01772 { 01773 ret_value = -1; 01774 } 01775 01776 } 01777 #endif 01778 return ret_value; 01779 }
const unsigned char FONT6x8[97][8] |
const unsigned char FONT8x16[97][16] |
Definition at line 390 of file et024006dhu.c.
const unsigned char FONT8x8[97][8] |