Definition in file et024006dhu.c.
#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
#include "compiler.h"
#include "et024006dhu.h"
#include "conf_et024006dhu.h"
#include "smc.h"
#include "board.h"
#include "gpio.h"
#include "cycle_counter.h"
Go to the source code of this file.
Defines | |
#define | ET024006_BS0 0x04 |
#define | et024006_DeselectSPI() (PORTC.OUTSET = PIN4_bm) |
#define | ET024006_DMA_USAGE_LIMIT 10 |
#define | ET024006_ID 0x70 |
#define | et024006_ReadSPI() (SPIC.DATA) |
#define | ET024006_RS 0x02 |
#define | ET024006_RW 0x01 |
#define | et024006_SelectSPI() (PORTC.OUTCLR = PIN4_bm) |
#define | et024006_SendDummySPI() et024006_SendSPI( 0xff ); |
#define | et024006_SendSPI(value) |
#define | HIMAX_AP0 0 |
#define | HIMAX_AP1 1 |
#define | HIMAX_AP2 2 |
#define | HIMAX_BGR 3 |
#define | HIMAX_COL_ADDR_END1 0x05 |
#define | HIMAX_COL_ADDR_END2 0x04 |
#define | HIMAX_COL_ADDR_START1 0x03 |
#define | HIMAX_COL_ADDR_START2 0x02 |
#define | HIMAX_CYCLECTRL1 0x3A |
#define | HIMAX_CYCLECTRL14 0x41 |
#define | HIMAX_CYCLECTRL1_x 0x23 |
#define | HIMAX_CYCLECTRL2 0x3B |
#define | HIMAX_CYCLECTRL2_x 0x24 |
#define | HIMAX_CYCLECTRL3 0x3C |
#define | HIMAX_CYCLECTRL3_x 0x25 |
#define | HIMAX_CYCLECTRL4 0x3D |
#define | HIMAX_CYCLECTRL5 0x3E |
#define | HIMAX_CYCLECTRL6 0x40 |
#define | HIMAX_D0 2 |
#define | HIMAX_D1 3 |
#define | HIMAX_DISPCTRL1 0x26 |
#define | HIMAX_DISPCTRL10 0x36 |
#define | HIMAX_DISPCTRL2 0x27 |
#define | HIMAX_DISPCTRL3 0x28 |
#define | HIMAX_DISPCTRL4 0x29 |
#define | HIMAX_DISPCTRL5 0x2A |
#define | HIMAX_DISPCTRL6 0x2C |
#define | HIMAX_DISPCTRL7 0x2D |
#define | HIMAX_DISPCTRL8 0x90 |
#define | HIMAX_DISPCTRL9 0x35 |
#define | HIMAX_DISPMODECTRL 0x01 |
#define | HIMAX_DK 3 |
#define | HIMAX_DTE 4 |
#define | HIMAX_GAMMACTRL1 0x46 |
#define | HIMAX_GAMMACTRL10 0x4F |
#define | HIMAX_GAMMACTRL11 0x50 |
#define | HIMAX_GAMMACTRL12 0x51 |
#define | HIMAX_GAMMACTRL2 0x47 |
#define | HIMAX_GAMMACTRL3 0x48 |
#define | HIMAX_GAMMACTRL4 0x49 |
#define | HIMAX_GAMMACTRL5 0x4A |
#define | HIMAX_GAMMACTRL6 0x4B |
#define | HIMAX_GAMMACTRL7 0x4C |
#define | HIMAX_GAMMACTRL8 0x4D |
#define | HIMAX_GAMMACTRL9 0x4E |
#define | HIMAX_GASENB 7 |
#define | HIMAX_GATE_SCAN_CTRL 0x18 |
#define | HIMAX_GON 5 |
#define | HIMAX_ID_CODE 0x67 |
#define | HIMAX_ID_CODE_VALUE 0x47 |
#define | HIMAX_INTERNAL28 0x70 |
#define | HIMAX_INVON 2 |
#define | HIMAX_MEMACCESSCTRL 0x16 |
#define | HIMAX_MV 5 |
#define | HIMAX_MX 6 |
#define | HIMAX_MY 7 |
#define | HIMAX_NORON 1 |
#define | HIMAX_OSC_EN 0 |
#define | HIMAX_OSCCTRL1 0x19 |
#define | HIMAX_OSCCTRL2 0x1A |
#define | HIMAX_OSCCTRL3 0x93 |
#define | HIMAX_PA_END_ROW_HB 0x0C |
#define | HIMAX_PA_END_ROW_LB 0x0D |
#define | HIMAX_PA_START_ROW_HB 0x0A |
#define | HIMAX_PA_START_ROW_LB 0x0B |
#define | HIMAX_PON 4 |
#define | HIMAX_POWERCTRL1 0x1B |
#define | HIMAX_POWERCTRL2 0x1c |
#define | HIMAX_POWERCTRL3 0x1D |
#define | HIMAX_POWERCTRL4 0x1E |
#define | HIMAX_POWERCTRL5 0x1F |
#define | HIMAX_POWERCTRL6 0x20 |
#define | HIMAX_PT0 6 |
#define | HIMAX_PT1 7 |
#define | HIMAX_ROW_ADDR_END1 0x09 |
#define | HIMAX_ROW_ADDR_END2 0x08 |
#define | HIMAX_ROW_ADDR_START1 0x07 |
#define | HIMAX_ROW_ADDR_START2 0x06 |
#define | HIMAX_SAP 0x90 |
#define | HIMAX_SCROLL_ON 0x2 |
#define | HIMAX_SRAMWRITE 0x22 |
#define | HIMAX_STB 0 |
#define | HIMAX_TEON 3 |
#define | HIMAX_VCOMCTRL1 0x43 |
#define | HIMAX_VCOMCTRL2 0x44 |
#define | HIMAX_VCOMCTRL3 0x45 |
#define | HIMAX_VCOMG 7 |
#define | HIMAX_VS_BFA_HB 0x12 |
#define | HIMAX_VS_BFA_LB 0x13 |
#define | HIMAX_VS_TFA_HB 0x0E |
#define | HIMAX_VS_TFA_LB 0x0F |
#define | HIMAX_VS_VSA_HB 0x10 |
#define | HIMAX_VS_VSA_LB 0x11 |
#define | HIMAX_VS_VSP_HB 0x14 |
#define | HIMAX_VS_VSP_LB 0x15 |
#define | HIMAX_VTFT_TRI 1 |
#define | HIMAX_XDK 2 |
#define | TFT_QUADRANT0 ((1 << 1) | (1 << 0)) |
#define | TFT_QUADRANT1 ((1 << 3) | (1 << 2)) |
#define | TFT_QUADRANT2 ((1 << 5) | (1 << 4)) |
#define | TFT_QUADRANT3 ((1 << 7) | (1 << 6)) |
Functions | |
static void | et024006_AdjustGamma (void) |
Display gamma setup. | |
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. | |
static void | et024006_CopyBitsToScreen (void *bitmap, uint32_t count, et024006_color_t foreground_color, et024006_color_t background_color) |
static void | et024006_CopyPixelsFromScreen (et024006_color_t *pixels, uint32_t count) |
static void | et024006_CopyPixelsToScreen (et024006_color_t const *pixels, uint32_t count) |
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) |
static 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) |
static void | et024006_DuplicatePixel (et024006_color_t color, uint32_t count) |
static void | et024006_GeneralSettings (void) |
General display settings. | |
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. | |
static void | et024006_InterfaceSettings (void) |
Sets display interface. | |
static void | et024006_PowerOn (void) |
Turns the display on. | |
static void | et024006_PowerSettings (void) |
Power setup. | |
static void | et024006_PowerUp (void) |
Power up 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) |
static __inline__ uint8_t | et024006_ReadRegister (uint8_t address) |
static void | et024006_ResetDisplay (void) |
Does a hard reset of the display. | |
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 () |
Disables the scrolling. | |
void | et024006_ScrollEnable () |
Enables the scrolling feature. | |
static __inline__ void | et024006_SelectRegister (uint8_t address) |
static 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. | |
static 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. | |
static void | et024006_SetRegister (uint8_t address, uint8_t bitmask) |
static void | et024006_SetupInterface (void) |
int | et024006_TestDisplay (void) |
Tests if a valid and functional display is connected. This function currently works only for the 16-bit color space configuration. For other configurations the read values of the display ram are different due to the internal handling. | |
static __inline__ void | et024006_WriteRegister (uint8_t address, uint8_t value) |
Variables | |
const unsigned char | FONT6x8 [97][8] |
const unsigned char | FONT8x16 [97][16] |
const unsigned char | FONT8x8 [97][8] |
struct { | |
unsigned long cpu_hz | |
unsigned long hsb_hz | |
} | tft_data |
#define ET024006_BS0 0x04 |
Definition at line 66 of file et024006dhu.c.
Referenced by et024006_CopyPixelsFromScreen(), et024006_CopyPixelsToScreen(), et024006_DrawPixel(), et024006_DrawQuickPixel(), et024006_DuplicatePixel(), and et024006_GetPixel().
#define et024006_DeselectSPI | ( | ) | (PORTC.OUTSET = PIN4_bm) |
Definition at line 535 of file et024006dhu.c.
Referenced by et024006_CopyPixelsFromScreen(), et024006_CopyPixelsToScreen(), et024006_DrawPixel(), et024006_DrawQuickPixel(), et024006_DuplicatePixel(), and et024006_GetPixel().
#define ET024006_DMA_USAGE_LIMIT 10 |
#define ET024006_ID 0x70 |
Definition at line 65 of file et024006dhu.c.
Referenced by et024006_CopyPixelsFromScreen(), et024006_CopyPixelsToScreen(), et024006_DrawPixel(), et024006_DrawQuickPixel(), et024006_DuplicatePixel(), and et024006_GetPixel().
#define et024006_ReadSPI | ( | ) | (SPIC.DATA) |
Definition at line 544 of file et024006dhu.c.
Referenced by et024006_CopyPixelsFromScreen(), and et024006_GetPixel().
#define ET024006_RS 0x02 |
Definition at line 67 of file et024006dhu.c.
Referenced by et024006_CopyPixelsFromScreen(), et024006_CopyPixelsToScreen(), et024006_DrawPixel(), et024006_DrawQuickPixel(), et024006_DuplicatePixel(), and et024006_GetPixel().
#define ET024006_RW 0x01 |
Definition at line 68 of file et024006dhu.c.
Referenced by et024006_CopyPixelsFromScreen(), and et024006_GetPixel().
#define et024006_SelectSPI | ( | ) | (PORTC.OUTCLR = PIN4_bm) |
Definition at line 534 of file et024006dhu.c.
Referenced by et024006_CopyPixelsFromScreen(), et024006_CopyPixelsToScreen(), et024006_DrawPixel(), et024006_DrawQuickPixel(), et024006_DuplicatePixel(), and et024006_GetPixel().
#define et024006_SendDummySPI | ( | ) | et024006_SendSPI( 0xff ); |
Definition at line 541 of file et024006dhu.c.
Referenced by et024006_CopyPixelsFromScreen(), and et024006_GetPixel().
#define et024006_SendSPI | ( | value | ) |
Value:
SPIC.DATA = (value); \ do {} while ((SPIC.STATUS & SPI_IF_bm) == 0x00);
Definition at line 537 of file et024006dhu.c.
Referenced by et024006_CopyPixelsFromScreen(), et024006_CopyPixelsToScreen(), et024006_DrawPixel(), et024006_DrawQuickPixel(), et024006_DuplicatePixel(), and et024006_GetPixel().
#define HIMAX_AP0 0 |
Definition at line 122 of file et024006dhu.c.
#define HIMAX_AP1 1 |
Definition at line 121 of file et024006dhu.c.
#define HIMAX_AP2 2 |
Definition at line 120 of file et024006dhu.c.
#define HIMAX_BGR 3 |
#define HIMAX_COL_ADDR_END1 0x05 |
#define HIMAX_COL_ADDR_END2 0x04 |
#define HIMAX_COL_ADDR_START1 0x03 |
Definition at line 76 of file et024006dhu.c.
Referenced by et024006_SetLimits(), and et024006_SetQuickLimits().
#define HIMAX_COL_ADDR_START2 0x02 |
Definition at line 75 of file et024006dhu.c.
Referenced by et024006_SetLimits(), and et024006_SetQuickLimits().
#define HIMAX_CYCLECTRL1 0x3A |
#define HIMAX_CYCLECTRL14 0x41 |
#define HIMAX_CYCLECTRL1_x 0x23 |
#define HIMAX_CYCLECTRL2 0x3B |
#define HIMAX_CYCLECTRL2_x 0x24 |
#define HIMAX_CYCLECTRL3 0x3C |
#define HIMAX_CYCLECTRL3_x 0x25 |
#define HIMAX_CYCLECTRL4 0x3D |
#define HIMAX_CYCLECTRL5 0x3E |
#define HIMAX_CYCLECTRL6 0x40 |
#define HIMAX_D0 2 |
#define HIMAX_D1 3 |
#define HIMAX_DISPCTRL1 0x26 |
#define HIMAX_DISPCTRL10 0x36 |
#define HIMAX_DISPCTRL2 0x27 |
#define HIMAX_DISPCTRL3 0x28 |
#define HIMAX_DISPCTRL4 0x29 |
#define HIMAX_DISPCTRL5 0x2A |
#define HIMAX_DISPCTRL6 0x2C |
#define HIMAX_DISPCTRL7 0x2D |
#define HIMAX_DISPCTRL8 0x90 |
#define HIMAX_DISPCTRL9 0x35 |
#define HIMAX_DISPMODECTRL 0x01 |
#define HIMAX_DK 3 |
#define HIMAX_DTE 4 |
#define HIMAX_GAMMACTRL1 0x46 |
#define HIMAX_GAMMACTRL10 0x4F |
#define HIMAX_GAMMACTRL11 0x50 |
#define HIMAX_GAMMACTRL12 0x51 |
#define HIMAX_GAMMACTRL2 0x47 |
#define HIMAX_GAMMACTRL3 0x48 |
#define HIMAX_GAMMACTRL4 0x49 |
#define HIMAX_GAMMACTRL5 0x4A |
#define HIMAX_GAMMACTRL6 0x4B |
#define HIMAX_GAMMACTRL7 0x4C |
#define HIMAX_GAMMACTRL8 0x4D |
#define HIMAX_GAMMACTRL9 0x4E |
#define HIMAX_GASENB 7 |
Definition at line 112 of file et024006dhu.c.
#define HIMAX_GATE_SCAN_CTRL 0x18 |
Definition at line 103 of file et024006dhu.c.
Referenced by et024006_ScrollDisable(), and et024006_ScrollEnable().
#define HIMAX_GON 5 |
#define HIMAX_ID_CODE 0x67 |
#define HIMAX_ID_CODE_VALUE 0x47 |
Definition at line 182 of file et024006dhu.c.
#define HIMAX_INTERNAL28 0x70 |
#define HIMAX_INVON 2 |
#define HIMAX_MEMACCESSCTRL 0x16 |
#define HIMAX_MV 5 |
#define HIMAX_MX 6 |
#define HIMAX_MY 7 |
Definition at line 98 of file et024006dhu.c.
#define HIMAX_NORON 1 |
#define HIMAX_OSC_EN 0 |
Definition at line 107 of file et024006dhu.c.
#define HIMAX_OSCCTRL1 0x19 |
#define HIMAX_OSCCTRL2 0x1A |
Definition at line 109 of file et024006dhu.c.
#define HIMAX_OSCCTRL3 0x93 |
#define HIMAX_PA_END_ROW_HB 0x0C |
Definition at line 85 of file et024006dhu.c.
#define HIMAX_PA_END_ROW_LB 0x0D |
Definition at line 86 of file et024006dhu.c.
#define HIMAX_PA_START_ROW_HB 0x0A |
Definition at line 83 of file et024006dhu.c.
#define HIMAX_PA_START_ROW_LB 0x0B |
Definition at line 84 of file et024006dhu.c.
#define HIMAX_PON 4 |
#define HIMAX_POWERCTRL1 0x1B |
#define HIMAX_POWERCTRL2 0x1c |
#define HIMAX_POWERCTRL3 0x1D |
#define HIMAX_POWERCTRL4 0x1E |
#define HIMAX_POWERCTRL5 0x1F |
#define HIMAX_POWERCTRL6 0x20 |
#define HIMAX_PT0 6 |
Definition at line 137 of file et024006dhu.c.
#define HIMAX_PT1 7 |
Definition at line 136 of file et024006dhu.c.
#define HIMAX_ROW_ADDR_END1 0x09 |
#define HIMAX_ROW_ADDR_END2 0x08 |
#define HIMAX_ROW_ADDR_START1 0x07 |
Definition at line 80 of file et024006dhu.c.
Referenced by et024006_SetLimits(), and et024006_SetQuickLimits().
#define HIMAX_ROW_ADDR_START2 0x06 |
Definition at line 79 of file et024006dhu.c.
Referenced by et024006_SetLimits(), and et024006_SetQuickLimits().
#define HIMAX_SAP 0x90 |
Definition at line 187 of file et024006dhu.c.
#define HIMAX_SCROLL_ON 0x2 |
#define HIMAX_SRAMWRITE 0x22 |
Definition at line 129 of file et024006dhu.c.
Referenced by et024006_CopyPixelsFromScreen(), et024006_CopyPixelsToScreen(), et024006_DrawBitmap(), et024006_DrawPixel(), et024006_DrawQuickPixel(), et024006_DuplicatePixel(), et024006_GetPixel(), et024006_PrintString(), et024006_PutBitmap(), et024006_PutPixmap(), and et024006_TestDisplay().
#define HIMAX_STB 0 |
Definition at line 117 of file et024006dhu.c.
#define HIMAX_TEON 3 |
#define HIMAX_VCOMCTRL1 0x43 |
#define HIMAX_VCOMCTRL2 0x44 |
#define HIMAX_VCOMCTRL3 0x45 |
#define HIMAX_VCOMG 7 |
#define HIMAX_VS_BFA_HB 0x12 |
#define HIMAX_VS_BFA_LB 0x13 |
#define HIMAX_VS_TFA_HB 0x0E |
#define HIMAX_VS_TFA_LB 0x0F |
#define HIMAX_VS_VSA_HB 0x10 |
Definition at line 89 of file et024006dhu.c.
Referenced by et024006_Scroll(), and et024006_ScrollAreaSetup().
#define HIMAX_VS_VSA_LB 0x11 |
Definition at line 90 of file et024006dhu.c.
Referenced by et024006_Scroll(), and et024006_ScrollAreaSetup().
#define HIMAX_VS_VSP_HB 0x14 |
#define HIMAX_VS_VSP_LB 0x15 |
#define HIMAX_VTFT_TRI 1 |
Definition at line 116 of file et024006dhu.c.
#define HIMAX_XDK 2 |
Definition at line 115 of file et024006dhu.c.
#define TFT_QUADRANT0 ((1 << 1) | (1 << 0)) |
#define TFT_QUADRANT1 ((1 << 3) | (1 << 2)) |
#define TFT_QUADRANT2 ((1 << 5) | (1 << 4)) |
#define TFT_QUADRANT3 ((1 << 7) | (1 << 6)) |
static void et024006_AdjustGamma | ( | void | ) | [static] |
Display gamma setup.
Parameters are provided by EDT for the display.
Definition at line 1786 of file et024006dhu.c.
References et024006_WriteRegister(), HIMAX_GAMMACTRL1, HIMAX_GAMMACTRL10, HIMAX_GAMMACTRL11, HIMAX_GAMMACTRL12, HIMAX_GAMMACTRL2, HIMAX_GAMMACTRL3, HIMAX_GAMMACTRL4, HIMAX_GAMMACTRL5, HIMAX_GAMMACTRL6, HIMAX_GAMMACTRL7, HIMAX_GAMMACTRL8, and HIMAX_GAMMACTRL9.
Referenced by et024006_Init().
01787 { 01788 et024006_WriteRegister( HIMAX_GAMMACTRL1, 0x94 ); 01789 et024006_WriteRegister( HIMAX_GAMMACTRL2, 0x41 ); 01790 et024006_WriteRegister( HIMAX_GAMMACTRL3, 0x00 ); 01791 et024006_WriteRegister( HIMAX_GAMMACTRL4, 0x33 ); 01792 et024006_WriteRegister( HIMAX_GAMMACTRL5, 0x25 ); 01793 et024006_WriteRegister( HIMAX_GAMMACTRL6, 0x45 ); 01794 et024006_WriteRegister( HIMAX_GAMMACTRL7, 0x44 ); 01795 et024006_WriteRegister( HIMAX_GAMMACTRL8, 0x77 ); 01796 et024006_WriteRegister( HIMAX_GAMMACTRL9, 0x12 ); 01797 et024006_WriteRegister( HIMAX_GAMMACTRL10, 0xCC ); 01798 et024006_WriteRegister( HIMAX_GAMMACTRL11, 0x46 ); 01799 et024006_WriteRegister( HIMAX_GAMMACTRL12, 0x82 ); 01800 }
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 }
static void et024006_CopyBitsToScreen | ( | void * | bitmap, | |
uint32_t | count, | |||
et024006_color_t | foreground_color, | |||
et024006_color_t | background_color | |||
) | [static] |
Definition at line 893 of file et024006dhu.c.
References ET024006_PARAM_ADDR.
Referenced by et024006_PutBitmap().
00898 { 00899 uint8_t *u8_bitmap = (uint8_t *) bitmap; 00900 uint8_t bit_mask; 00901 #if(ET024006_IFACE_MODE == ET024006_IFACE_MODE_EBI) 00902 while (count >= 8) 00903 { 00904 *ET024006_PARAM_ADDR = (Tst_bits(*u8_bitmap, 0x01))?foreground_color:background_color; 00905 *ET024006_PARAM_ADDR = (Tst_bits(*u8_bitmap, 0x02))?foreground_color:background_color; 00906 *ET024006_PARAM_ADDR = (Tst_bits(*u8_bitmap, 0x04))?foreground_color:background_color; 00907 *ET024006_PARAM_ADDR = (Tst_bits(*u8_bitmap, 0x08))?foreground_color:background_color; 00908 *ET024006_PARAM_ADDR = (Tst_bits(*u8_bitmap, 0x10))?foreground_color:background_color; 00909 *ET024006_PARAM_ADDR = (Tst_bits(*u8_bitmap, 0x20))?foreground_color:background_color; 00910 *ET024006_PARAM_ADDR = (Tst_bits(*u8_bitmap, 0x40))?foreground_color:background_color; 00911 *ET024006_PARAM_ADDR = (Tst_bits(*u8_bitmap, 0x80))?foreground_color:background_color; 00912 u8_bitmap++; 00913 count -= 8; 00914 } 00915 bit_mask = 1; 00916 while (count) 00917 { 00918 *ET024006_PARAM_ADDR = (Tst_bits(*u8_bitmap, bit_mask))?foreground_color:background_color; 00919 bit_mask <<= 1; 00920 count--; 00921 } 00922 #endif 00923 }
static void et024006_CopyPixelsFromScreen | ( | et024006_color_t * | pixels, | |
uint32_t | count | |||
) | [static] |
Definition at line 1578 of file et024006dhu.c.
References ET024006_BS0, et024006_Color(), et024006_DeselectSPI, ET024006_ID, ET024006_PARAM_ADDR, et024006_ReadSPI, ET024006_RS, ET024006_RW, et024006_SelectRegister(), et024006_SelectSPI, et024006_SendDummySPI, et024006_SendSPI, and HIMAX_SRAMWRITE.
Referenced by et024006_GetPixmap().
01579 { 01580 Assert( pixels != NULL ); 01581 01582 et024006_SelectRegister( HIMAX_SRAMWRITE ); 01583 01584 #if(ET024006_IFACE_MODE == ET024006_IFACE_MODE_EBI) 01585 while( count) 01586 { 01587 *pixels = *ET024006_PARAM_ADDR; 01588 pixels++; 01589 count--; 01590 } 01591 #endif 01592 01593 #if(ET024006_IFACE_MODE == ET024006_IFACE_MODE_SPI) 01594 et024006_SelectSPI(); 01595 et024006_SendSPI( ET024006_ID | ET024006_BS0 | ET024006_RS | ET024006_RW ); 01596 et024006_SendDummySPI(); 01597 01598 while (count > 0) { 01599 et024006_SendDummySPI(); 01600 uint8_t red = et024006_ReadSPI(); 01601 et024006_SendDummySPI(); 01602 uint8_t green = et024006_ReadSPI(); 01603 et024006_SendDummySPI(); 01604 uint8_t blue = et024006_ReadSPI(); 01605 01606 *pixels = et024006_Color( red, green, blue ); 01607 01608 ++pixels; 01609 --count; 01610 } 01611 01612 et024006_DeselectSPI(); 01613 #endif 01614 }
static void et024006_CopyPixelsToScreen | ( | et024006_color_t const * | pixels, | |
uint32_t | count | |||
) | [static] |
Definition at line 1446 of file et024006dhu.c.
References ET024006_BS0, et024006_DeselectSPI, ET024006_ID, ET024006_PARAM_ADDR, ET024006_RS, et024006_SelectRegister(), et024006_SelectSPI, et024006_SendSPI, and HIMAX_SRAMWRITE.
Referenced by et024006_PutPixmap().
01447 { 01448 Assert( pixels != NULL ); 01449 Assert( count > 0 ); 01450 01451 #if(ET024006_IFACE_MODE == ET024006_IFACE_MODE_EBI) 01452 while (count >= 8) 01453 { 01454 *ET024006_PARAM_ADDR = *pixels++; 01455 *ET024006_PARAM_ADDR = *pixels++; 01456 *ET024006_PARAM_ADDR = *pixels++; 01457 *ET024006_PARAM_ADDR = *pixels++; 01458 *ET024006_PARAM_ADDR = *pixels++; 01459 *ET024006_PARAM_ADDR = *pixels++; 01460 *ET024006_PARAM_ADDR = *pixels++; 01461 *ET024006_PARAM_ADDR = *pixels++; 01462 count-=8; 01463 } 01464 while( count ) 01465 { 01466 *ET024006_PARAM_ADDR = *pixels; 01467 pixels++; 01468 count--; 01469 } 01470 #endif 01471 01472 #if(ET024006_IFACE_MODE == ET024006_IFACE_MODE_SPI) 01473 et024006_SelectSPI(); 01474 et024006_SendSPI( ET024006_ID | ET024006_BS0 | ET024006_RS ); 01475 01476 /* if (count < ET024006_DMA_USAGE_LIMIT) { 01477 Assert( ET024006_DMA_USAGE_LIMIT < 256 ); 01478 01479 uint8_t countLowByte = count & 0xff; 01480 while (countLowByte > 0) { 01481 et024006_SendSPI( color & 0xff ); 01482 et024006_SendSPI( color >> 8 ); 01483 --countLowByte; 01484 } 01485 } else*/ 01486 { 01487 DMA.CTRL = DMA_ENABLE_bm; 01488 01489 DMA.CH0.DESTADDR0 = (((uint32_t) &(SPIC.DATA)) >> 0) & 0xff; 01490 DMA.CH0.DESTADDR1 = (((uint32_t) &(SPIC.DATA)) >> 8) & 0xff; 01491 DMA.CH0.DESTADDR2 = (((uint32_t) &(SPIC.DATA)) >> 16) & 0xff; 01492 01493 DMA.CH0.SRCADDR0 = (((uint32_t) pixels) >> 0) & 0xff; 01494 DMA.CH0.SRCADDR1 = (((uint32_t) pixels) >> 8) & 0xff; 01495 DMA.CH0.SRCADDR2 = (((uint32_t) pixels) >> 16) & 0xff; 01496 01497 DMA.CH0.ADDRCTRL = (uint8_t) 01498 DMA_CH_SRCRELOAD_NONE_gc | 01499 DMA_CH_SRCDIR_INC_gc | 01500 DMA_CH_DESTRELOAD_NONE_gc | 01501 DMA_CH_DESTDIR_FIXED_gc; 01502 DMA.CH0.TRIGSRC = DMA_CH_TRIGSRC_SPIC_gc; 01503 01504 01505 uint32_t byteCount = count * sizeof(et024006_color_t); 01506 ++byteCount; // DMA issue workaround!!! 01507 Assert( (byteCount >> 24) == 0x00 ); // Byte count should be 24 bit or less. 01508 uint8_t blockCount = byteCount >> 16; 01509 uint16_t remainderCount = byteCount & 0xffff; 01510 01511 if (blockCount > 0) { 01512 DMA.CH0.TRFCNT = 0; // Equals 65536. 01513 DMA.CH0.REPCNT = blockCount; 01514 DMA.CH0.CTRLA = (uint8_t) 01515 DMA_CH_ENABLE_bm | 01516 DMA_CH_REPEAT_bm | 01517 DMA_CH_TRFREQ_bm | 01518 DMA_CH_SINGLE_bm | 01519 DMA_CH_BURSTLEN_1BYTE_gc; 01520 do {} while ((DMA.CH0.CTRLB & DMA_CH_CHBUSY_bm) != 0x00); 01521 } 01522 01523 if (remainderCount > 0) { 01524 DMA.CH0.TRFCNT = remainderCount; 01525 DMA.CH0.CTRLA = (uint8_t) 01526 DMA_CH_ENABLE_bm | 01527 DMA_CH_TRFREQ_bm | 01528 DMA_CH_SINGLE_bm | 01529 DMA_CH_BURSTLEN_1BYTE_gc; 01530 do {} while ((DMA.CH0.CTRLB & DMA_CH_CHBUSY_bm) != 0x00); 01531 } 01532 } 01533 01534 et024006_DeselectSPI(); 01535 01536 01537 #if 0 01538 Assert( pixels != NULL ); 01539 Assert( (count >> 24) == 0 ) 01540 Assert( count > 0 ); 01541 01542 count *= sizeof( et024006_color_t ); 01543 uint8_t const * buffer = (uint8_t const *) pixels; 01544 01545 uint8_t countHigh = (count >> 16); 01546 uint16_t countLow = count & 0xffff; 01547 01548 et024006_SelectRegister( HIMAX_SRAMWRITE ); 01549 et024006_SelectSPI(); 01550 et024006_SendSPI( ET024006_ID | ET024006_BS0 | ET024006_RS ); 01551 01552 if (countLow > 0) { 01553 do { 01554 et024006_SendSPI( *buffer ); 01555 ++buffer; 01556 --countLow; 01557 } while (countLow > 0); 01558 } 01559 01560 if (countHigh > 0) { 01561 do { 01562 do { 01563 et024006_SendSPI( *buffer ); 01564 ++buffer; 01565 --countLow; 01566 } while (countLow > 0); 01567 --countHigh; 01568 } while (countHigh > 0); 01569 } 01570 01571 et024006_DeselectSPI(); 01572 #endif 01573 01574 #endif 01575 }
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 }
static void et024006_DrawQuickPixel | ( | uint16_t | x, | |
uint16_t | y, | |||
et024006_color_t | color | |||
) | [static] |
Definition at line 1307 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_SetQuickLimits(), ET024006_WIDTH, and HIMAX_SRAMWRITE.
Referenced by et024006_DrawLine(), and et024006_PrintString().
01308 { 01309 // Sanity check on parameters. 01310 Assert( x < ET024006_WIDTH ); 01311 Assert( y < ET024006_HEIGHT ); 01312 01313 // Set up draw area and write the two bytes of pixel data. 01314 et024006_SetQuickLimits( x, y ); 01315 et024006_SelectRegister( HIMAX_SRAMWRITE ); 01316 #if(ET024006_IFACE_MODE == ET024006_IFACE_MODE_SPI) 01317 et024006_SelectSPI(); 01318 et024006_SendSPI( ET024006_ID | ET024006_BS0 | ET024006_RS ); 01319 et024006_SendSPI( color & 0xff ); 01320 et024006_SendSPI( color >> 8 ); 01321 et024006_DeselectSPI(); 01322 #endif 01323 #if(ET024006_IFACE_MODE == ET024006_IFACE_MODE_EBI) 01324 *ET024006_PARAM_ADDR = color; 01325 #endif 01326 01327 }
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 }
static void et024006_DuplicatePixel | ( | et024006_color_t | color, | |
uint32_t | count | |||
) | [static] |
Definition at line 1333 of file et024006dhu.c.
References 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().
01334 { 01335 Assert( (count >> 24) == 0 ); 01336 Assert( count > 0 ); 01337 01338 et024006_SelectRegister( HIMAX_SRAMWRITE ); 01339 #if(ET024006_IFACE_MODE == ET024006_IFACE_MODE_EBI) 01340 //uint8_t countLowByte = count; 01341 while (count >= 8) { 01342 *ET024006_PARAM_ADDR = color; 01343 *ET024006_PARAM_ADDR = color; 01344 *ET024006_PARAM_ADDR = color; 01345 *ET024006_PARAM_ADDR = color; 01346 *ET024006_PARAM_ADDR = color; 01347 *ET024006_PARAM_ADDR = color; 01348 *ET024006_PARAM_ADDR = color; 01349 *ET024006_PARAM_ADDR = color; 01350 count-=8; 01351 } 01352 while (count > 0) { 01353 *ET024006_PARAM_ADDR = color; 01354 --count; 01355 } 01356 #endif 01357 #if(ET024006_IFACE_MODE == ET024006_IFACE_MODE_SPI) 01358 et024006_SelectSPI(); 01359 et024006_SendSPI( ET024006_ID | ET024006_BS0 | ET024006_RS ); 01360 01361 if (count < ET024006_DMA_USAGE_LIMIT) { 01362 Assert( ET024006_DMA_USAGE_LIMIT < 256 ); 01363 01364 uint8_t countLowByte = count & 0xff; 01365 while (countLowByte > 0) { 01366 et024006_SendSPI( color & 0xff ); 01367 et024006_SendSPI( color >> 8 ); 01368 --countLowByte; 01369 } 01370 } else { 01371 DMA.CTRL = DMA_ENABLE_bm; 01372 01373 DMA.CH0.DESTADDR0 = (((uint32_t) &(SPIC.DATA)) >> 0) & 0xff; 01374 DMA.CH0.DESTADDR1 = (((uint32_t) &(SPIC.DATA)) >> 8) & 0xff; 01375 DMA.CH0.DESTADDR2 = (((uint32_t) &(SPIC.DATA)) >> 16) & 0xff; 01376 01377 DMA.CH0.TRFCNT = 2; // Two bytes in a pixel. 01378 01379 DMA.CH0.ADDRCTRL = (uint8_t) 01380 DMA_CH_SRCRELOAD_BLOCK_gc | 01381 DMA_CH_SRCDIR_INC_gc | 01382 DMA_CH_DESTRELOAD_NONE_gc | 01383 DMA_CH_DESTDIR_FIXED_gc; 01384 DMA.CH0.TRIGSRC = DMA_CH_TRIGSRC_SPIC_gc; 01385 01386 ++count; // DMA issue workaround!!! 01387 01388 while (count >= 255) { 01389 DMA.CH0.SRCADDR0 = (((uint32_t) &color) >> 0) & 0xff; 01390 DMA.CH0.SRCADDR1 = (((uint32_t) &color) >> 8) & 0xff; 01391 DMA.CH0.SRCADDR2 = (((uint32_t) &color) >> 16) & 0xff; 01392 01393 DMA.CH0.REPCNT = 255; 01394 DMA.CH0.CTRLA = (uint8_t) 01395 DMA_CH_ENABLE_bm | 01396 DMA_CH_REPEAT_bm | 01397 DMA_CH_TRFREQ_bm | 01398 DMA_CH_SINGLE_bm | 01399 DMA_CH_BURSTLEN_1BYTE_gc; 01400 do {} while ((DMA.CH0.CTRLB & DMA_CH_CHBUSY_bm) != 0x00); 01401 01402 count -= 255; 01403 } 01404 01405 if ((count & 0xff) > 0) { 01406 DMA.CH0.SRCADDR0 = (((uint32_t) &color) >> 0) & 0xff; 01407 DMA.CH0.SRCADDR1 = (((uint32_t) &color) >> 8) & 0xff; 01408 DMA.CH0.SRCADDR2 = (((uint32_t) &color) >> 16) & 0xff; 01409 01410 DMA.CH0.REPCNT = count & 0xff; 01411 DMA.CH0.CTRLA = (uint8_t) 01412 DMA_CH_ENABLE_bm | 01413 DMA_CH_REPEAT_bm | 01414 DMA_CH_TRFREQ_bm | 01415 DMA_CH_SINGLE_bm | 01416 DMA_CH_BURSTLEN_1BYTE_gc; 01417 do {} while ((DMA.CH0.CTRLB & DMA_CH_CHBUSY_bm) != 0x00); 01418 } 01419 } 01420 01421 et024006_DeselectSPI(); 01422 #endif 01423 }
static void et024006_GeneralSettings | ( | void | ) | [static] |
General display settings.
This are settings provided by EDT and are optimised for the display.
Definition at line 1806 of file et024006dhu.c.
References et024006_WriteRegister(), HIMAX_CYCLECTRL1, HIMAX_CYCLECTRL14, HIMAX_CYCLECTRL2, HIMAX_CYCLECTRL3, HIMAX_CYCLECTRL4, HIMAX_CYCLECTRL5, HIMAX_CYCLECTRL6, HIMAX_DISPCTRL2, HIMAX_DISPCTRL3, HIMAX_DISPCTRL4, HIMAX_DISPCTRL5, HIMAX_DISPCTRL6, HIMAX_DISPCTRL7, HIMAX_DISPMODECTRL, HIMAX_INVON, HIMAX_NORON, HIMAX_OSCCTRL1, and HIMAX_OSCCTRL3.
Referenced by et024006_Init().
01807 { 01808 et024006_WriteRegister( HIMAX_DISPMODECTRL, (1 << HIMAX_INVON) | 01809 (1 << HIMAX_NORON)); 01810 01811 et024006_WriteRegister( HIMAX_CYCLECTRL1, 0x01 ); 01812 et024006_WriteRegister( HIMAX_CYCLECTRL2, 0x01 ); 01813 et024006_WriteRegister( HIMAX_CYCLECTRL3, 0xF0 ); 01814 et024006_WriteRegister( HIMAX_CYCLECTRL4, 0x00 ); 01815 et024006_WriteRegister( HIMAX_CYCLECTRL5, 0x38 ); 01816 et024006_WriteRegister( HIMAX_CYCLECTRL6, 0x0F ); 01817 et024006_WriteRegister( HIMAX_CYCLECTRL14, 0xF0 ); 01818 01819 01820 et024006_WriteRegister( HIMAX_DISPCTRL2, 0x02 ); 01821 et024006_WriteRegister( HIMAX_DISPCTRL3, 0x02 ); 01822 et024006_WriteRegister( HIMAX_DISPCTRL4, 0x02 ); 01823 et024006_WriteRegister( HIMAX_DISPCTRL5, 0x02 ); 01824 et024006_WriteRegister( HIMAX_DISPCTRL6, 0x02 ); 01825 et024006_WriteRegister( HIMAX_DISPCTRL7, 0x02 ); 01826 01827 et024006_WriteRegister( HIMAX_OSCCTRL1, 0x49 ); 01828 et024006_WriteRegister( HIMAX_OSCCTRL3, 0x08 ); 01829 }
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 }
static void et024006_InterfaceSettings | ( | void | ) | [static] |
Sets display interface.
Configures screen orientation and color mode.
Definition at line 1856 of file et024006dhu.c.
References et024006_WriteRegister(), HIMAX_BGR, HIMAX_MEMACCESSCTRL, HIMAX_MV, and HIMAX_MX.
Referenced by et024006_Init().
01857 { 01858 // Scanning order from frame memory to display 01859 // RGB -> BGR swap 01860 et024006_WriteRegister( HIMAX_MEMACCESSCTRL, 01861 (1 << HIMAX_MX) 01862 | (1 << HIMAX_MV) 01863 | (1 << HIMAX_BGR) ); 01864 01865 }
static void et024006_PowerOn | ( | void | ) | [static] |
Turns the display on.
Definition at line 1892 of file et024006dhu.c.
References et024006_SetRegister(), et024006_WriteRegister(), HIMAX_D0, HIMAX_D1, HIMAX_DISPCTRL1, HIMAX_DTE, HIMAX_GON, HIMAX_INTERNAL28, HIMAX_TEON, and tft_data.
Referenced by et024006_Init().
01893 { 01894 et024006_WriteRegister( HIMAX_DISPCTRL1, (1 << HIMAX_D0) ); 01895 01896 cpu_delay_ms( 40, tft_data.cpu_hz ); 01897 et024006_WriteRegister( HIMAX_DISPCTRL1, (1 << HIMAX_GON) | 01898 (1 << HIMAX_D0) ); 01899 et024006_WriteRegister( HIMAX_DISPCTRL1, (1 << HIMAX_GON) | 01900 (1 << HIMAX_D1) | (1 << HIMAX_D0)); 01901 01902 cpu_delay_ms( 40, tft_data.cpu_hz ); 01903 et024006_WriteRegister( HIMAX_DISPCTRL1, (1 << HIMAX_GON)| (1 << HIMAX_DTE) | 01904 (1 << HIMAX_D1) | (1 << HIMAX_D0)); 01905 01906 et024006_SetRegister( HIMAX_INTERNAL28, (1 << HIMAX_TEON) ); 01907 }
static void et024006_PowerSettings | ( | void | ) | [static] |
Power setup.
Sets basic DC/DC and VCOM parameters.
Definition at line 1835 of file et024006dhu.c.
References et024006_WriteRegister(), HIMAX_CYCLECTRL1_x, HIMAX_CYCLECTRL2_x, HIMAX_CYCLECTRL3_x, HIMAX_DISPCTRL10, HIMAX_DISPCTRL8, HIMAX_DISPCTRL9, HIMAX_POWERCTRL3, HIMAX_POWERCTRL4, HIMAX_POWERCTRL5, HIMAX_POWERCTRL6, HIMAX_VCOMCTRL2, and HIMAX_VCOMCTRL3.
Referenced by et024006_Init().
01836 { 01837 et024006_WriteRegister( HIMAX_CYCLECTRL1_x, 0x95 ); 01838 et024006_WriteRegister( HIMAX_CYCLECTRL2_x, 0x95 ); 01839 et024006_WriteRegister( HIMAX_CYCLECTRL3_x, 0xFF ); 01840 et024006_WriteRegister( HIMAX_DISPCTRL8, 0x7F ); 01841 et024006_WriteRegister( HIMAX_DISPCTRL9, 0x38 ); 01842 et024006_WriteRegister( HIMAX_DISPCTRL10, 0x78 ); 01843 01844 et024006_WriteRegister( HIMAX_POWERCTRL3, 0x07 ); 01845 et024006_WriteRegister( HIMAX_POWERCTRL4, 0x00 ); 01846 et024006_WriteRegister( HIMAX_POWERCTRL5, 0x04 ); 01847 et024006_WriteRegister( HIMAX_POWERCTRL6, 0x40 ); 01848 et024006_WriteRegister( HIMAX_VCOMCTRL2, 0x38 ); 01849 et024006_WriteRegister( HIMAX_VCOMCTRL3, 0x12 ); 01850 }
static void et024006_PowerUp | ( | void | ) | [static] |
Power up display.
Turns on DC/DC converters.
Definition at line 1871 of file et024006dhu.c.
References et024006_WriteRegister(), HIMAX_DK, HIMAX_PON, HIMAX_POWERCTRL1, HIMAX_POWERCTRL2, HIMAX_VCOMCTRL1, HIMAX_VCOMG, and tft_data.
Referenced by et024006_Init().
01872 { 01873 cpu_delay_ms( 10, tft_data.cpu_hz ); 01874 et024006_WriteRegister( HIMAX_POWERCTRL2, 0x04 ); // AP = 100 01875 01876 cpu_delay_ms( 20, tft_data.cpu_hz ); 01877 et024006_WriteRegister( HIMAX_VCOMCTRL1, (1 << HIMAX_VCOMG) ); 01878 01879 cpu_delay_ms( 5, tft_data.cpu_hz ); 01880 et024006_WriteRegister( HIMAX_POWERCTRL1, (1 << HIMAX_DK) ); 01881 01882 cpu_delay_ms( 40, tft_data.cpu_hz ); 01883 et024006_WriteRegister( HIMAX_POWERCTRL1, (1 << HIMAX_PON) ); 01884 01885 // In case the et024006_DisplayOn function is called right after 01886 cpu_delay_ms( 40, tft_data.cpu_hz ); 01887 }
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 }
static __inline__ uint8_t et024006_ReadRegister | ( | uint8_t | address | ) | [static] |
Definition at line 1209 of file et024006dhu.c.
References ET024006_CMD_ADDR, and ET024006_PARAM_ADDR.
Referenced by et024006_Scroll(), et024006_SetRegister(), and et024006_TestDisplay().
01210 { 01211 *ET024006_CMD_ADDR = (uint16_t) address; 01212 return *ET024006_PARAM_ADDR; 01213 }
static void et024006_ResetDisplay | ( | void | ) | [static] |
Does a hard reset of the display.
Definition at line 1660 of file et024006dhu.c.
References tft_data.
Referenced by et024006_Init().
01661 { 01662 // clear reset line 01663 gpio_clr_gpio_pin(ET024006DHU_RESET_PIN); 01664 // 50us delay 01665 cpu_delay_us( 50, tft_data.cpu_hz ); 01666 01667 gpio_set_gpio_pin(ET024006DHU_RESET_PIN); 01668 // 5ms delay 01669 cpu_delay_ms( 5, tft_data.cpu_hz ); 01670 }
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 }
static __inline__ void et024006_SelectRegister | ( | uint8_t | address | ) | [static] |
Definition at line 1217 of file et024006dhu.c.
References ET024006_CMD_ADDR.
Referenced by et024006_CopyPixelsFromScreen(), et024006_CopyPixelsToScreen(), et024006_DrawBitmap(), et024006_DrawPixel(), et024006_DrawQuickPixel(), et024006_DuplicatePixel(), et024006_GetPixel(), et024006_PrintString(), et024006_PutBitmap(), et024006_PutPixmap(), and et024006_TestDisplay().
01218 { 01219 *ET024006_CMD_ADDR = (uint16_t) address; 01220 }
static void et024006_SetLimits | ( | uint16_t | x1, | |
uint16_t | y1, | |||
uint16_t | x2, | |||
uint16_t | y2 | |||
) | [static] |
Sets the display limits according to the corner coordinates. Writing to the display will result in writing to the area specified through this function.
Definition at line 1283 of file et024006dhu.c.
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().
01284 { 01285 et024006_WriteRegister( HIMAX_COL_ADDR_START2, (x1 >> 8) ); 01286 et024006_WriteRegister( HIMAX_COL_ADDR_START1, (x1 & 0xff) ); 01287 et024006_WriteRegister( HIMAX_COL_ADDR_END2, (x2 >> 8) ); 01288 et024006_WriteRegister( HIMAX_COL_ADDR_END1, (x2 & 0xff) ); 01289 et024006_WriteRegister( HIMAX_ROW_ADDR_START2, (y1 >> 8) ); 01290 et024006_WriteRegister( HIMAX_ROW_ADDR_START1, (y1 & 0xff) ); 01291 et024006_WriteRegister( HIMAX_ROW_ADDR_END2, (y2 >> 8) ); 01292 et024006_WriteRegister( HIMAX_ROW_ADDR_END1, (y2 & 0xff) ); 01293 }
static void et024006_SetQuickLimits | ( | uint16_t | x, | |
uint16_t | y | |||
) | [static] |
Set the starting point of the next read/write from/to RAM. This sets only the start point of the RAM window.
Definition at line 1298 of file et024006dhu.c.
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().
01299 { 01300 et024006_WriteRegister( HIMAX_COL_ADDR_START2, (x >> 8) ); 01301 et024006_WriteRegister( HIMAX_COL_ADDR_START1, (x & 0xff) ); 01302 et024006_WriteRegister( HIMAX_ROW_ADDR_START2, (y >> 8) ); 01303 et024006_WriteRegister( HIMAX_ROW_ADDR_START1, (y & 0xff) ); 01304 }
static void et024006_SetRegister | ( | uint8_t | address, | |
uint8_t | bitmask | |||
) | [static] |
Definition at line 1262 of file et024006dhu.c.
References et024006_ReadRegister(), and et024006_WriteRegister().
Referenced by et024006_PowerOn().
01263 { 01264 uint8_t value = et024006_ReadRegister( address ); 01265 value |= bitmask; 01266 et024006_WriteRegister( address, value ); 01267 }
static void et024006_SetupInterface | ( | void | ) | [static] |
Definition at line 1642 of file et024006dhu.c.
Referenced by et024006_Init().
01643 { 01644 01645 // et024006_TE (tearing sync) signal from display is input 01646 // without any pull resistors 01647 gpio_enable_gpio_pin(ET024006DHU_TE_PIN); 01648 01649 // Backlight pin (PWM) for display is output 01650 gpio_enable_module_pin(ET024006DHU_BL_PIN, ET024006DHU_BL_FUNCTION); 01651 // Turns backlight ON 01652 /*TODO Add backlight driver */ 01653 01654 // Reset pin for display is output 01655 gpio_set_gpio_pin(ET024006DHU_RESET_PIN); 01656 }
int et024006_TestDisplay | ( | void | ) |
Tests if a valid and functional display is connected. This function currently works only for the 16-bit color space configuration. For other configurations the read values of the display ram are different due to the internal handling.
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 }
static __inline__ void et024006_WriteRegister | ( | uint8_t | address, | |
uint8_t | value | |||
) | [static] |
Definition at line 1201 of file et024006dhu.c.
References ET024006_CMD_ADDR, and ET024006_PARAM_ADDR.
Referenced by et024006_AdjustGamma(), et024006_GeneralSettings(), et024006_InterfaceSettings(), et024006_PowerOn(), et024006_PowerSettings(), et024006_PowerUp(), et024006_Scroll(), et024006_ScrollAreaSetup(), et024006_ScrollDisable(), et024006_ScrollEnable(), et024006_SetLimits(), et024006_SetQuickLimits(), and et024006_SetRegister().
01202 { 01203 *ET024006_CMD_ADDR = (uint16_t) address; 01204 *ET024006_PARAM_ADDR = (uint16_t) value; 01205 }
unsigned long cpu_hz |
Definition at line 493 of file et024006dhu.c.
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] |
unsigned long hsb_hz |
Definition at line 494 of file et024006dhu.c.
struct { ... } tft_data [static] |
Referenced by et024006_Init(), et024006_PowerOn(), et024006_PowerUp(), and et024006_ResetDisplay().