diff options
author | root <root@ps-pc.(none)> | 2014-07-09 21:25:21 +0300 |
---|---|---|
committer | root <root@ps-pc.(none)> | 2014-07-09 21:25:21 +0300 |
commit | ec4c2c43e00a0383bbe249d4a30419b7b0175079 (patch) | |
tree | b2bab65f43486fe161d917c8a7d03a76236fd2bc /boards/base/RaspberryPi/board_framebuffer.h | |
parent | 0afcec1ddb9990b857ae06eadb8fbdbad86c9ca4 (diff) | |
parent | 2a40353883fe3574d668612e12c361dbd0e567b8 (diff) | |
download | uGFX-ec4c2c43e00a0383bbe249d4a30419b7b0175079.tar.gz uGFX-ec4c2c43e00a0383bbe249d4a30419b7b0175079.tar.bz2 uGFX-ec4c2c43e00a0383bbe249d4a30419b7b0175079.zip |
Merge branch 'pcf8812' of https://bitbucket.org/pashamray/ugfx into pcf8812
Diffstat (limited to 'boards/base/RaspberryPi/board_framebuffer.h')
-rw-r--r-- | boards/base/RaspberryPi/board_framebuffer.h | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/boards/base/RaspberryPi/board_framebuffer.h b/boards/base/RaspberryPi/board_framebuffer.h new file mode 100644 index 00000000..eeefeb06 --- /dev/null +++ b/boards/base/RaspberryPi/board_framebuffer.h @@ -0,0 +1,89 @@ +/* + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://ugfx.org/license.html + */ + + +// Set this to your frame buffer pixel format and size. You can also override these in your makefile. +#ifndef GDISP_LLD_PIXELFORMAT + #define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_RGB565 +#endif +#ifndef GDISP_SCREEN_WIDTH + #define GDISP_SCREEN_WIDTH 800 +#endif +#ifndef GDISP_SCREEN_HEIGHT + #define GDISP_SCREEN_HEIGHT 600 +#endif + +#ifdef GDISP_DRIVER_VMT + + #if GDISP_SCREEN_WIDTH > 4096 || GDISP_SCREEN_HEIGHT > 4096 + #error "Raspberry Pi Framebuffer: Screen size is defined too large. Max is 4096x4096" + #endif + + #include "rpi_mailbox.h" + + typedef struct FrameBufferDescription { + uint32_t width; + uint32_t height; + uint32_t vWidth; + uint32_t vHeight; + uint32_t pitch; + uint32_t bitDepth; + uint32_t x; + uint32_t y; + void * pointer; + uint32_t size; + } FrameBufferDescription; + + static FrameBufferDescription FrameBufferInfo __attribute__((aligned (16))) = { 1024, 768, 1024, 768, 0, 24, 0, 0, 0, 0 }; + + static void board_init(GDisplay *g, fbInfo *fbi) { + // Initialize the Raspberry Pi frame buffer + + FrameBufferInfo.width = GDISP_SCREEN_WIDTH; + FrameBufferInfo.height = GDISP_SCREEN_HEIGHT; + FrameBufferInfo.vWidth = GDISP_SCREEN_WIDTH; + FrameBufferInfo.vHeight = GDISP_SCREEN_HEIGHT; + FrameBufferInfo.bitDepth = LLDCOLOR_BITS; + + rpi_writemailbox(1, 0x40000000 + (uint32_t) &FrameBufferInfo); + + if (rpi_readmailbox(1) != 0) + gfxHalt("Could not set display parameters") + + // Set the details of the frame buffer + g->g.Width = GDISP_SCREEN_WIDTH; + g->g.Height = GDISP_SCREEN_HEIGHT; + g->g.Backlight = 100; + g->g.Contrast = 50; + fbi->linelen = g->g.Width * sizeof(LLDCOLOR_TYPE); // bytes per row + fbi->pixels = FrameBufferInfo.pointer; // pointer to the memory frame buffer + } + + #if GDISP_HARDWARE_FLUSH + static void board_flush(GDisplay *g) { + (void) g; + } + #endif + + #if GDISP_NEED_CONTROL + static void board_backlight(GDisplay *g, uint8_t percent) { + (void) g; + (void) percent; + } + + static void board_contrast(GDisplay *g, uint8_t percent) { + (void) g; + (void) percent; + } + + static void board_power(GDisplay *g, powermode_t pwr) { + (void) g; + (void) pwr; + } + #endif + +#endif /* GDISP_DRIVER_VMT */ |