?? lcddummy.c
字號:
/*
*********************************************************************************************************
* uC/GUI
* Universal graphic software for embedded applications
*
* (c) Copyright 2002, Micrium Inc., Weston, FL
* (c) Copyright 2002, SEGGER Microcontroller Systeme GmbH
*
* 礐/GUI is protected by international copyright laws. Knowledge of the
* source code may not be used to write a similar product. This file may
* only be used in accordance with a license and should not be redistributed
* in any way. We appreciate your understanding and fairness.
*
----------------------------------------------------------------------
File : LCDDummy.C
Purpose : Empty driver for emWin GSC
This driver does no perform any function, but it can be
used for 2 purposes:
a) Satisfy all externals so an application can be
compiled and linked in target hardware even if the
driver is not already available
b) Template for a starting point for a new driver.
----------------------------------------------------------------------
Adapting to a new system (creating a new driver):
In this case, the first step is to fill the routines
LCD_L0_GetPixelIndex, LCD_L0_SetPixelIndex and LCD_L0_Init with
functionality, which is sufficient to make the hardware work.
A second (optional) step would be to optimize higher level routines.
----------------------------------------------------------------------
Version-Date---Author-Explanation
----------------------------------------------------------------------
1.00.00 020417 JE a) Changed to have only to adapt _GetPixelIndex
and _SetPixelIndex
0.90.00 020214 JE a) First release
---------------------------END-OF-HEADER------------------------------
*/
#include "LCD_Private.h" /* private modul definitions & config */
#include "GUI_Private.h"
#include "GUIDebug.h"
#include "LCD_0.h" /* Defines for first display */
typedef unsigned char uint8; /* defined for unsigned 8-bits integer variable 無符號8位整型變量 */
typedef signed char int8; /* defined for signed 8-bits integer variable 有符號8位整型變量 */
typedef unsigned short uint16; /* defined for unsigned 16-bits integer variable 無符號16位整型變量 */
typedef signed short int16; /* defined for signed 16-bits integer variable 有符號16位整型變量 */
typedef unsigned int uint32; /* defined for unsigned 32-bits integer variable 無符號32位整型變量 */
typedef signed int int32; /* defined for signed 32-bits integer variable 有符號32位整型變量 */
#define GBA_REG_DISPCNT (*(volatile uint16 *)0x04000000) //顯示控制寄存器地址
#define GBA_VRAM (*(volatile uint16 *)0x06000000) //圖像緩沖區地址
/*********************************************************************
*
* Defines
*
**********************************************************************
*/
#ifndef LCD_INIT_CONTROLLER
#define LCD_INIT_CONTROLLER() GBA_REG_DISPCNT = 0x0403;
#endif
/*********************************************
*
* LCD_L0_SetPixelIndex
*
**********************************************
Purpose:
Sets the index of the given pixel. The upper layers of emWin
calling this routine make sure that the coordinates are in range, so
that no check on the parameters needs to be performed.
*/
void LCD_L0_SetPixelIndex(int x, int y, int PixelIndex) {
*(&GBA_VRAM + 240*y + x) = PixelIndex;
}
/*********************************************
*
* LCD_L0_GetPixelIndex
*
**********************************************
Purpose:
Returns the index of the given pixel. The upper layers of emWin
calling this routine make sure that the coordinates are in range, so
that no check on the parameters needs to be performed.
*/
unsigned int LCD_L0_GetPixelIndex(int x, int y) {
LCD_PIXELINDEX PixelIndex;
PixelIndex = *(&GBA_VRAM + 240*y + x);
return PixelIndex;
}
/*********************************************
*
* LCD_L0_XorPixel
*
**********************************************
*/
void LCD_L0_XorPixel(int x, int y) {
LCD_PIXELINDEX PixelIndex = LCD_L0_GetPixelIndex(x, y);
LCD_L0_SetPixelIndex(x, y, LCD_NUM_COLORS - PixelIndex - 1);
}
/*********************************************
*
* LCD_L0_DrawHLine
*
**********************************************
*/
void LCD_L0_DrawHLine (int x0, int y, int x1) {
if (GUI_Context.DrawMode & LCD_DRAWMODE_XOR) {
for (; x0 <= x1; x0++) {
LCD_L0_XorPixel(x0, y);
}
} else {
for (; x0 <= x1; x0++) {
LCD_L0_SetPixelIndex(x0, y, LCD_COLORINDEX);
}
}
}
/*********************************************
*
* LCD_L0_DrawVLine
*
**********************************************
*/
void LCD_L0_DrawVLine (int x, int y0, int y1) {
if (GUI_Context.DrawMode & LCD_DRAWMODE_XOR) {
for (; y0 <= y1; y0++) {
LCD_L0_XorPixel(x, y0);
}
} else {
for (; y0 <= y1; y0++) {
LCD_L0_SetPixelIndex(x, y0, LCD_COLORINDEX);
}
}
}
/*********************************************
*
* LCD_L0_FillRect
*
**********************************************
*/
void LCD_L0_FillRect(int x0, int y0, int x1, int y1) {
for (; y0 <= y1; y0++) {
LCD_L0_DrawHLine(x0, y0, x1);
}
}
/*********************************************
*
* Draw Bitmap 16 BPP
*
**********************************************
*/
static void DrawBitLine16BPP(int x, int y, U16 const * p, int xsize, const LCD_PIXELINDEX * pTrans) {
LCD_PIXELINDEX pixel;
if ((GUI_Context.DrawMode & LCD_DRAWMODE_TRANS) == 0) {
if (pTrans) {
for (; xsize > 0; xsize--, x++, p++) {
pixel = *p;
LCD_L0_SetPixelIndex(x, y, *(pTrans + pixel));
}
} else {
for (;xsize > 0; xsize--, x++, p++) {
LCD_L0_SetPixelIndex(x, y, *p);
}
}
} else {
if (pTrans) {
for (; xsize > 0; xsize--, x++, p++) {
pixel = *p;
if (pixel) {
LCD_L0_SetPixelIndex(x, y, *(pTrans + pixel));
}
}
} else {
for (; xsize > 0; xsize--, x++, p++) {
pixel = *p;
if (pixel) {
LCD_L0_SetPixelIndex(x, y, pixel);
}
}
}
}
}
/*********************************************
*
* LCD_L0_DrawBitmap
*
**********************************************
*/
void LCD_L0_DrawBitmap(int x0, int y0,
int xsize, int ysize,
int BitsPerPixel,
int BytesPerLine,
const U8* pData, int Diff,
const LCD_PIXELINDEX* pTrans)
{
int i;
/* Use _DrawBitLineXBPP */
for (i=0; i<ysize; i++) {
DrawBitLine16BPP(x0, i + y0, (const U16 *)pData, xsize, pTrans);
pData += BytesPerLine;
}
}
/*********************************************
*
* LCD_L0_SetOrg
*
**********************************************
*/
int OrgX, OrgY;
void LCD_L0_SetOrg(int x, int y) {
OrgX = x;
OrgY = y;
}
/*********************************************
*
* LCD_On / LCD_Off
*
**********************************************
*/
void LCD_On (void) {
#ifdef LCD_ON
LCD_ON();
#endif
}
void LCD_Off (void) {
#ifdef LCD_OFF
LCD_OFF();
#endif
}
/*********************************************
*
* LCD_L0_Init
*
**********************************************
Purpose:
Initialises the LCD-controller.
*/
int LCD_L0_Init(void) {
LCD_INIT_CONTROLLER();
return 0;
}
/*********************************************
*
* LCD_L0_SetLUTEntry
*
**********************************************
*/
void LCD_L0_SetLUTEntry(U8 Pos, LCD_COLOR Color) {
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -