#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"
Functions | |
static void | et024006_AdjustGamma (void) |
Display gamma setup. More... | |
static void | et024006_AdjustSleepingGamma (void) |
et024006_color_t | et024006_Color (uint8_t r, uint8_t g, uint8_t b) |
Converts a RGB 8:8:8 color to RGB 5:6:5. More... | |
static void | et024006_CopyBitsToScreen (void *bitmap, uint32_t count, et024006_color_t foreground_color, et024006_color_t background_color) |
void | et024006_CopyPixelsFromScreen (et024006_color_t *pixels, uint32_t count) |
void | et024006_CopyPixelsToScreen (et024006_color_t const *pixels, uint32_t count) |
void | et024006_DrawBitmap (const uint16_t data[], 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_DrawQuickPixel (uint16_t x, uint16_t y, et024006_color_t color) |
void | et024006_DrawVertLine (uint16_t x, uint16_t y, uint16_t length, et024006_color_t color) |
void | et024006_DuplicatePixel (et024006_color_t color, uint32_t count) |
void | et024006_enter_idle (void) |
Make display enter in an idle mode. More... | |
static void | et024006_GeneralSettings (void) |
General display settings. More... | |
et024006_color_t | et024006_GetPixel (uint16_t x, uint16_t y) |
void | et024006_GetPixmap (et024006_color_t *pixmap, uint16_t map_width, uint16_t map_x, uint16_t map_y, uint16_t x, uint16_t y, uint16_t width, uint16_t height) |
void | et024006_Init (unsigned long cpu_hz, unsigned long hsb_hz) |
Initialize the TFT display. More... | |
static void | et024006_InterfaceSettings (void) |
Sets display interface. More... | |
void | et024006_leave_idle (void) |
Make display leave the idle mode. More... | |
static void | et024006_PowerOn (void) |
Turns the display on. More... | |
static void | et024006_PowerSettings (void) |
Power setup. More... | |
static void | et024006_PowerUp (void) |
Power up display. More... | |
void | et024006_PrintConsole (char *lcd_string, uint16_t fcolor, int bcolor) |
void | et024006_PrintString (char *lcd_string, const unsigned char *font_style, uint16_t x, uint16_t y, uint16_t fcolor, int bcolor) |
Writes a string to the display. More... | |
void | et024006_PutBitmap (void *bitmap, uint16_t map_width, uint16_t x, uint16_t y, uint16_t width, uint16_t height, et024006_color_t foreground_color, et024006_color_t background_color) |
void | et024006_PutPixmap (et024006_color_t const *pixmap, uint16_t map_width, uint16_t map_x, uint16_t map_y, uint16_t x, uint16_t y, uint16_t width, uint16_t height) |
static __inline__ uint8_t | et024006_ReadRegister (uint8_t address) |
static void | et024006_ResetDisplay (void) |
Does a hard reset of the display. More... | |
void | et024006_Scroll (int16_t lines) |
Scroll the scroll area down/up some lines. More... | |
void | et024006_ScrollAreaSetup (uint16_t tfa, uint16_t vsa, uint16_t bfa) |
Configures a scroll area on the display. More... | |
void | et024006_ScrollDisable () |
Disables the scrolling. More... | |
void | et024006_ScrollEnable () |
Enables the scrolling feature. More... | |
static __inline__ void | et024006_SelectRegister (uint8_t address) |
void | et024006_SetLimits (uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2) |
Sets the display limits according to the corner coordinates. Writing to the display will result in writing to the area specified through this function. More... | |
void | et024006_SetQuickLimits (uint16_t x, uint16_t y) |
Set the starting point of the next read/write from/to RAM. This sets only the start point of the RAM window. More... | |
void | et024006_SetQuickLimits2 (uint16_t x, uint16_t y) |
Set the ending point of the next read/write from/to RAM. This sets only the end point of the RAM window. More... | |
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. More... | |
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 |
Local storage of TFT driver data. More... | |
#define ET024006_BS0 0x04 |
#define et024006_DeselectSPI | ( | ) | (PORTC.OUTSET = PIN4_bm) |
#define ET024006_DMA_USAGE_LIMIT 10 |
Referenced by et024006_DuplicatePixel().
#define ET024006_ID 0x70 |
#define et024006_ReadSPI | ( | ) | (SPIC.DATA) |
Referenced by et024006_CopyPixelsFromScreen(), and et024006_GetPixel().
#define ET024006_RS 0x02 |
#define ET024006_RW 0x01 |
Referenced by et024006_CopyPixelsFromScreen(), and et024006_GetPixel().
#define et024006_SelectSPI | ( | ) | (PORTC.OUTCLR = PIN4_bm) |
#define et024006_SendDummySPI | ( | ) | et024006_SendSPI( 0xff ); |
Referenced by et024006_CopyPixelsFromScreen(), and et024006_GetPixel().
#define et024006_SendSPI | ( | value | ) |
Referenced by et024006_CopyPixelsFromScreen(), et024006_CopyPixelsToScreen(), et024006_DrawPixel(), et024006_DrawQuickPixel(), et024006_DuplicatePixel(), and et024006_GetPixel().
#define HIMAX_AP0 0 |
#define HIMAX_AP1 1 |
#define HIMAX_AP2 2 |
#define HIMAX_BGR 3 |
Referenced by et024006_InterfaceSettings().
#define HIMAX_COL_ADDR_END1 0x05 |
Referenced by et024006_SetLimits(), and et024006_SetQuickLimits2().
#define HIMAX_COL_ADDR_END2 0x04 |
Referenced by et024006_SetLimits(), and et024006_SetQuickLimits2().
#define HIMAX_COL_ADDR_START1 0x03 |
Referenced by et024006_SetLimits(), and et024006_SetQuickLimits().
#define HIMAX_COL_ADDR_START2 0x02 |
Referenced by et024006_SetLimits(), and et024006_SetQuickLimits().
#define HIMAX_CYCLECTRL1 0x3A |
Referenced by et024006_GeneralSettings().
#define HIMAX_CYCLECTRL14 0x41 |
Referenced by et024006_GeneralSettings().
#define HIMAX_CYCLECTRL1_x 0x23 |
Referenced by et024006_PowerSettings().
#define HIMAX_CYCLECTRL2 0x3B |
Referenced by et024006_GeneralSettings().
#define HIMAX_CYCLECTRL2_x 0x24 |
Referenced by et024006_PowerSettings().
#define HIMAX_CYCLECTRL3 0x3C |
Referenced by et024006_GeneralSettings().
#define HIMAX_CYCLECTRL3_x 0x25 |
Referenced by et024006_PowerSettings().
#define HIMAX_CYCLECTRL4 0x3D |
Referenced by et024006_GeneralSettings().
#define HIMAX_CYCLECTRL5 0x3E |
Referenced by et024006_GeneralSettings().
#define HIMAX_CYCLECTRL6 0x40 |
Referenced by et024006_GeneralSettings().
#define HIMAX_D0 2 |
Referenced by et024006_PowerOn().
#define HIMAX_D1 3 |
Referenced by et024006_PowerOn().
#define HIMAX_DISPCTRL1 0x26 |
Referenced by et024006_PowerOn().
#define HIMAX_DISPCTRL10 0x36 |
Referenced by et024006_PowerSettings().
#define HIMAX_DISPCTRL2 0x27 |
Referenced by et024006_GeneralSettings().
#define HIMAX_DISPCTRL3 0x28 |
Referenced by et024006_GeneralSettings().
#define HIMAX_DISPCTRL4 0x29 |
Referenced by et024006_GeneralSettings().
#define HIMAX_DISPCTRL5 0x2A |
Referenced by et024006_GeneralSettings().
#define HIMAX_DISPCTRL6 0x2C |
Referenced by et024006_GeneralSettings().
#define HIMAX_DISPCTRL7 0x2D |
Referenced by et024006_GeneralSettings().
#define HIMAX_DISPCTRL8 0x90 |
Referenced by et024006_PowerSettings().
#define HIMAX_DISPCTRL9 0x35 |
Referenced by et024006_PowerSettings().
#define HIMAX_DISPMODECTRL 0x01 |
Referenced by et024006_GeneralSettings().
#define HIMAX_DK 3 |
Referenced by et024006_PowerUp().
#define HIMAX_DTE 4 |
Referenced by et024006_PowerOn().
#define HIMAX_GAMMACTRL1 0x46 |
Referenced by et024006_AdjustGamma(), and et024006_AdjustSleepingGamma().
#define HIMAX_GAMMACTRL10 0x4F |
Referenced by et024006_AdjustGamma(), and et024006_AdjustSleepingGamma().
#define HIMAX_GAMMACTRL11 0x50 |
Referenced by et024006_AdjustGamma().
#define HIMAX_GAMMACTRL12 0x51 |
Referenced by et024006_AdjustGamma().
#define HIMAX_GAMMACTRL2 0x47 |
Referenced by et024006_AdjustGamma(), and et024006_AdjustSleepingGamma().
#define HIMAX_GAMMACTRL3 0x48 |
Referenced by et024006_AdjustGamma().
#define HIMAX_GAMMACTRL4 0x49 |
Referenced by et024006_AdjustGamma().
#define HIMAX_GAMMACTRL5 0x4A |
Referenced by et024006_AdjustGamma().
#define HIMAX_GAMMACTRL6 0x4B |
Referenced by et024006_AdjustGamma(), and et024006_AdjustSleepingGamma().
#define HIMAX_GAMMACTRL7 0x4C |
Referenced by et024006_AdjustGamma(), and et024006_AdjustSleepingGamma().
#define HIMAX_GAMMACTRL8 0x4D |
Referenced by et024006_AdjustGamma().
#define HIMAX_GAMMACTRL9 0x4E |
Referenced by et024006_AdjustGamma().
#define HIMAX_GASENB 7 |
#define HIMAX_GATE_SCAN_CTRL 0x18 |
Referenced by et024006_ScrollDisable(), and et024006_ScrollEnable().
#define HIMAX_GON 5 |
Referenced by et024006_PowerOn().
#define HIMAX_ID_CODE 0x67 |
Referenced by et024006_TestDisplay().
#define HIMAX_ID_CODE_VALUE 0x47 |
#define HIMAX_INTERNAL28 0x70 |
Referenced by et024006_PowerOn().
#define HIMAX_INVON 2 |
Referenced by et024006_GeneralSettings().
#define HIMAX_MEMACCESSCTRL 0x16 |
Referenced by et024006_InterfaceSettings().
#define HIMAX_MV 5 |
Referenced by et024006_InterfaceSettings().
#define HIMAX_MX 6 |
Referenced by et024006_InterfaceSettings().
#define HIMAX_MY 7 |
#define HIMAX_NORON 1 |
Referenced by et024006_GeneralSettings().
#define HIMAX_OSC_EN 0 |
#define HIMAX_OSCCTRL1 0x19 |
Referenced by et024006_GeneralSettings().
#define HIMAX_OSCCTRL2 0x1A |
#define HIMAX_OSCCTRL3 0x93 |
Referenced by et024006_GeneralSettings().
#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 |
Referenced by et024006_PowerUp().
#define HIMAX_POWERCTRL1 0x1B |
Referenced by et024006_PowerUp().
#define HIMAX_POWERCTRL2 0x1c |
Referenced by et024006_PowerUp().
#define HIMAX_POWERCTRL3 0x1D |
Referenced by et024006_PowerSettings().
#define HIMAX_POWERCTRL4 0x1E |
Referenced by et024006_PowerSettings().
#define HIMAX_POWERCTRL5 0x1F |
Referenced by et024006_PowerSettings().
#define HIMAX_POWERCTRL6 0x20 |
Referenced by et024006_PowerSettings().
#define HIMAX_PT0 6 |
#define HIMAX_PT1 7 |
#define HIMAX_ROW_ADDR_END1 0x09 |
Referenced by et024006_SetLimits(), and et024006_SetQuickLimits2().
#define HIMAX_ROW_ADDR_END2 0x08 |
Referenced by et024006_SetLimits(), and et024006_SetQuickLimits2().
#define HIMAX_ROW_ADDR_START1 0x07 |
Referenced by et024006_SetLimits(), and et024006_SetQuickLimits().
#define HIMAX_ROW_ADDR_START2 0x06 |
Referenced by et024006_SetLimits(), and et024006_SetQuickLimits().
#define HIMAX_SAP 0x90 |
#define HIMAX_SCROLL_ON 0x2 |
Referenced by et024006_ScrollEnable().
#define HIMAX_SRAMWRITE 0x22 |
#define HIMAX_STB 0 |
#define HIMAX_TEON 3 |
Referenced by et024006_PowerOn().
#define HIMAX_VCOMCTRL1 0x43 |
Referenced by et024006_PowerUp().
#define HIMAX_VCOMCTRL2 0x44 |
Referenced by et024006_PowerSettings().
#define HIMAX_VCOMCTRL3 0x45 |
Referenced by et024006_PowerSettings().
#define HIMAX_VCOMG 7 |
Referenced by et024006_PowerUp().
#define HIMAX_VS_BFA_HB 0x12 |
Referenced by et024006_ScrollAreaSetup().
#define HIMAX_VS_BFA_LB 0x13 |
Referenced by et024006_ScrollAreaSetup().
#define HIMAX_VS_TFA_HB 0x0E |
Referenced by et024006_ScrollAreaSetup().
#define HIMAX_VS_TFA_LB 0x0F |
Referenced by et024006_ScrollAreaSetup().
#define HIMAX_VS_VSA_HB 0x10 |
Referenced by et024006_Scroll(), and et024006_ScrollAreaSetup().
#define HIMAX_VS_VSA_LB 0x11 |
Referenced by et024006_Scroll(), and et024006_ScrollAreaSetup().
#define HIMAX_VS_VSP_HB 0x14 |
Referenced by et024006_Scroll().
#define HIMAX_VS_VSP_LB 0x15 |
Referenced by et024006_Scroll().
#define HIMAX_VTFT_TRI 1 |
#define HIMAX_XDK 2 |
#define TFT_QUADRANT0 ((1 << 1) | (1 << 0)) |
Referenced by et024006_DrawFilledCircle().
#define TFT_QUADRANT1 ((1 << 3) | (1 << 2)) |
Referenced by et024006_DrawFilledCircle().
#define TFT_QUADRANT2 ((1 << 5) | (1 << 4)) |
Referenced by et024006_DrawFilledCircle().
#define TFT_QUADRANT3 ((1 << 7) | (1 << 6)) |
Referenced by et024006_DrawFilledCircle().
|
static |
Display gamma setup.
Parameters are provided by EDT for the display.
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(), and et024006_leave_idle().
|
static |
References et024006_WriteRegister(), HIMAX_GAMMACTRL1, HIMAX_GAMMACTRL10, HIMAX_GAMMACTRL2, HIMAX_GAMMACTRL6, and HIMAX_GAMMACTRL7.
Referenced by et024006_enter_idle().
|
static |
References ET024006_PARAM_ADDR, and Tst_bits.
Referenced by et024006_PutBitmap().
|
static |
General display settings.
This are settings provided by EDT and are optimized for the display.
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().
|
static |
Sets display interface.
Configures screen orientation and color mode.
References et024006_WriteRegister(), HIMAX_BGR, HIMAX_MEMACCESSCTRL, HIMAX_MV, and HIMAX_MX.
Referenced by et024006_Init().
|
static |
Turns the display on.
References cpu_delay_ms(), 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().
|
static |
Power setup.
Sets basic DC/DC and VCOM parameters.
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().
|
static |
Power up display.
Turns on DC/DC converters.
References cpu_delay_ms(), et024006_WriteRegister(), HIMAX_DK, HIMAX_PON, HIMAX_POWERCTRL1, HIMAX_POWERCTRL2, HIMAX_VCOMCTRL1, HIMAX_VCOMG, and tft_data.
Referenced by et024006_Init().
|
static |
References ET024006_CMD_ADDR, and ET024006_PARAM_ADDR.
Referenced by et024006_Scroll(), et024006_SetRegister(), and et024006_TestDisplay().
|
static |
Does a hard reset of the display.
References cpu_delay_ms(), cpu_delay_us(), ET024006DHU_RESET_PIN, gpio_clr_gpio_pin(), gpio_set_gpio_pin(), and tft_data.
Referenced by et024006_Init().
|
static |
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().
|
static |
References et024006_ReadRegister(), and et024006_WriteRegister().
Referenced by et024006_PowerOn().
|
static |
References ET024006DHU_BL_FUNCTION, ET024006DHU_BL_PIN, ET024006DHU_RESET_PIN, ET024006DHU_TE_PIN, gpio_enable_gpio_pin(), gpio_enable_module_pin(), and gpio_set_gpio_pin().
Referenced by et024006_Init().
|
static |
References ET024006_CMD_ADDR, and ET024006_PARAM_ADDR.
Referenced by et024006_AdjustGamma(), et024006_AdjustSleepingGamma(), et024006_GeneralSettings(), et024006_InterfaceSettings(), et024006_PowerOn(), et024006_PowerSettings(), et024006_PowerUp(), et024006_Scroll(), et024006_ScrollAreaSetup(), et024006_ScrollDisable(), et024006_ScrollEnable(), et024006_SetLimits(), et024006_SetQuickLimits(), et024006_SetQuickLimits2(), and et024006_SetRegister().
unsigned long cpu_hz |
Referenced by et024006_Init().
unsigned long hsb_hz |
Referenced by et024006_Init().
struct { ... } tft_data |
Local storage of TFT driver data.
Referenced by et024006_Init(), et024006_PowerOn(), et024006_PowerUp(), and et024006_ResetDisplay().