hollyhock
|
Functions for interacting with the LCD and VRAM. More...
#include <stdint.h>
Go to the source code of this file.
Macros | |
#define | __UCONCAT(a, b) #a b |
#define | _UCONCAT(a, b) __UCONCAT(a, b) |
#define | UCONCAT(b) _UCONCAT(__USER_LABEL_PREFIX__, b) |
#define | RGB_TO_RGB565(r, g, b) |
#define | RGB565_TO_R(rgb565) ((rgb565 >> 11) & 0x1F) |
#define | RGB565_TO_G(rgb565) ((rgb565 >> 5) & 0x3F) |
#define | RGB565_TO_B(rgb565) (rgb565 & 0x1F) |
Enumerations | |
enum | LCD_Palette { PALETTE_BLACK = 0 , PALETTE_BLUE = 1 , PALETTE_GREEN = 2 , PALETTE_CYAN = 3 , PALETTE_RED = 4 , PALETTE_MAGENTA = 5 , PALETTE_YELLOW = 6 , PALETTE_WHITE = 7 } |
enum | LCD_Command { COMMAND_SET_X_WINDOW = 0x2A , COMMAND_SET_Y_WINDOW = 0x2B , COMMAND_PREPARE_FOR_DRAW_DATA = 0x2C , COMMAND_READ_DRAW_DATA = 0x2E } |
Functions | |
LCD_SetPixelFromPaletteU (x, y,(uint8_t) color) | |
Variables | |
volatile uint16_t *const | lcd_data_port = (volatile uint16_t *)0xB4000000 |
void(* | LCD_ClearScreen )() |
uint16_t(* | LCD_GetPixel )(unsigned int x, unsigned int y) |
void(* | LCD_GetSize )(unsigned int *width, unsigned int *height) |
uint16_t *(* | _FP_LCD_GetVRAMAddress )() __asm__(UCONCAT("LCD_GetVRAMAddress")) |
void(* | LCD_Refresh )() |
void(* | LCD_SetPixel )(unsigned int x, unsigned int y, uint16_t color) |
void(* | LCD_SetPixelFromPaletteU )(unsigned int x, unsigned int y, uint8_t index) __asm__(UCONCAT("LCD_SetPixelFromPalette")) |
static unsigned int | y |
static unsigned int enum LCD_Palette | color |
static unsigned int enum LCD_Palette color void(* | LCD_VRAMBackup )() |
void(* | LCD_VRAMRestore )() |
void(* | LCD_SendCommandU )(uint16_t command) __asm__(UCONCAT("LCD_SendCommand")) |
void(* | LCD_SetDrawingBounds )(unsigned int xstart, unsigned int xend, unsigned int ystart, unsigned int yend) |
Functions for interacting with the LCD and VRAM.
Different levels of indirection are availiable to write to VRAM (direct memory access, getter/setters and palette-based drawing). The contents of VRAM are not automatically drawn to the LCD, and must be rendered with LCD_Refresh.
Example: drawing a 30x50 rectangle at 10, 20 in purple
#define RGB565_TO_B | ( | rgb565 | ) | (rgb565 & 0x1F) |
Extracts the blue component from an RGB565 value.
rgb565 | The RGB565 value. |
#define RGB565_TO_G | ( | rgb565 | ) | ((rgb565 >> 5) & 0x3F) |
Extracts the green component from an RGB565 value.
rgb565 | The RGB565 value. |
#define RGB565_TO_R | ( | rgb565 | ) | ((rgb565 >> 11) & 0x1F) |
Extracts the red component from an RGB565 value.
rgb565 | The RGB565 value. |
#define RGB_TO_RGB565 | ( | r, | |
g, | |||
b | |||
) |
Converts three RGB values into one RGB565 value.
r | The red component, between 0 and 31 (0x1F) inclusive. |
g | The green component, between 0 and 63 (0x3F) inclusive. |
b | The blue component, between 0 and 31 (0x1F) inclusive. |
enum LCD_Command |
Passed to LCD_SendCommand.
enum LCD_Palette |
Passed to LCD_SetPixelFromPalette.
|
extern |
Clears the LCD. Fills VRAM with white, but does not refresh the LCD.
|
extern |
Returns the color of a pixel. This is not necessarily the color which is being displayed on the LCD, but instead is the color specified for the pixel in the VRAM buffer. Color is in RGB565 format.
x,y | The coordinates of the pixel. |
|
extern |
Retrieves the size, in pixels, of the LCD.
[out] | width,height | The LCD's size. |
|
extern |
Pushes the content of the VRAM to the LCD.
|
extern |
Sets the region of the next display update. Needs to be called every time. Usefull for partial updates and/or DMA.
You probably want to use this in conjunction with LCD_SendCommand
|
extern |
Sets the color of a pixel. The result of this operation will not be visible until LCD_Refresh is called. Color is in RGB565 format.
x,y | The coordinate of the pixel. |
color | The color to set the pixel, in RGB565 format. |
unsigned int enum LCD_Palette color void(* LCD_VRAMBackup) () | ( | ) |
Backs up the current contents of VRAM.
Should be used to prevent display corruption when writing directly to VRAM.
Used in conjunction with LCD_VRAMRestore.
|
extern |
Restores the backed up contents of VRAM. The restored content is not displayed until LCD_Refresh is called.
Used in conjunction with LCD_VRAMBackup.